Comment by anthony....@gmail.com:

The previous comment stay unreplied :) and i'm interested too :)
I tested the same example (but my user id is a String instead of an Integer), so the Key is added to request attributes as : httpRequest.setAttribute(Key.get(String.class, Names.named("username")).toString(), my_username));

Then, in the class requesting the username, i tried to inject the provider as :

public MyUserService(@Named("username") Provider<String> username) {
   this.username = username
}

but when "MyUserService" is injected, i've a exception :

1) No implementation for java.lang.String annotated with @com.google.inject.name.Named(value=username) was bound. while locating com.google.inject.Provider<java.lang.String> annotated with @com.google.inject.name.Named(value=username)

Any ideas ?

For more information:
http://code.google.com/p/google-guice/wiki/ServletModule

--
You received this message because you are subscribed to the Google Groups 
"google-guice-dev" group.
To post to this group, send email to google-guice-dev@googlegroups.com.
To unsubscribe from this group, send email to 
google-guice-dev+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-guice-dev?hl=en.

Reply via email to