You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by hr...@silbergrau.com on 2002/06/12 12:03:54 UTC

Tomcat handling errors for Apache

Hi!

I am using Apache and Tomcat together (with mod_jk) and would like to call 
a servlet as an error-document for non-existent Apache-documents (good old 
"ErrorDocument 404"-stuff).

The solution I need should:
* tell the servlet which url was really requested
* let the servlet return an error-document depending on the requested url, 
which ...
* might also be non-html (in some cases I would like to return a pdf-File 
AS errordocument!!!) ... so if a change the content-type of the response 
in the servlet, it should also change in the Apache-reply to the 
browser!!!

Currently I am doing some "strange hack" to get this (not quite!) right:
*  I direct the errordocument to a .shtml-file
*  this document does a server side include to the servlet and provides it 
with "${REQUEST_URI}" as a request-parameter
*  the servlet can then return the dynamically generated error-document

but with this solution I am experiencing problems when I want to return 
some multimedia-data AS the errordocument (= e.g. returning some pdf-File 
instead of a html-errordocument).
Is this because I cannot change the content-type for the .shtml-file that 
called the jsp-page ??? (I am pretty lost here...)

Any help appreciated
Helmut Rubasch


Silbergrau Consulting & Software GmbH 
fon: +43.70.779169-25 
Dipl.Ing. Helmut Rubasch 
fax: +43.70.779169-12 
Stifterstraße 28/3, Postfach 21 
helmut.rubasch@silbergrau.com 
A-4014 Linz 
www.silbergrau.com