You know I just had another thought.... yes it happens sometimes.
I have a feeling you doing html parsing, and just wanted to say that it depends very much on how well that 3rd party servlet does XHTML... probably badly ie little <br> all over the place which will make the XML parser you using throw it out.

If you use a filter.... you can even fix that, ie make sure its perfect XML.


----- Original Message ----- From: "Richard Kaye" <[EMAIL PROTECTED]>
To: "Tomcat Users List" <users@tomcat.apache.org>
Sent: Thursday, June 21, 2007 5:04 PM
Subject: using mod_jk: how to set content-type


Hi

I am using Tomcat5.5, Apache2.2 and mod_jk1.2
and a third-part servlet which I can't re-program or
configure.

I need to sniff the HTTP "User-Agent" and/or "Accept"
fields and change the content-type
(currently "text/html;charset=UTF-8") that the
servlet returns based on these.

using mod_headers and mod_setenvif, I currently
have (in my apache2 config) something like:

   SetEnvIf User-Agent Whatever DETECTED1
   SetEnvIf Accept Somethingelse DETECTED2
   JkMount /servletname/* ajp13_worker
   <LocationMatch /servletname/* >
       Header set Content-Type "text/xml" env=DETECTED1
       Header set Content-Type "application/xml" env=DETECTED2
   </LocationMatch>

Unfortunately, it doesn't work. Specifically, I always get the
document served as "Content-Type: text/html;charset=UTF-8"
and not "Content-Type: text/xml" as expected. From googling a bit
I have learnt that the mod_headers module won't set the Content-Type
header, because this one is set internally by apache at a later stage.
But I couldn't find a workaround or alternative that does what I want.

Help please!

And many thanks...

Richard


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to