On Sun, 2007-06-17 at 23:24 +0200, Martin Grotzke wrote:
> I just stepped through the sources to see where the URI get's
> decoded to the activation context arguments, and found that the
> o.a.t.internal.services.PageRenderDispatcher.dispatch invokes
> convertActivationContext with the path info to convert it to
> the activation context args.
> 
> convertActivationContext uses TapestryInternalUtils.urlDecode
> which invokes URLCodec.decode. It seems that this causes the
> problem, but I cannot say what exactly is the reason.
> 
> When I remove the invocation of TapestryInternalUtils.urlDecode
> everything's fine...
Just to provide more info:
TapestryInternalUtils.urlDecode is invoked with the already decoded
context parameter, e.g. "trüb" for the urlencoded string "tr%C3%BCb".

This parameter is read from request.getServletPath(), which is already
/search/trüb. So it tries to decode the already decoded string, which
then fails.

What is the problem here? Is it that request.getServletPath() provides
the already decoded string, or is the problem that the decoding is done
additionally by T5? Or what else?

Thanx && cheers,
Martin


> 
> Any help with this issue?
> 
> Thanx && cheers,
> Martin
> 
> 
> On Sun, 2007-06-17 at 23:01 +0200, Martin Grotzke wrote:
> > On Tue, 2007-06-12 at 10:38 +0200, Ulrich Stärk wrote:
> > > In case you are using Tomcat try adding URIEncoding="UTF-8" to your
> > > connector definition in server.xml.
> > I just tried that, but it does not solve the problem.
> > 
> > I have added a servlet filter that prints the requested uri to
> > the std out, just to see what is the input for T5.
> > 
> > The URIEncoding="UTF-8" does not change what's printed by the
> > filter, but the argument that's passed to my page class' onActivate
> > is different.
> > 
> > Without URIEncoding="UTF-8":
> > 
> > [INFO ] 2007-06-17 22:52:37,956 http-8080-1 
> > org.comp.proj.presentation.util.EncodingFilter.doFilter:
> > - uri: /shopping24-shop/search/tr%C3%BCb
> > - path: null
> > 
> > [INFO ] 2007-06-17 22:52:51,303 http-8080-1 
> > org.comp.proj.presentation.pages.Search.onActivate:
> > Got invoked args tr??b
> > 
> > With URIEncoding="UTF-8":
> > 
> > [INFO ] 2007-06-17 22:54:33,398 http-8080-1 
> > org.comp.proj.presentation.util.EncodingFilter.doFilter:
> > uri: /shopping24-shop/search/tr%C3%BCb
> > 
> > [INFO ] 2007-06-17 22:54:44,620 http-8080-1 
> > org.comp.proj.presentation.pages.Search.onActivate:
> > Got invoked args tr?b
> > 
> > 
> > Is there anything else that I could do to get the correct
> > decoding of the request parameters / uri?
> > 
> > Thanx && cheers,
> > Martin
> > 
> > 
> > 
> > > 
> > > Uli
> > > 
> > > On Mo, 11.06.2007, 23:13, Martin Grotzke sagte:
> > > > Hi,
> > > >
> > > > I have currently an encoding issue, but am not really sure what's
> > > > the reason for this.
> > > >
> > > > I have an url that contains a url encoded german umlaut (ü) in UTF-8
> > > > and looks like the following:
> > > >
> > > > http://localhost:8080/app/search/%C3%BCbel (the %C3%BC represents the ü
> > > > in UTF-8, this url is created by
> > > > componentResources.createPageLink( "search", new Object[]{ _query } )
> > > > in the submit method of the search page)
> > > >
> > > > Now, when I look in the onActivate(string) method, the string is not
> > > > "übel" but it's "?bel", both printed via logging as when I inspect the
> > > > variable during debugging.
> > > >
> > > > AFAICS the created url from the page link is correct in terms of utf-8
> > > > encoding, but the parsed query string seems to be wrong, as it contains
> > > > only the "?"...
> > > >
> > > > We have the following in our AppModule:
> > > >
> > > >     public void contributeRequestHandler(
> > > >             OrderedConfiguration<RequestFilter> configuration,
> > > >             @InjectService("TimingFilter")
> > > >             final RequestFilter filter, @InjectService("Utf8Filter")
> > > >             final RequestFilter utf8Filter ) {
> > > >         configuration.add( "Timing", filter );
> > > >         configuration.add( "Utf8Filter", utf8Filter ); // handle UTF-8
> > > >     }
> > > >
> > > >     public RequestFilter buildUtf8Filter(
> > > >             @InjectService("RequestGlobals")
> > > >             final RequestGlobals requestGlobals ) {
> > > >         return new RequestFilter() {
> > > >             public boolean service( Request request, Response response,
> > > > RequestHandler handler ) throws IOException {
> > > >                 
> > > > requestGlobals.getHTTPServletRequest().setCharacterEncoding(
> > > > "UTF-8" );
> > > >                 return handler.service( request, response );
> > > >             }
> > > >         };
> > > >     }
> > > >
> > > >     public static PageResponseRenderer decoratePageResponseRenderer(
> > > >             @InjectService("PageMarkupRenderer")
> > > >             final PageMarkupRenderer markupRenderer,
> > > >             @InjectService("MarkupWriterFactory")
> > > >             final MarkupWriterFactory markupWriterFactory, final Object
> > > > delegate ) {
> > > >
> > > >         return new PageResponseRenderer() {
> > > >             public void renderPageResponse( Page page, Response 
> > > > response )
> > > >                     throws IOException {
> > > >                 MarkupWriter writer =
> > > > markupWriterFactory.newMarkupWriter();
> > > >                 markupRenderer.renderPageMarkup( page, writer );
> > > >                 PrintWriter pw = response
> > > >                         .getPrintWriter( "text/html; charset=UTF-8" );
> > > >                 writer.toMarkup( pw );
> > > >                 pw.flush();
> > > >             }
> > > >         };
> > > >     }
> > > >
> > > > Is there anything wrong, or what am I missing?
> > > >
> > > > Thanx && cheers,
> > > > Martin
> > > >
> > > >
> > > >
> > > 
> > > 
> > > 
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > 
-- 
Martin Grotzke
http://www.javakaffee.de/blog/

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to