tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 36790] - response.setContentType() never forgets "charset"
Date Sun, 25 Sep 2005 03:54:15 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=36790>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=36790


jafshar@vignette.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |




------- Additional Comments From jafshar@vignette.com  2005-09-25 05:54 -------
(In reply to comment #3)
> The spec is very clear that if you are using response.getWriter (e.g. you are 
> using a JSP page), then you get a charset on your content type. 

Okay, let's ignore JSP's for now. Should this servlet respond with

    Content-Type: application/x-foobar;charset=UTF-8

It does on Tomcat 5.0.28 and 5.5, but I don't think it should be 
appending "charset".

The spec says "charset" should only be appended for text media content types.

import javax.servlet.*;
import javax.servlet.http.*;
import java.util.*;

public class HelloWorldServlet extends HttpServlet {
    protected void doGet(HttpServletRequest request, HttpServletResponse 
response) throws ServletException, java.io.IOException {
	response.setContentType("text/html; charset=utf-8");
	response.setContentType("application/x-foobar");
	response.getOutputStream().println(new java.util.Date().toString());
	response.getOutputStream().close();
    }
}



-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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