-
1. Re: return binary content from jsp page
jonlee Aug 21, 2003 6:58 PM (in response to justkeys)Response type is controlled through the Java statement:
response.setContentType("text/html");
If you do this before any stream output is generated in your JSP you will override the default content type. So your embedded Java code must perform this before any out.print... statements are generated in your JSP->Java.
We usually generate this programmatic output through servlets because we can create a HashMap lookup in the servlet initializer (this only executes once when the servlet object is created). You can then use the HashMap to select the required content-type string.
YMMV. -
2. Re: return binary content from jsp page
justkeys Aug 29, 2003 9:21 AM (in response to justkeys)I know that; the problem is that the very same code does generate a valid zip file in tomcat, and does generate a corrupt zip file in jetty. Same machine, same jvm, same jboss 3.2
That is because during the download, jetty corrupts the stream, probably because it overides the content type somehow.
The zipfile from jetty appears to be corrupt when i try to open it (after download), the one from tomcat opens without problems. -
3. Re: return binary content from jsp page
jonlee Aug 29, 2003 10:03 AM (in response to justkeys)It is possible, I suppose. As I said, we don't use JSPs, we use servlets for this type of work. We haven't had an issue in Jetty with either HTTPS or HTTP streams, doing JPEG, GIF, PDF or DOC. I could test our code with ZIP if that would help confirm operation for you. Actually, we haven't seen an issue with JSPs delivering WAP content either.
Post the generated Java code from the JSP so the folks can have a look at it. Perhaps there is something else going on.
Perhaps as a test, you might want to try the same code with delivery of other binary types just by way of experiment.
Since Jetty uses Jasper, like Tomcat, I'm fairly certain that the generated servlet code itself should be the same for either platform. I'd be interested in determining the issue here. -
4. Re: return binary content from jsp page
justkeys Sep 16, 2003 2:45 AM (in response to justkeys)This code returns a valid zip stream in jboss/tomcat 3.2 RC2, and an invalid zip stream in jboss/jetty 3.2 RC2.
The main jsp file in view.jps; it includes TabsFramePre.jsp. This one receives a model from a ModelBuilder, which might be a SendBinary.Data object,. In that case, the response is handled by the SendBinary class, that sets the content type, and the sends binary content.
good luck