tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Chapman" <andrew.chap...@clicktools.com>
Subject RE: tomcat always generates charset in Content-Type http header
Date Tue, 06 May 2003 14:31:06 GMT
The definitive reference for directives are the JSP specifications
http://java.sun.com/products/jsp/download.html#specs

Or there are quick syntax guides:
http://java.sun.com/products/jsp/docs.html

I'm certain that there are excerpts and other references available
elsewhere too.

____________________________________
clicktools 
T: +44 1202 317755
4 Stratfield Saye, 20-22 Wellington Road
Bournemouth, Dorset, BH8 8JN



-----Original Message-----
From: Roberto Nunnari [mailto:nunnari@die.supsi.ch] 
Sent: 06 May 2003 15:10
To: Tomcat Developers List
Subject: Re: tomcat always generates charset in Content-Type http header


I'm new to jsp but have good experience with servlet programming. I have
the Java Servlet Programming book, but it doesn't tell much about the
predefined objects you can use in a jsp page... well... I just checked
:D it talks about the six most frequently used variables: request,
response, out, session, application and pageContext...

What I find is missing in the book are directives.. it only presents the
page directive, but I believe there are others.. Any idea about where I
can get more info on directives?


Andrew Chapman wrote:
> Yes the response is the HttpServletResponse parameter of the doGet/Put

> method.
> 
> Look at the servlet code generated by Tomcat for your JSP and you'll 
> see all the variables that are available in the _jspService() method.
> 
> If you're new to Servlets and JSPs there's a lot of good reference 
> material available including Jason Hunter's book "Java Servlet 
> Programming".
> 
> 
> ____________________________________
> clicktools
> T: +44 1202 317755
> 4 Stratfield Saye, 20-22 Wellington Road
> Bournemouth, Dorset, BH8 8JN
> 
> 
> 
> -----Original Message-----
> From: Roberto Nunnari [mailto:nunnari@die.supsi.ch]
> Sent: 06 May 2003 13:16
> To: Tomcat Developers List
> Subject: Re: tomcat always generates charset in Content-Type http
header
> 
> 
> Thank you very much, Andy.
> 
> Your answer really solved my problem! I just had to remove the ';' 
> character after 'text/xml' as follows
> 
> <%response.setContentType("text/xml");%>
> 
> because the interested client would not tolerate even that!!
> 
> Anyways, is the response object above the generated servlet 
> HttpServletRequest doGet/doPut method paramenter?
> 
> Where can I get a list of the objects names I can use that way in a 
> jsp page?
> 
> Thanks again, Andy.
> 
> Best regards.
> 
> 
> Andrew Chapman wrote:
> 
>>Roberto,
>>
>>Using the response.setContentType() function instead of the <@page
>>contentType...> tag and adding an ";" to the end, like this:
>>
>><%response.setContentType("text/html;");%>
>>
>>results in the following headers on TC 4.1.24:
>>
>>HTTP/1.1 200 OK
>>Content-Type: text/html;
>>Date: Tue, 06 May 2003 11:18:15 GMT
>>Server: Apache Tomcat/4.1 (HTTP/1.1 Connector) 
>>Transfer-Encoding: chunked
>>
>>If your client is tolerant of the ";" on the end of the content-type
>>this should work.
>>
>>Andy
>>
>>
>>____________________________________
>>clicktools
>>T: +44 1202 317755
>>4 Stratfield Saye, 20-22 Wellington Road
>>Bournemouth, Dorset, BH8 8JN
>>
>>
>>
>>-----Original Message-----
>>From: Roberto Nunnari [mailto:nunnari@die.supsi.ch]
>>Sent: 06 May 2003 11:20
>>To: tomcat-dev@jakarta.apache.org
>>Subject: tomcat always generates charset in Content-Type http header
>>
>>
>>Hi there.
>>
>>I'm sorry if you consider this post as noise.. but as I already posted
> 
> 
>>twice to the user list without any useful answer, I decided I'd give a
> 
> 
>>try here.
>>
>>I'm using tomcat 4.1.12 to serve kind of xml pages to an application.
>>I'm using jsp. I use <%@page contentType="text/xml"%> to set the right
> 
> 
>>content type for the client application in the jsp page.
>>
>>The problem is that tomcat automatically sets the charset in the http
>>header with a default value of iso-8859-1 even though I don't specify 
>>a charset in the above page directive.. just as if I had included the 
>>following directive: <%@page contentType="text/xml; 
>>charset=iso-8859-1" %>
>>
>>That's very sensible if the client is a web broser,
>>but the interested client gets very upset with it.. it simply doesn't
>>want to receive the charset header. The error message the client gives
>>is:
>>
>>Content-Type should be "text/xml" and not "text/xml;
>>charset=ISO-8859-1"
>>
>>
>>So.. my problem is not that I want a different encoding.. I know how
>>to do that.. My problem is that I want tomcat -NOT set- the charset in
> 
> 
>>the http header.
>>
>>
>>Can any kind soul help me out with a way to have tomcat not to set the
> 
> 
>>charset header? ..and that should be specific to a web application..
>>letting the other webapplications behave as usual.. the ideal would be
> 
> 
>>by using a directive in the .jsp page..
>>
>>I would also like to know if that behaviour is specified by a standard
> 
> 
>>to which tomcat conforms to... what does the http RFC sais about that?
> 
> 
>>does the protocol requires that the server sets that header in any
>>case?
>>
>>Thanks and best regards.
> 
> 
> 


-- 
               Roberto Nunnari -software engineer-
                 mailto:nunnari@die.supsi.ch
  Scuola Universitaria Professionale della Svizzera Italiana
            Dipartimento di Informatica e Elettronica
                   http://www.die.supsi.ch
  SUPSI-DIE
  Via Cantonale                        tel: +41-91-6108561
  6928 Manno                 """       fax: +41-91-6108570
  Switzerland               (o o)
=======================oOO==(_)==OOo========================


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


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


Mime
View raw message