Re: problems with mod_jk modifying headers
I saw your first post and was interested. I am running a very similar system with no problems (I take that back: there are problems, but not this problem). Q1. Is there something in your apache config file(s) to do with mimetypes that is messing things up? Q2. Are you working with strange charsets? Tomcat likes to add the charset=... parameter to the Content-Type header. This doesn't seem to bother IE7... I know this, from experience. (sigh.) IE7 always know better than you do how you want a document displayed. If you choose to serve an example HTML source in a tutorial on HTML as text/plain so that the user can see the source, IE7 (and IE6) ignores the mimetype in the HTTP header that you carefully put there and displays something else just to spite you. Richard On Mon, 2007-07-02 at 16:09 +0200, Anton Melser wrote: (maybe a repost?) Hi all, We are running tomcat 5.5.23 on java 1.6.0 (suse 10.0 with addon java6 rpms for suse 10.1). These machines are load balanced behind an apache 2.2.2 with mod_jk jakarta-tomcat-connectors-1.2.15 (both compiled from sources). We have a page that is showing the html source instead of the page on firefox2. The funny thing is that when the page is accessed directly then the content type is text/html (and the page shows correctly) but when coming through mod_jk, it is coming as text/plain (and showing the source). This doesn't seem to bother IE7... Does anyone have any ideas? Cheers - 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]
Re: using mod_jk: how to set content-type
Yes, I understood Johnny's point about other uses for a filter even though it was somewhat off-topic. He is quite right about what I am trying to do. I've looked at it and can write a filter and get this going to solve my particular problem. I can't yet see how to write a reasonably powerful generic filter that would be configurable and applicable in a wide range of situations. I'm sure it would be useful. R On Thu, 2007-06-21 at 20:34 +0200, Johnny Kewl wrote: I'm agreeing with you, but just wondering why Richard wants to take a 3rd party servlet that is clearly pumping out html, and make it look like XML and then concluding that it will probably be badly formed XML (or XHTML)... because HTML is close, but not XML. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
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]
Re: using mod_jk: how to set content-type
Thanks for the quick reply, Rainer. Yes a servlet filter makes sense, though not as easy as a one-liner httpd directive. I guess my immediate response is surprise that (since this must be a common problem with so many poorly written web-clients doing content-negotiation so badly out in the big-wide-web) that there aren't any stock servlet filters already written that I can use out of the box. Does anyone know of any? I will try the experiment of writing a servlet filter (it will do me good to learn all this, and I can imagine other useful things I might do) and if I get something that might be useful for others I will let you know. Richard On Thu, 2007-06-21 at 17:14 +0200, Rainer Jung wrote: I had a similar problem with mod_prox and mod_headers for Apache httpd 2.2 today, and I would expect, that changing the headers with mod_header does not work. I see no easy way (but maybe others out there). You could hack ajp_unmarshal_response() in common/jk_ajp_common.c. Alternative: experiment with a servlet filter for Tomcat. You can always add filters to webapps without changing or even having the webapp code itself. Regards, Rainer Richard Kaye wrote: 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]
Re: Tomcat Server CPU utilization goes upto 400%
I think I have one if you'd like it... Only problem is, it doesn't work :( AFAIK 400% of zero is still zero :D R On Thu, 2007-06-14 at 21:14 +0200, Filip Hanik - Dev Lists wrote: man, I need to get a CPU like that, that can actually work 4 times its max capacity :) Filip - 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]
Re: APR installation Question
Hi I also get The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: I'm using tomcat 5.5 installed from debian debs, and I think I understand the instructions I have read so far and have all the prerequisites to compile the necessary libraries, but I have not got past stage 1 yet. The docs at http://tomcat.apache.org/tomcat-5.5-doc/apr.html tells me to look for tomcat-native.tar.gz which I have done. The result is I don't have this file or anything remotely similar, nor is it provided in any of the debs I think. So I can't unpack it and compile it. What should I do now? Richard On Fri, 2007-06-15 at 13:52 +0300, Ilja S. wrote: Hi Your tomcat should start with option: -Djava.library.path=/usr/local/apr/lib in this case APR libs are in /usr/local/apr/lib, change to wherever you got your libs Usually you add this line to tomcat startup script... * Best Regards Ilja Andre Prasetya wrote: I got this : The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: I already compiled the tcnative, where can i add the path to java.library.path ? - 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]
Re: APR installation Question
Thanks. That worked. Funnily enough despite my care in getting the version right (5.5.20) tomcat carped that the new library was the wrong version. I don't know. ] INFO: An older version 1.1.3 of the Apache Tomcat Native library is ] installed, while Tomcat recommends version greater than 1.1.4 R On Fri, 2007-06-15 at 15:37 +0300, Ilja S. wrote: Hi Well I can suggest you to download the same version of tomcat you have installed from the apache.org and just copy this file from downloaded archive.. * Best Regards Ilja Richard Kaye wrote: Hi I also get The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: I'm using tomcat 5.5 installed from debian debs, and I think I understand the instructions I have read so far and have all the prerequisites to compile the necessary libraries, but I have not got past stage 1 yet. The docs at http://tomcat.apache.org/tomcat-5.5-doc/apr.html tells me to look for tomcat-native.tar.gz which I have done. The result is I don't have this file or anything remotely similar, nor is it provided in any of the debs I think. So I can't unpack it and compile it. What should I do now? Richard On Fri, 2007-06-15 at 13:52 +0300, Ilja S. wrote: Hi Your tomcat should start with option: -Djava.library.path=/usr/local/apr/lib in this case APR libs are in /usr/local/apr/lib, change to wherever you got your libs Usually you add this line to tomcat startup script... * Best Regards Ilja Andre Prasetya wrote: I got this : The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: I already compiled the tcnative, where can i add the path to java.library.path ? - 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] - 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]
Re: Problem with XSL stylesheet not being applied when XML served through Tomcat
Interesting, and I don't know the answer. Doesn't sound like it's an issue with the mimetype of the main document. One small point is that you load your stylesheet with ?xml-stylesheet type=text/xsl href=... ? but the server provides it as application/xml. AFAIK text/xsl was never registered and so you might try text/xml or application/xml instead. If this doesn't work you could even try application/xslt+xml, or try tinkering with the mimetype of the stylesheet as served up by your Apache/1.3.33 that serves the XSL. But I don't see why it should work in one case and not in the other. (But that is what I get when I try it in epiphany.) Richard On Tue, 2007-06-12 at 16:43 -0700, Garey wrote: Here are two URLs http://library11.berkeley.edu/~gmills/binds_result.xml http://library11.berkeley.edu/%7Egmills/binds_result.xml http://library11.berkeley.edu:8080/...inds_result.xml http://library11.berkeley.edu:8080/noidbind/binds_result.xml In Firefox 2, the first URL results in the XSL stylesheet referenced in the XML document being applied correctly. The second URL does not. The difference is that the first URL is being served by Apache httpd 1.3.X, and the second by Tomcat 6.0. This document was generated dynamically by the app at noidbind. When I generate the document, I set the mimetype of the document to 'text/xml' and that also fails to work. All of these work in IE. Can anyone tell me what I have to do to fix this, and get the stylesheet applied when the document is served by Tomcat? Thanks; Garey Mills - 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]
Re: content-type without charset
Thank you! I was using a writer and switching to a ServletOutputStream fixed it. I never thought of that: the specs say streams are intended for binary data... Richard Richard Kaye wrote: Please could someone help me by posting a Hello-world servlet that serves a document with this Content-Type header? I have tried all the obvious things with no success... Are you using a writer? If so, try using the stream instead. Mark - 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]
Re: content-type without charset
Incidently, the fact that tomcat seems to remove any space between the ; and charset in mimetype; charset=... whereas apache seems to prefer to add one is an annoying inconsistency that has blocked a much simpler workaround for my difficulties (one that would have used text/xml). No matter. My next step is to link in the velocity engine. Funnily enough, this requires a Writer object, whereas I now have a ServletOutputStream. I guess I will have to use the constructor in java.io.OutputStreamWriter since I cannot use the more direct getWriter() method! Ironic isn't it? Apart from the fact I have to specify the charset carefully, can you foresee any possible problems? Thanks for all the help, it's very much appreciated. Richard Richard Kaye wrote: Thank you! I was using a writer and switching to a ServletOutputStream fixed it. I never thought of that: the specs say streams are intended for binary data... They do. They also say if you use a writer Tomcat must append a charset to the Content-Type header. Glad this works now. Mark - 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]
content-type without charset
Hi I have been tearing my hair out recently with an annoying problem. I want to serve XHTML+MathML documents from a servlet. The problem is that it seems that these can only be viewed with IE and the plugin (MathPlayer) if the server sends Content-Type: application/xhtml+xml in the HTTP header without specifying a charset. Every possible charset screws things up because of - I presume - the mime type recogniser built in to IE is not triggering the MathPlayer filter correctly when a charset is present in the Content-Type header. Unfortunately I have not found a way to stop Tomcat in adding some unwanted default charset (I am using Tomcat 5.5), and unless Microsoft decide to make IE open source in the very near future this seems to be my only chance of a workaround. Please could someone help me by posting a Hello-world servlet that serves a document with this Content-Type header? I have tried all the obvious things with no success... 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]