Hi people,
 
I use Tomcat 5.5.9 with Apache 2.0.54 and jk 1.2.10 to serve my websites. I
want to set custom error pages to be served when an error like 404, 500 etc.
occurs. The website uses the iso-8859-9 character set on every page, and the
error pages are encoded with iso-8859-9 too.
 
Only *.jsp pages and servlets are mapped to Tomcat through jk. All other
static content is served by Apache.
 
My error pages are all Server Side Include shtml files. These error files
include some jsp files with:
 
<!--#include virtual="file-name" -->
 
I have set up SSI (correctly I hope) on both Apache and Tomcat, and also set
up custom error file handling on both httpd.conf and the default web.xml for
the site I want to customize.
 
On my server.xml file, my site is configured like this:
 
<Host name=" <http://www.foo.com> www.foo.com" appBase="/usr/www/foo">
  <Context path="" docBase=""/>
  <Context path="/servlet" docBase="servlet"/>
</Host>
 
On my default web.xml for tomcat configuration, SSI servlet has these
directives added:
 
<init-param>
  <param-name>inputEncoding</param-name>
  <param-value>iso-8859-9</param-value>
</init-param>
<init-param>
  <param-name>outputEncoding</param-name>
  <param-value>iso-8859-9</param-value>
</init-param>
 
When I go to some nonexistent foo.html on my website, Apache handles the
customized error page and everything works fine. On the other hand I have
two problems:
 
One is, if the "isVirtualWebappRelative" variable in web.xml is set to "0",
and I go to a nonexistent "foo.jsp" on my server, jk sends the request to
Tomcat and when Tomcat tries to handle the customized error page, it cannot
find the included files in SSI and an error is written in the Tomcat error
log like:
 
SEVERE: ssi: #include--Couldn't include file: /include/footer.jsp
java.io.IOException: Couldn't get context for path: /include/footer.jsp

The /include folder is in the server root. I think it should be able to find
these pages, as it looks at the server root because of the state of
"isVirtualWebappRelative" variable, am I wrong?
 
When I set "isVirtualWebappRelative" to "1", this problem is solved only for
server root, my servlets (say /servlet) still cannot get the customized page
includes, because this time the SSI includes become "web app relative" and I
have to copy the /include folder into /servlet/include directory to work
around this problem.
 
My second problem is, when I go to this nonexistent "foo.jsp" with
"isVirtualWebappRelative" set to "1", and when Tomcat tries to handle the
error page, the encoding is always UTF-8 regardless of "inputEncoding" or
"outputEncoding" variables. So my error page becomes full of garbled
characters because the encoding should be iso-8859-9.
 
Is there any suggestions about these problems?
 
Best regards,
 
Kerem

Reply via email to