-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Mark,
On 2/23/2009 3:00 PM, Mark Kimmerly wrote: > I have written a servlet request filter that inspects the URI of > incoming requests and redirects them to an IIS server if appropriate > (such as when a .aspx resource is requested). To summarize, the filter > constructs an HttpURLConnection to the IIS server, transfers the GET or > POST data from the original request to the HttpURLConnection, makes the > connection, grabs the response from IIS and writes it to the > HtpServletResponse stream. Note that this isn't redirection, it's proxying. If you aren't issuing a 3xx response code, it's not redirection. > This redirection works for most content, but for some reason certain > files get delivered to the client with the wrong extension. In > particular, all ".axd" files end up on the client as ".txt" files. What do you mean the wrong extension? The URL should dictate the file's "extension" should the browser choose to download (unless you use a Content-Disposition header, which I suspect you aren't using). > I've > tried setting up a mime-mapping for ".axd" files (as text/javascript) in > my web.xml, but it didn't solve the problem. The only thing this changes is the MIME type used to reply to the client. > Does anyone out there know why the extension gets changed? Maybe I'm > leaving out header information when I forward the request on to IIS? If you mean that the client is interpreting the files as text/plain instead of text/javascript or text/html or whatever, then that's a MIME type problem: your Content-Type header is wrong on the response you send to the client. You should be copying the Content-Type from IIS's response and setting that as the Content-Type for the response you send back to the client. You should set this before you send any of the content. Also note that MSIE ignores Content-Type headers because it thinks it's smarter than you are. - -chris -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkmkEhYACgkQ9CaO5/Lv0PB2NQCeIBpZHtI19Ol6tKcJtEDnzSOH TngAn2SDDbLGu1ttaeHzCU0TBUCWfboo =2QaZ -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org