tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sean Bridges <sbridges....@yahoo.com>
Subject Re: charset encoding bug
Date Tue, 24 Apr 2007 19:59:04 GMT
Thanks for the reply Rashmi.  

I did a little more digging, and it seems this bug
only appears when the locale is set.  My full servlet
code is,

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class ContentType extends HttpServlet {

  protected void doGet(
      HttpServletRequest arg0, 
      HttpServletResponse arg1) 
  throws ServletException, IOException {
    
    arg1.setLocale(arg0.getLocale());
    arg1.setContentType("application/foobar");
    arg1.getOutputStream().
        write(arg1.getContentType().getBytes());
  }
}


In this case the response will be,

application/foobar;charset=ISO-8859-1

This is with a fresh install of tomcat 5.5.23 with no
other webapps or libraries installed.

If I take out the call to setLocale(...) the charset
is not appended to the content type.  

In our webapp, the setLocale(...) method is being
called within Spring's DispatcherServlet.

I think this is a bug, as setLocale(...) should not
modify the content type.

Thanks,

Sean

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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


Mime
View raw message