Return-Path: Delivered-To: apmail-tomcat-users-archive@www.apache.org Received: (qmail 85265 invoked from network); 24 Feb 2009 15:29:10 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 24 Feb 2009 15:29:10 -0000 Received: (qmail 33501 invoked by uid 500); 24 Feb 2009 15:28:59 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 33221 invoked by uid 500); 24 Feb 2009 15:28:58 -0000 Mailing-List: contact users-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Users List" Delivered-To: mailing list users@tomcat.apache.org Received: (qmail 33210 invoked by uid 99); 24 Feb 2009 15:28:58 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 24 Feb 2009 07:28:58 -0800 X-ASF-Spam-Status: No, hits=1.2 required=10.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [76.96.62.96] (HELO QMTA09.westchester.pa.mail.comcast.net) (76.96.62.96) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 24 Feb 2009 15:28:48 +0000 Received: from OMTA03.westchester.pa.mail.comcast.net ([76.96.62.27]) by QMTA09.westchester.pa.mail.comcast.net with comcast id Knvy1b0060bG4ec59rUTxG; Tue, 24 Feb 2009 15:28:27 +0000 Received: from [192.168.1.101] ([69.143.128.194]) by OMTA03.westchester.pa.mail.comcast.net with comcast id KrUS1b00i4BnRt93PrUTe4; Tue, 24 Feb 2009 15:28:27 +0000 Message-ID: <49A41217.8020806@christopherschultz.net> Date: Tue, 24 Feb 2009 10:28:23 -0500 From: Christopher Schultz User-Agent: Thunderbird 2.0.0.19 (Windows/20081209) MIME-Version: 1.0 To: Tomcat Users List Subject: Re: Request for 'Scriptresource.axd' results in download of 'Scriptresource.txt' References: <68B9548ED9F8A341B21CDB320655D6130673407B@mercury.nmwco.com> In-Reply-To: <68B9548ED9F8A341B21CDB320655D6130673407B@mercury.nmwco.com> X-Enigmail-Version: 0.95.7 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Virus-Checked: Checked by ClamAV on apache.org -----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-unsubscribe@tomcat.apache.org For additional commands, e-mail: users-help@tomcat.apache.org