You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Mark Kimmerly <Ma...@nmwco.com> on 2009/02/23 21:00:18 UTC

Request for 'Scriptresource.axd' results in download of 'Scriptresource.txt'

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.

 

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.  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.

 

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?

 

TIA,

Mark Kimmerly


RE: Request for 'Scriptresource.axd' results in download of 'Scriptresource.txt'

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Jordan, Martin [mailto:Martin.Jordan@newsint.co.uk]
> Subject: RE: Request for 'Scriptresource.axd' results in
> download of 'Scriptresource.txt'
>
> We would like to see why certain JSPs stop
> working randomly.

We would like you to not hijack threads.  Start a new thread when posing a new topic; don't reply to an existing message for something completely unrelated.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Request for 'Scriptresource.axd' results in download of 'Scriptresource.txt'

Posted by "Jordan, Martin" <Ma...@newsint.co.uk>.
Yo, does anyone know how to turn on debugging for what JASPER is doing
while TOMCAT is running? We would like to see why certain JSPs stop
working randomly. 


Thanks
Mj.


Martin Jordan.
 
"Please consider the environment before printing this e-mail" 
 
The Newspaper Marketing Agency:  Opening Up Newspapers:
 
www.nmauk.co.uk
 
This e-mail and all attachments are confidential and may be privileged. If you have received this e-mail in error, notify the sender immediately. Do not use, disseminate, store or copy it in any way. Statements or opinions in this e-mail or any attachment are those of the author and are not necessarily agreed or authorised by News International (NI). NI Group may monitor emails sent or received for operational or business reasons as permitted by law. NI Group accepts no liability for viruses introduced by this e-mail or attachments. You should employ virus checking software. News International Limited, 1 Virginia St, London E98 1XY, is the holding company for the News International group and is registered in England No 81701


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Request for 'Scriptresource.axd' results in download of 'Scriptresource.txt'

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----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