cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bruno Dumon <br...@outerthought.org>
Subject Re: strange ...
Date Tue, 09 Sep 2003 13:19:17 GMT
On Tue, 2003-09-09 at 15:09, Leszek Gawron wrote:
> On Tue, Sep 09, 2003 at 02:35:10PM +0200, Bruno Dumon wrote:
> I think this couldn't work as the Cocoon FOM when 
> cocoon.request.getParameter( "test" ) is issued does 
> request.getParameter( "test" );
> 
> while the xsp-request logicsheet performs encoding translation:
> 
>     public static String getParameter(Map objectModel, String name,
>                                       String defaultValue, String form_encoding,
>                                       String container_encoding) {
>         if(container_encoding == null)
>             container_encoding = "ISO-8859-1"; // default per Servlet spec
> 
>         Request request = ObjectModelHelper.getRequest(objectModel);
>         String value = request.getParameter(name);
>         if(form_encoding != null && value != null && value.length() >
0) {
>             try {
>                 value = new String(value.getBytes(container_encoding), form_encoding);
>             } catch(java.io.UnsupportedEncodingException uee) {
>                 throw new CascadingRuntimeException("Unsupported Encoding Exception",
uee);
>            }
>         }
> 
>         if (value == null) {
>             value = defaultValue;
>         }
> 
>         return value;
>     }

This translation is also part of the Cocoon Http Request object wrapper,
and will be activated if you either set the relevant parameters in the
web.xml or use the SetCharacterEncodingAction

there's some information about this here:
http://wiki.cocoondev.org/Wiki.jsp?page=RequestParameterEncoding

-- 
Bruno Dumon                             http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
bruno@outerthought.org                          bruno@apache.org


Mime
View raw message