Re: T5 Encoding issue (repost)

2008-01-28 Thread Martin Grotzke
On Mon, 2008-01-28 at 18:54 +0100, Francois Armand wrote:
> I spoke to fast : it seems that in T5.0.9, even "slashes" are handled 
> correctly with utf-8 filter activated.
This would be really great - then we should take the effort and upgrade...

Good luck to you,
cheers,
Martin


On Mon, 2008-01-28 at 18:54 +0100, Francois Armand wrote:
> Francois Armand wrote:
> >> Are you sure this issue is solved in the latest version of T5? So that
> >> you can even have slashes in your activation parameters?
> >>   
> > Well, you are right : slashes are not supported. But spaces, "+", 
> > accented  letters are well encoded/decoded
> >
> 
> I spoke to fast : it seems that in T5.0.9, even "slashes" are handled 
> correctly with utf-8 filter activated.
> 
> My test (I hope it's relevant) :
> * I create a page link with a context comporting all these nasty chars, 
> and a click to it write the good output.
> * I wrote directly in the URL all these char but /, the output is what 
> expected.
> 
> All in all,  I can't  switch to this version, there is far too others 
> behavior modification between the two :/
> 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: T5 Encoding issue (repost)

2008-01-28 Thread Francois Armand

Francois Armand wrote:

Are you sure this issue is solved in the latest version of T5? So that
you can even have slashes in your activation parameters?
  
Well, you are right : slashes are not supported. But spaces, "+", 
accented  letters are well encoded/decoded




I spoke to fast : it seems that in T5.0.9, even "slashes" are handled 
correctly with utf-8 filter activated.


My test (I hope it's relevant) :
* I create a page link with a context comporting all these nasty chars, 
and a click to it write the good output.
* I wrote directly in the URL all these char but /, the output is what 
expected.


All in all,  I can't  switch to this version, there is far too others 
behavior modification between the two :/


--
Francois Armand
Etudes & Développements J2EE
Groupe Linagora - http://www.linagora.com
Tél.: +33 (0)1 58 18 68 28
---
InterLDAP - http://interldap.org 
FederID - http://www.federid.org/

Open Source identities management and federation


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: T5 Encoding issue (repost)

2008-01-28 Thread Francois Armand

Martin Grotzke wrote:

Hi Francois,

we're currently living with a really ugly hack: we use a patched version
of TapestryInternalUtils, with the methods urlEncode and urlDecode
changed [1].
  
Ho. Well, I tested almost everything I thought to, and the last item is 
"patch Tapestry 5.0.6". I really don't like that, but I have to have it 
work this evening... So...

For us this is still an issue we want to investigate, I believe this is
an issue in combination with mod_jk. But my memory is really bad, so I
will have to start again investigating.
  

I don't use mod_jk, and I don't really understand where it comes from.

Are you sure this issue is solved in the latest version of T5? So that
you can even have slashes in your activation parameters?
  
Well, you are right : slashes are not supported. But spaces, "+", 
accented  letters are well encoded/decoded


--
Francois Armand
Etudes & Développements J2EE
Groupe Linagora - http://www.linagora.com
Tél.: +33 (0)1 58 18 68 28
---
InterLDAP - http://interldap.org 
FederID - http://www.federid.org/

Open Source identities management and federation


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: T5 Encoding issue (repost)

2008-01-28 Thread Martin Grotzke
Hi Francois,

we're currently living with a really ugly hack: we use a patched version
of TapestryInternalUtils, with the methods urlEncode and urlDecode
changed [1].

For us this is still an issue we want to investigate, I believe this is
an issue in combination with mod_jk. But my memory is really bad, so I
will have to start again investigating.

Are you sure this issue is solved in the latest version of T5? So that
you can even have slashes in your activation parameters?

Cheers,
Martin


[1] 

private static final String SLASH_REPLACEMENT_CHAR = "" + 127;
private static final String SLASH_REPLACEMENT_CHAR_ENC =
UrlUtf8Encoder.encode(SLASH_REPLACEMENT_CHAR);

public static String urlEncode(String input) {
try {
String res = CODEC.encode(url);
if (StringUtils.isNotEmpty(res)) {
res = res.replace("+", "%20");
res = res.replace("%2F", SLASH_REPLACEMENT_CHAR_ENC);
}
return res;
} catch (EncoderException e) {
LOG.error("Could not encode URL: "+ url, e);
return url;
}
}

public static String urlDecode(String input) {
// only decode slashes
String decoded = input.replace(SLASH_REPLACEMENT_CHAR, "/");
return decoded;
}




On Mon, 2008-01-28 at 17:19 +0100, Francois Armand wrote:
> Martin Grotzke wrote:
> > Hi,
> >   
> 
> Hi Martin,
> 
> > I just want to pickup this topic in a new thread, to make sure
> > it's noticed - thx to Uli's suggestion in the previous thread :)
> >
> > At first a short summary again:
> > - T5 (the PageRenderDispatcher) tries to decode activation context
> >   arguments (in convertActivationContext).
> > [...]
> > Our encoding is UTF-8 btw.
> >
> > My question is: why does PageRenderDispatcher.convertActivationContext
> > try to decode the already decoded string again? I asume there's *some*
> > reason for this ;)
> >   
> Sorry to resurrect this old post, but I encounter the very same bug. I 
> know it is corrected in recent version of T5 (after 5.0.8, I believe) 
> but for now, I'm stuck with 5.0.6.
> 
> So, to bypass it, I contribute to master dispatcher a 
> PageRenderDispatcher without the double decoding, but now it seems to be 
> worst :
> - it almost work but  sometimes (I think it's when I call 
> ComponentResources#createPageLink or similar methods), spaces are 
> encoded with "+", but the "+" are not decoded. So, returned link are not 
> understood by Tapestry, but if a replace "+" by "%20" or " ", everything 
> works.
> - changing the order of utf8filter (with "after:*" or "before:*" in 
> configuration) doesn't seem to do anything
> 
> 
> I believe I forgot to switch a configuration to UTF-8,  somewhere.  But 
> I don't know where :/
> 
> So, Martin, have you find a way to have it to work ? Have you any idea ?
> 
> It's a really important bug for us :/
> 
> Thanks,
> 
-- 
Martin Grotzke
http://www.javakaffee.de/blog/


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: T5 Encoding issue (repost)

2008-01-28 Thread Francois Armand

Martin Grotzke wrote:

Hi,
  


Hi Martin,


I just want to pickup this topic in a new thread, to make sure
it's noticed - thx to Uli's suggestion in the previous thread :)

