You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Nicolas Bouillon <ni...@bouil.org> on 2010/01/30 16:09:05 UTC

[T5] UTF-8 in URL | onActivate(String utf8String)

Hi,

I'm trying to resolve the following issue :

I have a page MyPage that take a string as an activation context.

The URL then looks like http://localhost/mypage/Café

I got the following exception :

java.lang.IllegalArgumentException
Input string 'Café' is not valid; the character 'é' at position 4 is not 
valid.
org.apache.tapestry5.internal.services.URLEncoderImpl.decode(URLEncoderImpl.java:143) 

org.apache.tapestry5.internal.services.ContextPathEncoderImpl.decodePath(ContextPathEncoderImpl.java:86) 


I've tried to ovveride the URLEncoderImpl.java using :
binder.bind(URLEncoder.class, 
MyURLEncoderImpl.class).withId("MyURLEncoderImpl");

but i got another issue, because the URLEncoder is provided by 2 
implementations.... :
Exception constructing service 'ContextPathEncoder': Error invoking 
constructor 
org.apache.tapestry5.internal.services.ContextPathEncoderImpl(ContextValueEncoder, 
URLEncoder, TypeCoercer) (at ContextPathEncoderImpl.java:41) via 
org.apache.tapestry5.services.TapestryModule.bind(ServiceBinder) (at 
TapestryModule.java:251) (for service 'ContextPathEncoder'): Service 
interface org.apache.tapestry5.services.URLEncoder is matched by 2 
services: MyURLEncoderImpl, URLEncoder. Automatic dependency resolution 
requires that exactly one service implement the interface.

Any help will be much appreciated.

Thanks
Nicolas.



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


Re: [T5] UTF-8 in URL | onActivate(String utf8String)

Posted by Nicolas Bouillon <ni...@bouil.org>.
Thiago H. de Paula Figueiredo a écrit :
> This doesn't override a service, just adds another implementation. To 
> actually override a service, you need to contribute to the 
> ServiceOverrides service:
>
> public static void 
> contributeServiceOverride(MappedConfiguration<Class,Object> 
> configuration) {
>     configuration.add(URLEncoder.class, new MyURLEncoder(...));
> }
>

Thank you, it works well !

Nicolas




Re: [T5] UTF-8 in URL | onActivate(String utf8String)

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Sat, 30 Jan 2010 13:09:05 -0200, Nicolas Bouillon <ni...@bouil.org>  
wrote:

> Hi,

Hi!

> I've tried to ovveride the URLEncoderImpl.java using :
> binder.bind(URLEncoder.class,  
> MyURLEncoderImpl.class).withId("MyURLEncoderImpl");

This doesn't override a service, just adds another implementation. To  
actually override a service, you need to contribute to the  
ServiceOverrides service:

public static void  
contributeServiceOverride(MappedConfiguration<Class,Object> configuration)  
{
     configuration.add(URLEncoder.class, new MyURLEncoder(...));
}

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, software architect and developer, Ars Machina Tecnologia da  
Informação Ltda.
http://www.arsmachina.com.br

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