tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mirko Solic <mirko.so...@arnes.si>
Subject Re: mod_jk codepage in header values
Date Thu, 21 Jan 2010 08:24:25 GMT
Christopher thanks for quick replay.

> > for connecting tomcat with apache i'm using mod_jk connector. But i'm
> > having problem with header values. On apache side headers values are in
> > UTF-8 cp but on tomcat side i have to make conversion from latin-1 cp.
> 
> Hmm.
> 
> HTTP defines header values as ASCII (well, it inherits that from other
> RFCs, but, whatever). If you need to encode non-ASCII data in header
> values, you'll need to do it in such a way that your client understands
> them. Often, URL-encoding (aka %-encoding) is used in these situations.
> 
> > I'm using this code:
> > 
> > for(Enumeration en = request.getHeaderNames(); en.hasMoreElements();){
> >         header = new Header();
> >         headerName = (String) en.nextElement();
> >         header.setHeaderName(headerName);
> >         header.setHeaderValue(new
> > String(request.getHeader(headerName).getBytes("ISO-8859-1")));        
> 
> For most values, this will work. On the other hand, the response already
> knows how to convert a String into ASCII, so you probably don't have to
> do this.
> 
> >         headers.add(header);    
> > 
> >         header = new Header();
> >         header.setHeaderName(headerName);
> >         header.setHeaderValue(request.getHeader(headerName));
> >         headers.add(header);
> > }
> 
> The "Header" class is not part of the Servlet API. What does all of this do?
This is just snap shot of my code. I use Header class to save values, it
is just data holder.


> 
> What information are you passing through the HTTP headers that needs to
> be in a particular encoding? These issues are typically handled using
> the response body coupled with a Content-Type header which specifies a
> character encoding.

I'm from Slovenija, Europe. We are using character that are not defined
in ASCII so we are using UTF-8 cp. 

I will try to explain what is this application about.

This project (web page) is protected with AAI
(http://www.switch.ch/aai/about/). This  Authentication and
Authorization infrastructure is roughly divided on SP (service provider)
and Idp (identity provider). SP is module in apache. So when user try to
get web page that is protected with AAI through apache, SP module checks
if user is alredy logged in. If not SP redirects user to Idp where user
can put his/her username and password. If everything is ok Idp sends
users data in xml to SP. SP puts this data into apache 
environment variables so applications (web pages) can access it.
Here i use mod_jk to get this environment variables in tomcat in HTTP
header. If i print user data on apache side i get values in UTF-8
encoding but if i try this on tomcat i don't get right values i have to
make conversion.

Is it mod_jk responsible for converting UTF-8 environment variable to
ACSII header values or is this conversion made elsewhere? 

mirko



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


Mime
View raw message