users@glassfish.java.net

Re: Path to custom default error page resources

From: Amy Roh <amy.roh_at_oracle.com>
Date: Mon, 20 Feb 2012 17:01:50 -0800

On 2/17/12 12:48 AM, forums_at_java.net wrote:
> After some experimentation, I have come to the conclusion that it IS
> possible
> - but not trivial - to implement user-defined error pages with images in
> Glassfish. It is clear that ${com.sun.aas.instanceRoot} is NOT working
> when
> used in the property 'send-error_1'. Here is a configuration that works:
This is very strange. ${com.sun.aas.instanceRoot} is working for
send-error_1 property for me. Are you using asadmin set command or
editing domain.xml? Have you tried restarting GF?
>
> * Put the files in <domain>/docroot (your own index.html, your own
> 404.html,
> my-picture.jpg, etc)
> * Define send-error_1 to code=404 path=../docroot/404.html
> * In your own error pages, you can include the images with <img
> src="../docroot/my-picture.jpg" ...>
>
> HOWEVER!
>
> If you configure your Glassfish to sit behind Apache (with mod_jk),
> then any
> invalid url (e.g. example.com/wrong) will result in *Apache's* 'Not
> found'
> page.
This is expected since /wrong isn't assigned as JkMount directive for
Apache. You need to define a custom error page in Apache since /wrong
will not get forwarded to GF.

>
> And now the REALLY BAD news:
>
> If your webapp is not working (e.g. example.com/my-webapp) then the
> browser
> will receive your nice 404.html as 'text/plain', and show ITS SOURCE CODE
> instead of a nice web page.
>
> Something's badly wrong. I smell a bug. What could it be?

Can you file an issue [1] and assign it to me (userid : amyroh)?

Thanks for reporting.
Amy

[1 ]http://java.net/jira

>
>
>
>
> --
>
> [Message sent by forum member 'tmpsa']
>
> View Post: http://forums.java.net/node/882803
>
>