At first a short summary again:
- T5 (the PageRenderDispatcher) tries to decode activation context
  arguments (in convertActivationContext).
[...]
Our encoding is UTF-8 btw.

My question is: why does PageRenderDispatcher.convertActivationContext
try to decode the already decoded string again? I asume there's *some*
reason for this ;)
  
Sorry to resurrect this old post, but I encounter the very same bug. I 
know it is corrected in recent version of T5 (after 5.0.8, I believe) 
but for now, I'm stuck with 5.0.6.


So, to bypass it, I contribute to master dispatcher a 
PageRenderDispatcher without the double decoding, but now it seems to be 
worst :
- it almost work but  sometimes (I think it's when I call 
ComponentResources#createPageLink or similar methods), spaces are 
encoded with "+", but the "+" are not decoded. So, returned link are not 
understood by Tapestry, but if a replace "+" by "%20" or " ", everything 
works.
- changing the order of utf8filter (with "after:*" or "before:*" in 
configuration) doesn't seem to do anything



I believe I forgot to switch a configuration to UTF-8,  somewhere.  But 
I don't know where :/


So, Martin, have you find a way to have it to work ? Have you any idea ?

It's a really important bug for us :/

Thanks,

--
Francois Armand
Etudes & Développements J2EE
Groupe Linagora - http://www.linagora.com
Tél.: +33 (0)1 58 18 68 28
---
InterLDAP - http://interldap.org 
FederID - http://www.federid.org/

Open Source identities management and federation


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



T5 Encoding issue (repost)

2007-06-21 Thread Martin Grotzke
Hi,

I just want to pickup this topic in a new thread, to make sure
it's noticed - thx to Uli's suggestion in the previous thread :)

At first a short summary again:
- T5 (the PageRenderDispatcher) tries to decode activation context
  arguments (in convertActivationContext).
- The activation context arguments are read from request.getPath()
  (httpServletRequest.getServletPath()).
- The httpServletRequest.getServletPath() provides the _decoded_
  part of the url, according to the servlet specification [1].
  E.g., getServletPath() may return special characters like e.g.
  german umlauts, so the url encoded "%C3%BCbel" would be returned
  as "übel".
