Hi Marco, marcobalc schrieb: > Hi, > > .ic is the extension mapped to the controllers of my spring webapp. > > The Excel is generated by a controller (servlet): this controller execute > this instructions > > response.setContentType("application/excel"); > response.setHeader("Content-Disposition","attachment; filename=\"" > nomeFileExcel "\""); > response.flushBuffer();
I see. Do you have any errors in our log files (Tomcat/Webapp), e.g. about response already committed? It seems something either is sending the headers to the web server before the code sets those headers above, or they get reset after setting them. E.g. if the code under any condition calls flushBuffer() before setting those headers, the response will already be committed and you can't set the headers later on. Any call to getWriter() also makes it impossible to set headers later. If there are no error messages, you could try to check via isCommitted() before setting the headers to see, whether this assumption is true or not. You can also use register a ServletResponseWrapper in a filter to intercept the calls to the ServletResponse and to debug, why and when the response got committed prematurely (and also to see, whether your setContentType() got actually called. > For the Excel the problem is repetitive but also for other "normal" html > page (generated by jsp) the text/plain content/type was returned with random > frequency. > > If on apache I add AddType *.ic text/html all the html page are ok but the > excel are printed with binary format on the browser. > > So AddType is not the correct solution: I need that the content type is the > content type returned by tomcat. Not sure, what that shows exactly, but you can set the log level of the connector components higher by adding org.apache.coyote.level = FINEST org.apache.jk.level = FINEST org.apache.tomcat.level = FINEST to conf/logging.properties. The log will then also contain messages like Dec 8, 2008 4:00:05 PM org.apache.jk.core.MsgContext action FINE: COMMIT Dec 8, 2008 4:00:05 PM org.apache.jk.common.JkInputStream appendHead FINE: COMMIT sending headers [EMAIL PROTECTED] === MimeHeaders === ETag = W/"16763-1201552728000" Last-Modified = Mon, 28 Jan 2008 20:38:48 GMT So you can see the headers sent out by Tomcat. Regards, Rainer --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]