Hi,

We're wanting a servlet request to return a generic file for download.
In Java, we use the following code:

public ActionForward myAction(ActionMapping mapping,
                              ActionForm form,
                              HttpServletRequest request,
                              HttpServletResponse response) throws
Exception {
...
        response.setContentType("application/download");
        response.setHeader("Content-Disposition",
"attachment;filename=\"" + "myfilename" + "\"");
        response.setContentLength(ret.length());

        PrintWriter writer = response.getWriter();
        writer.write(ret);
        writer.flush();
...
        return null;
}

This would work with Tomcat's HTTP interface as well as mod_jk, but with
mod_proxy_ajp, we get an "Error downloading page" from the browser and
the following in the logs:

[Tue Jul 15 16:47:35 2008] [debug] mod_proxy_ajp.c(239): proxy:
APR_BUCKET_IS_EOS
[Tue Jul 15 16:47:35 2008] [debug] mod_proxy_ajp.c(244): proxy: data to
read (max 8186 at 4)
[Tue Jul 15 16:47:35 2008] [debug] mod_proxy_ajp.c(259): proxy: got 0
bytes of data
[Tue Jul 15 16:47:35 2008] [debug] ajp_header.c(652): ajp_read_header:
ajp_ilink_received 04
[Tue Jul 15 16:47:35 2008] [debug] ajp_header.c(662): ajp_parse_type:
got 04
[Tue Jul 15 16:47:35 2008] [debug] ajp_header.c(491):
ajp_unmarshal_response: status = 200
[Tue Jul 15 16:47:35 2008] [debug] ajp_header.c(502):
ajp_unmarshal_response: Number of headers is = 6
[Tue Jul 15 16:47:35 2008] [debug] ajp_header.c(564):
ajp_unmarshal_response: Header[0] [Pragma] = [No-cache]
[Tue Jul 15 16:47:35 2008] [debug] ajp_header.c(564):
ajp_unmarshal_response: Header[1] [Cache-Control] = [no-cache]
[Tue Jul 15 16:47:35 2008] [debug] ajp_header.c(564):
ajp_unmarshal_response: Header[2] [Expires] = [Thu, 01 Jan 1970 00:00:00
GMT]
[Tue Jul 15 16:47:35 2008] [debug] ajp_header.c(564):
ajp_unmarshal_response: Header[3] [Content-Disposition] =
[attachment;filename="myfilename"]
[Tue Jul 15 16:47:35 2008] [debug] ajp_header.c(564):
ajp_unmarshal_response: Header[4] [Content-Type] =
[application/download;charset=ISO-8859-1]
[Tue Jul 15 16:47:35 2008] [debug] ajp_header.c(574):
ajp_unmarshal_response: ap_set_content_type done
[Tue Jul 15 16:47:35 2008] [debug] ajp_header.c(564):
ajp_unmarshal_response: Header[5] [Content-Length] = [67]
[Tue Jul 15 16:47:35 2008] [debug] ajp_header.c(652): ajp_read_header:
ajp_ilink_received 03
[Tue Jul 15 16:47:35 2008] [debug] ajp_header.c(662): ajp_parse_type:
got 03
[Tue Jul 15 16:47:35 2008] [debug] ajp_header.c(652): ajp_read_header:
ajp_ilink_received 05
[Tue Jul 15 16:47:35 2008] [debug] ajp_header.c(662): ajp_parse_type:
got 05
[Tue Jul 15 16:47:35 2008] [debug] mod_proxy_ajp.c(498): proxy: got
response from 10.0.0.1:8009 (server1)
[Tue Jul 15 16:47:35 2008] [debug] proxy_util.c(2062): proxy: AJP: has
released connection for (server1)

Bug? We doing something mod_ajp doesn't like?
--

Richi Plana

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to