- When PageRenderDispatcher.convertActivationContext tries to decode
  the already decoded string (by invoking
  TapestryInternalUtils.urlDecode which itself invokes commons
  URLCodec.decode) and either fails with a
  "org.apache.commons.codec.DecoderException: Invalid URL encoding"
  (e.g. for "tr%b" or returns the wrong value (e.g. "?bel" for "übel").

Our encoding is UTF-8 btw.

My question is: why does PageRenderDispatcher.convertActivationContext
try to decode the already decoded string again? I asume there's *some*
reason for this ;)

Otherwise I'd like to submit an issue with a patch for this.

Thanx && cheers,
Martin


[1] An excerpt from the servlet spec 2.4 p. 243:

getServletPath()
[...]
Returns: a String containing the name or path of the servlet being
called,
as specified in the request URL, decoded, or an empty string if the
servlet
used to process the request is matched using the “/*” pattern.




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


Re: T5 encoding issue

2007-06-21 Thread Ulrich Stärk
I think you should re-post this issue as another topic so that people notice it. At least in my mail 
client, this topic is some way down now :)


Uli

Martin Grotzke schrieb:

On Wed, 2007-06-20 at 22:02 +0200, Martin Grotzke wrote:

Hi,

this is an urgent and important issue for us. Can anybody help
with this? Howard?

As I wrote below: request.getServletPath() (or request.getPath())
already provides the decoded path.
a) Should request.getPath() provide the encoded path, or
b) should the additional decoding (in
   PageRenderDispatcher.convertActivationContext) be skipped?


An excerpt from the servlet spec 2.4 p. 243:

getServletPath()
[...]
Returns: a String containing the name or path of the servlet being called,
as specified in the request URL, decoded, or an empty string if the servlet
used to process the request is matched using the “/*” pattern.

So why is additional decoding done?

Cheers,
Martin



Is anything else the problem? E.g. might the problem be caused
by commons URLCodec?

Thanx in advance,
cheers,
Martin


On Mon, 2007-06-18 at 12:20 +0200, Martin Grotzke wrote:

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 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,
Requ

Re: T5 encoding issue

2007-06-20 Thread Martin Grotzke
On Wed, 2007-06-20 at 22:02 +0200, Martin Grotzke wrote:
> Hi,
> 
> this is an urgent and important issue for us. Can anybody help
> with this? Howard?
> 
> As I wrote below: request.getServletPath() (or request.getPath())
> already provides the decoded path.
> a) Should request.getPath() provide the encoded path, or
> b) should the additional decoding (in
>PageRenderDispatcher.convertActivationContext) be skipped?

An excerpt from the servlet spec 2.4 p. 243:

getServletPath()
[...]
Returns: a String containing the name or path of the servlet being called,
as specified in the request URL, decoded, or an empty string if the servlet
used to process the request is matched using the “/*” pattern.

So why is additional decoding done?

Cheers,
Martin


> 
> Is anything else the problem? E.g. might the problem be caused
> by commons URLCodec?
> 
> Thanx in advance,
> cheers,
> Martin
> 
> 
> On Mon, 2007-06-18 at 12:20 +0200, Martin Grotzke wrote:
> > 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

Re: T5 encoding issue

2007-06-20 Thread Martin Grotzke
Hi,

this is an urgent and important issue for us. Can anybody help
with this? Howard?

As I wrote below: request.getServletPath() (or request.getPath())
already provides the decoded path.
a) Should request.getPath() provide the encoded path, or
b) should the additional decoding (in
   PageRenderDispatcher.convertActivationContext) be skipped?

Is anything else the problem? E.g. might the problem be caused
by commons URLCodec?

Thanx in advance,
cheers,
Martin


On Mon, 2007-06-18 at 12:20 +0200, Martin Grotzke wrote:
> 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 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("RequestG

Re: T5 encoding issue

2007-06-18 Thread Martin Grotzke
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 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 MarkupWr

Re: T5 encoding issue

2007-06-17 Thread Martin Grotzke
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...

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 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
> > >
> > >
> > >
> > 
> > 
> > 
> > ---

Re: T5 encoding issue

2007-06-17 Thread Martin Grotzke
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 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/


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


Re: T5 encoding issue

2007-06-12 Thread Ulrich Stärk
In case you are using Tomcat try adding URIEncoding="UTF-8" to your
connector definition in server.xml.

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 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]



T5 encoding issue

2007-06-11 Thread Martin Grotzke
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 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




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