> I switched an application I was working on from JServ to Jakarta and realized
> there is a change in the way the response codes for the server are being set.
> Apache no longer "recieves" the response code the servlet sets and therefore
> can not do further processing. For context, I am using apache 1.3.12 with
> mod_jserv from the 3.2.2 tomcat release.
After converting to mod_jk and finding that it didn't fix the problem, I
reverted back to mod_jserv and have made a patch to the tomcat code for the
ajp12 adapter. This will send the response back the same way that JServ used
to and allow apache to handle the response "nativly"
The change is in Ajp12ConnectionHandler.java I simply added this method in the
inner class AJP12ResponseAdapter:
public void endHeaders() throws IOException {
if (status >= 400) {
sout.write("Status: ".getBytes());
sout.write(String.valueOf(status).getBytes());
sout.write(" ".getBytes());
sout.write(ResponseImpl.getMessage( status ).getBytes());
sout.write("\r\nServlet-Error: ".getBytes());
sout.write(ResponseImpl.getMessage( status ).getBytes());
sout.write("\r\n\r\n".getBytes());
sout.flush();
} else {
super.endHeaders();
}
}
I realize this is not the most efficient way of doing it but I think it should
be safe since there typically is not any "action" associated with responses
over 400. If this is the case I would greatly appreciate if someone could fold
this into the main code base.
Andrew