For the response your choices are:
1. Set it at the JSP level
2. Set it at the servlet level
3. Set it at the application level (via a Filter)

it all depends on your app, and at what granularity you know the content
type of the responses.  you can configure a filter easily via URL
mappings, which has identical power to the web.xml configuration (that
seems to not handle content types, just charsets).  or if you use ACEGI
for security, they have a more powerful matching engine for filters that
can accept Ant-style matches, or regular expressions.

I would think that often times the granularity of content type vs.
charset would be different.  however, once you get down to the JSP
level, since it's one response, you can set them together.

..mike..

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Joe Dane
Sent: Wednesday, October 03, 2007 9:47 AM
To: General Discussion for the Resin application server
Subject: Re: [Resin-interest] Changing the default page encoding /
characterset for JSP pages

Beats me.  You're right that I was wrong in saying you could put the  
content type in that element, but it seems to me that the encoding  
should work.

So this might be a resin bug.  Encoding issues can be troublesome,  
though, since there're so many places from which it can be set.

I guess another solution might be to write a Filter which sets the  
content-type and encoding on all responses.


On Oct 3, 2007, at 5:20 AM, Keith Fetterman wrote:

> Hi Joe,
>
> Thanks for sending this.  I tried it and it didn't do what I need.  I
> discovered that you can only specify the character set in the
> <page-encoding> tag.  You can't specify the content type.  So I
> specified "UTF-8".  When I look at the response headers sent by Resin,
> the character set is not included.
>
> So far, the only way that I have discovered to communicate to the
> browser the character endcoding is by explicitly setting the content
> type via
>
>   <%@ page contentType="text/html; charset=UTF-8" %>
>
> Using the JSP directive:
>
> <%@ page pageEncoding="UTF-8" %>
>
> and the web.xml tags that you mentioned in your email do not cause  
> resin
> to modify any response headers to include the page encoding or  
> character
> set. I wonder what the purpose of the pageEncoding directives are for.
>
> Or is it that Resin isn't working correctly.
>
> What I need are tags similar to what you specified by will set the
> default content type for all JSP pages in a Web app.
>
> I had also tried the following tags in web.xml:
>
> <locale-encoding-mapping-list>
>    <locale-encoding-mapping>
>      <locale>en_US</locale>
>      <encoding>UTF-8</encoding>
>    </locale-encoding-mapping>
> </locale-encoding-mapping-list>
>
> But they didn't work either.
>
> Joe, any chance you see something that I have missed?
>
> Thanks a lot.
>
> Keith
>
>
>
>
>
>
>
> Joe Dane wrote:
>> you can do this in the deployment descriptor, or presumably in the
>> resin config file as well.  in the deployment descriptor, it'd look
>> something like
>>
>>   <jsp-config>
>>     <jsp-property-group>
>>       <url-pattern>*.jsp</url-pattern>
>>       <page-encoding>text/html; charset=UTF-8</page-encoding>
>>     </jsp-property-group>
>>   </jsp-config>
>>
>> that's from memory, but there's certainly something about this in the
>> JSP2.0 spec.
>>
>> On Oct 2, 2007, at 1:48 PM, Keith Fetterman wrote:
>>
>>> Hi,
>>>
>>> We want to convert the default page encoding for JSP pages to UTF-8.
>>>
>>> Is there a way to change the default page encoding for JSP pages in
>>> the
>>> resin.conf or web.xml files for a Web application?
>>>
>>> We have successfully done this for a specific page if we include the
>>> following directive in the JSP page:
>>>
>>> <%@ page contentType="text/html; charset=UTF-8" %>
>>>
>>> I was wondering if there is a way that can do this in the resin
>>> configuration so we don't have to do it for each JSP page.
>>>
>>> Thanks,
>>>
>>> Keith
>>>
>>>
>>> -- 
>>> -----------------------------------------------------------------
>>> Keith Fetterman                          206-780-5670
>>> Mariner Supply, Inc.                     [EMAIL PROTECTED]
>>> http://www.go2marine.com
>>>
>>>
>>> _______________________________________________
>>> resin-interest mailing list
>>> resin-interest@caucho.com
>>> http://maillist.caucho.com/mailman/listinfo/resin-interest
>>
>
> -- 
> -----------------------------------------------------------------
> Keith Fetterman                          206-780-5670
> Mariner Supply, Inc.                     [EMAIL PROTECTED]
> http://www.go2marine.com
>
>
> _______________________________________________
> resin-interest mailing list
> resin-interest@caucho.com
> http://maillist.caucho.com/mailman/listinfo/resin-interest

-- 

joe





_______________________________________________
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest


_______________________________________________
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest

Reply via email to