views:

246

answers:

4

I've googled around and only found solution where they suggest putting an apache httpd in front of glassfish. Sure, that works.

But what if I do not wish to/cannot put any thing in front of glassfish?

Without using the index.jsp in the docroot of the domain to have something like:

<%
    String redirectURL = "http://stackoverflow.com/";
    response.sendRedirect(redirectURL);
%>

Can I make browser to be redirected when I point it to: http://my.glassfish.domain/ ?

To provide a little bit more details:

I tried adding a property to the vitual server as: redirect_1 from=/ url=http://stackoverflow.com/ But that make everything to be redirected to http://stackoverflow.com/, eg. http://my.glassfish.domain/myapp redirects to http://stackoverflow.com/ while all I want was http://my.glassfish.domain/ to be redirected to http://stackoverflow.com/

Any help please?

A: 

Modify the DNS mapping for the given URL in your DNS Server (/etc/host on your local machine) . May not be a feasible solution for you - but it does the work of directing the user.

techzen
thanks for the suggestion, but as you guessed, it is not feasible for us. :(
tim_wonil
+2  A: 

Maybe you can use UrlRweriteFilter to redirect users according to defined mappings. Here are some examples

Enrique
Will need to do some investigation, but thanks for pointing the UrlRewriteFilter. Cheers.
tim_wonil
A: 

No you can not. When a request comes to your server, there should be a page (HTML/JSP/Servlet) to process that page. That page should do whatever you wanted to do.

So you must create a HTML / JSP / Servlet.

Hope this helps.

RaviG
+1  A: 

I think the solution you dismiss is actually the 'best'...

Write a jsp in the docroot for the server.

If you really have to do something fancier, due to complications that you haven't described, you may want to try creating a new DefaultServer. Look in your domain-dir/config/default-web.xml.

You may want to look at the code of the DefaultServer that ships with GlassFish Server 3 as a guide.

vkraemer