Re: How to inject selected injection points

2009-09-08 Thread Alen Vrecko

Why would you want to do that?

I guess you can create a simple partial inject utility that only
injects the InjectionPoints marked with e.g. @Partial annotation or
something like that.

Cheers,
Alen

On Sep 8, 5:03 am, Peter Niederwieser pnied...@gmail.com wrote:
 I'm looking for something similar to Injector.injectMembers() that
 allows me to inject only a subset of the available InjectionPointS. Is
 there a way to achieve this?

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



Re: Injecting inside a Map

2009-08-27 Thread Alen Vrecko

Try multibindings http://code.google.com/p/google-guice/wiki/Multibindings

Cheers
Alen

On 27 avg., 20:59, Pablo Fernandez fernandezpabl...@gmail.com wrote:
 I'll give the issue some context just in case...

 I'm developing a (very) simple ActionDispatcher. It's a sevlet that
 has a service which returns a given Action (like Struts) based on
 the URL matching a regular expression.

 The map is in fact like this MapRegularExpression, Action

 so I do something like this

 for each Entry
   if Entry.Key matches givenUrl return Entry.Value
 end

 That map (that I call actionMap) should be injected in my
 dispatcher but I want the actions inside the map (the values)
 injected as well (they have some services and stuff).

 Do you know how to achieve this?
 On Aug 27, 11:10 am, Pablo Fernandez fernandezpabl...@gmail.com
 wrote:



  Hi,

  I've got this MapK,V with arbitrary keys, and some objects as
  values.

  I want the map injected into another object, but I want the objects
  inside the Map to be injected as well.

  Any ideas how to achieve this? do I have to create a provider and
  manually call the injector for every map value?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
google-guice group.
To post to this group, send email to google-guice@googlegroups.com
To unsubscribe from this group, send email to 
google-guice+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-guice?hl=en
-~--~~~~--~~--~--~---



Re: MVP injection best practices

2009-08-18 Thread Alen Vrecko

I've looked at it some weeks ago. It would be nice if you added some
tests for your example. I am wondering why do you have an interface
for the presenter and not just a concrete class?

Cheers,
Alen

On Aug 18, 6:06 am, Eduardo Nunes esnu...@gmail.com wrote:
 I would recommend both of you take a look 
 inhttp://gwt-mvp-sample.googlecode.com
 It's an implementation and sample application using the MVP pattern.
 I'm working on a new version and I will publish it as soon as
 possible.

 Best regards,
 Eduardo S. Nunes



 On Mon, Aug 17, 2009 at 5:23 PM, Alen Vreckoalen_vre...@yahoo.com wrote:

  I am in a similar situation. Have some displays containing other
  displays. I am also using setters. But this is what I am experimenting
  with:

  I have a Document editing UI that takes a file browser ui (each
  document can have corresponding files) and a single file upload ui.
  This is how it looks like:

  // other presenters are injected
  DocumentEditor(Presenter) is ctor injected with
  +FileBrowserPresenter
  +SingleFileUploadPresenter
  +RpcService
  +EventBus

  // the presenter is injected with the presenter
  DocumentEditorWidget is ctor injected with
  +DocumentEditorPresenter
  +SingleFileUploadWidget // created via new
  +FileBrowserWidget // created via new

  that is right. I made the widget have a strong dependency on the
  presenter. I see the Presenter/View a wholesome unit. Where logic from
  the UI has been factored out in the presenter.

  This is different from what is presented at the slides

  PhoneEditWidget phoneEditWidget = new PhoneEditWidget();
  PhoneEditor phoneEditor = new PhoneEditor(phoneEditWidget,
   rpcService);

  I am doing

  PhoneEditor phoneEditor = new PhoneEditor(phoneEditWidget,
   rpcService);
  PhoneEditWidget phoneEditWidget = new PhoneEditWidget(phoneEditor);

  I can then do

  @Inject ProviderDocumentEditorWidget documentEditors;
  panel.add(documentEditors.get());

  with no problems.

  the bindDisplay and display of DocumentEditor look like

  public static interface Display{
    ...
    FileBrowser.Display getFileBrowser();
    SingleFileUpload.Display getUpload();
  }

  public void bindDisplay(Display display) {
    ...
    fileBrowserPresenter.bindDisplay(display.getFileBrowser());
    uploadPresenter.bindDisplay(display.getUpload());
  }

  I can't really call this a best practice. Will see what the code will
  tell me after some more time. Am also interested in what other people
  are doing.

  Cheers
  Alen

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



Re: MVP injection best practices

2009-08-17 Thread Alen Vrecko

I am in a similar situation. Have some displays containing other
displays. I am also using setters. But this is what I am experimenting
with:

I have a Document editing UI that takes a file browser ui (each
document can have corresponding files) and a single file upload ui.
This is how it looks like:

// other presenters are injected
DocumentEditor(Presenter) is ctor injected with
+FileBrowserPresenter
+SingleFileUploadPresenter
+RpcService
+EventBus

// the presenter is injected with the presenter
DocumentEditorWidget is ctor injected with
+DocumentEditorPresenter
+SingleFileUploadWidget // created via new
+FileBrowserWidget // created via new

that is right. I made the widget have a strong dependency on the
presenter. I see the Presenter/View a wholesome unit. Where logic from
the UI has been factored out in the presenter.

This is different from what is presented at the slides

PhoneEditWidget phoneEditWidget = new PhoneEditWidget();
PhoneEditor phoneEditor = new PhoneEditor(phoneEditWidget,
  rpcService);

I am doing

PhoneEditor phoneEditor = new PhoneEditor(phoneEditWidget,
  rpcService);
PhoneEditWidget phoneEditWidget = new PhoneEditWidget(phoneEditor);

I can then do

@Inject ProviderDocumentEditorWidget documentEditors;
panel.add(documentEditors.get());

with no problems.

the bindDisplay and display of DocumentEditor look like

public static interface Display{
   ...
   FileBrowser.Display getFileBrowser();
   SingleFileUpload.Display getUpload();
}

public void bindDisplay(Display display) {
   ...
   fileBrowserPresenter.bindDisplay(display.getFileBrowser());
   uploadPresenter.bindDisplay(display.getUpload());
}

I can't really call this a best practice. Will see what the code will
tell me after some more time. Am also interested in what other people
are doing.

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



Re: How to use BindListener and Matcher?

2009-08-17 Thread Alen Vrecko

The bindListener wants a Matcher that either works on TypeLiterals or
Objects (super of TypeLiteral). You're supplying a Matcher that works
on Classes. The compiler wins.;)

I'd make an adapter like this

public static class ClassToTypeLiteralMatcherAdapter extends
AbstractMatcherTypeLiteral{
private final MatcherClass classMatcher;

public ClassToTypeLiteralMatcherAdapter(MatcherClass
classMatcher) {
this.classMatcher = classMatcher;
}

public boolean matches(TypeLiteral typeLiteral) {
return classMatcher.matches(typeLiteral.getRawType());
}
}

bindListener(new ClassToTypeLiteralMatcherAdapter(Matchers.subclassesOf
(Foo.class)),...);

or just write a MatcherTypeLiteral on the fly.

Cheers,
Alen

On Aug 17, 10:20 pm, Michael Burton m...@niskala.org wrote:
 I'm a little confused as to how to use bindListener with a Matcher.

 The following works fine:

         bindListener( Matchers.any(), new MyListener() );

 However, if I try to limit the matches to a smaller set, I get a
 compilation error:

         bindListener( Matchers.subclassesOf(Foo.class), new MyListener
 () );

 The method bindListener(Matcher? super TypeLiteral?,
 TypeListener) in the type AbstractModule is not applicable for the
 arguments (MatcherClass, MyListener)

 Is there a proper way to limit the set of classes that a listener is
 bound to?

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



Re: How can I inject into a TypeListener?

2009-08-09 Thread Alen Vrecko

Looks like the root problem is that TypeListner gets injected after it
hears all the stuff.

How about using a place holder (proxy) or something like that.

public class ConsumerTypeListener implements TypeListener
{

private InjectionListenerProxy holder = new InjectionListenerProxy
();

public I void hear(TypeLiteralI type, TypeEncounterI
encounter)
{
encounter.register(holder);
}

@Inject
public void injectedAfterInjectorReady(ConsumerInjectionListener
listener){
 holder.delegateTo(listener);
   }
}

now when you request an instance the proxy will delegate the call to
your real listener.

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



Re: Difference between Guice 2.0 and 1.0

2009-07-21 Thread Alen Vrecko

http://code.google.com/p/google-guice/wiki/Guice20

Cheers
Alen

On Jul 21, 5:56 pm, David Stevens stevensdav...@googlemail.com
wrote:
 I'm currently working from a book  (Google Guice: Agile Lightweight
 Dependency Injection Framework by Robbie Vanbrabant - Apress) which
 was published in April 2008 and is based on version 1.0.

 Can anyone tell me what the major differences are between versions?
 (I'm using version 2.0)

 Thanks,

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



Re: how to bind parametrized type?

2009-07-09 Thread Alen Vrecko

Don't forget the cast

bind( (TypeLiteralList) typeLiteral ).toInstance(list);

Cheers
Alen

On Jul 10, 2:32 am, Dmitry Skavish skav...@gmail.com wrote:
 ok, I guess I found the answer, I was very close:
  TypeLiteral typeLiteral =
 TypeLiteral.get(Types.newParameterizedType(List.class, clazz));
  bind(typeLiteral).toInstance(list);



 On Thu, Jul 9, 2009 at 7:47 PM, Dmitry Skavish skav...@gmail.com wrote:
  Ben,
  I think my explanation was confusing. Let me try to explain it better. I am
  getting class names from some configuration files. So basically I have a
  list of Class objects. I want to create bindings from Listeach of thouse
  classes to some providers of these lists (or instances, it does not really
  matter).

  For example if I have configuration with class names:
  java.lang.Integer, java.lang.String, java.lang.Long then the bindings should
  be equivalent to the following:

    bind(new TypyLiteralListInteger() {}).to(provider of ListInteger)
    bind(new TypyLiteralListString() {}).to(provider of ListString)
    bind(new TypyLiteralListLong() {}).to(provider of ListLong)

  so that if I have a class:

  class A {
    @Inject
    A(ListString strings, ListInteger ints) {}
  }

  then the right list is injected into the constructor.

  the problem is that those configurations are known at runtime and I have to
  construct the bindings at runtime as well. I don't know the types at compile
  times and I cannot create those bindings statically in the code.

  Any ideas how to do that?

  Thanks!

  On Thu, Jul 9, 2009 at 7:35 PM, Ben ajoo.em...@gmail.com wrote:

  On Thu, Jul 9, 2009 at 6:32 PM, Ben ajoo.em...@gmail.com wrote:

  I guess a common advice is to stay away from .toInstance().

  But assuming you have to do that (maybe it's a test), I would do it this
  way to avoid messing with reflection directly:
  abstract class ListModuleT extends AbstractModule {

    protected ListModule(ListT list) {
      this.list = list;
    }

    @Provides ListT provideList() {
      return list;
    }
  }

  new ListModuleString(new ArrayListString()) {};

  FeedBurner has a convenience class that can be used as:

  new BindingModuleListString(Lists.newArrayList()) {};

  Oops. I thought this is another list. Please ignore this part, it's
  irrelevant.

  On Thu, Jul 9, 2009 at 4:39 PM, Dmitry Skavish skav...@gmail.comwrote:

  Hi,
  I can't figure out how to bind class parametrized with a given Class?

  For example if I have something like this:

  Module createModule(Class clazz, List list) {
     return new AbstractModule() {
        protected void configure() {
           bind(??).toInstance(list);
         }
      };
  }

  then after this call: createModule(String.class, new ArrayList())

  I have binding from ListString to my list

  This binding should be equivalent to this one: bind(new
  TypeLiteralListString() {}).toInstance(list);

  I tried to the following, but compiler does not like it and I am not
  really sure this is the right way:

  bind(Key.get(Types.newParameterizedType(List.class,
  clazz))).toInstance(list);

  Thanks!
  --
  Dmitry Skavish

  --
  Dmitry Skavish

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



Re: Enhancer.getMethods()

2009-06-19 Thread Alen Vrecko

You can intercept all but not private methods with cglib. The reason
is that private methods are non-virtual.

You should note that your times will be polluted with your interceptor
overhead.
Afaik most of the profiles use java.lang.instrument and jvmti to get
the job done. But that is another story.

Cheers
Alen

On Jun 19, 3:32 am, thach thachnngu...@gmail.com wrote:
 I'm trying to write a profiler that basically intercepts a method, do
 a timing around it before executing it. As I was walking through the
 code, the line

     Enhancer.getMethods(declaringClass, null, methods);

 in ProxyFactory returns a List of _public_ methods. What about non-
 public methods? There's no way to intercept (so I can profile) them?

 Any pointer is appreciated.

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



Re: AOP interceptor: match only subclass methods

2009-06-13 Thread Alen Vrecko

Notice the first Matcher takes a ? super Class and it decides if the
class is eligible for AOP. The second Matcher takes a ? super Method
and it decides if it should intercept the method or not.

Nothing is stopping you from inspecting the method e.g.

new AbstractMatcherMethod() {
public boolean matches(Method method) {
return method.getDeclaringClass().getPackage
()  // decide if you like this method or not
}
}


Cheers
Alen

On Jun 13, 3:02 pm, tchan tks...@gmail.com wrote:
 Hi;

 Has anyone worked with the AOP interceptors in Guice much?  I'm used
 to using full blown AspectJ in my other projects and am having
 difficulty reproducing some mix-in behaviour using plain AOP.

 I want to introduce a tracer on instance methods in certain packages.
 The catch is that I only want the logic applied to methods declared in
 those packages.  That is, skip methods defined in parent classes that
 reside outside of the target packages.

 So say class A resides in org.library and class B that extends A
 resides in my.project.  I want to only intercept methods defined in
 my.project.B and not any inherited method from org.library.A.

 Right now, I am using subpackageOf() as my class matcher and any() as
 my method matcher in my bind interceptor declaration.  This doesn't do
 what I want, it will apply to all methods in the subpackage, even
 inherited methods from classes outside the packages I state.

 Does anyone have any ideas on how to do this with a custom method
 matcher?  And if it can't be done statically, what about during
 runtime in the actual interceptor?

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



Re: MethodInterceptor is not applied when using @Provides Provier Methods

2009-06-09 Thread Alen Vrecko

Well, the way guice handles aop it is not possible for aop elements to
come into a live instance(created via new). That is why using provider
with new doesn't work.

But you're right, aop elements sure can be added. One good thing about
Guice is that it extends easily. You can write a custom provider that
does aop on live instances for you. Something like this http://pastie.org/505566
and do

bind(Foo.class).toProvider(FooProvider.class);

public static class FooProvider extends AopProxingProviderFoo {
public Foo getPlain() {
return new Foo();
}
}

Maybe there is a better way. The code is just a suggestion.

Cheers
Alen

On Jun 9, 9:26 am, uud ashr uuda...@gmail.com wrote:
 Why AOP element can't get in?
 Guice has provider and call Object instance = someProvider.get(), guice has
 the instance.

 On spring I can do this.

 import org.aopalliance.intercept.MethodInterceptor;

 import org.aopalliance.intercept.MethodInvocation;

 import org.springframework.aop.framework.ProxyFactory;

 public class Hello {

     public void hello() {

         System.out.println(Hello);

     }

     public static void main(String[] args) {

         Hello hello = new Hello();

         ProxyFactory pf = new ProxyFactory(hello);

         pf.addAdvice(new MethodInterceptor() {

             public Object invoke(MethodInvocation invocation) throwsThrowable 
 {

                 if (invocation.getMethod().getName().equals(hello)) {

                     System.out.println(Intercepting hello);

                 }

                 Object retVal = invocation.proceed();

                 return retVal;

             }

         });

         Hello proxyHello = (Hello)pf.getProxy();

         proxyHello.hello();

     }

 }

 See. I think we can implement this on Guice. Is it possible? I haven't check
 the source code yet, but I think this is possible.

 On Fri, May 22, 2009 at 2:29 AM, Alen Vrecko alen_vre...@yahoo.com wrote:

  In order for AOP to work Guice needs to create the instance itself
  i.e. it must not be created with new. Guice will not just use
  constructor on ServiceImpl class but it will first create a new
  subclass of ServiceImpl that has the AOP elements in it and use the
  constructor on this subclass. But if you create it with new ServiceImpl
  () there is no way AOP elements can get in.

  Cheers,
  Alen

  On May 21, 2:58 pm, thomas.darim...@googlemail.com
  thomas.darim...@googlemail.com wrote:
   Hello,

   I just tried to use a MethodInterceptor with a Provider-Method binding
   but the method interceptor gets not applied.

   When I use the normal binding style: bind(Service.class).to
   (ServiceImpl.class);
   the inteceptor gets applied.

   Am I doing something wrong here?

   package de.tutorials;

   import java.util.Arrays;

   import org.aopalliance.intercept.MethodInterceptor;
   import org.aopalliance.intercept.MethodInvocation;

   import com.google.inject.AbstractModule;
   import com.google.inject.Guice;
   import com.google.inject.Injector;
   import com.google.inject.Module;
   import com.google.inject.Provides;
   import com.google.inject.matcher.Matchers;

   public class InterceptorIsNotAppliedToProviderMethodBinding {

           public static void main(String[] args) {
                   Injector injector = Guice.createInjector(modules());
                   Service service = injector.getInstance(Service.class);
                   service.service();

           }

           private static IterableModule modules() {
                   return Arrays.ModuleasList(
   //                              interceptorIsApplied()
   //                              ,
                                   interceptorIsNotApplied()
                   );
           }

           private static Module interceptorIsApplied() {
                   return new AbstractModule(){
                           protected void configure() {

  bind(Service.class).to(ServiceImpl.class);

  bindInterceptor(Matchers.subclassesOf(Service.class), Matchers.any
   (), tracingInterceptor());
                           }

                   };
           }

           private static Module interceptorIsNotApplied() {
                   return new AbstractModule(){

                           @SuppressWarnings(unused)
                           @Provides Service services(){
                                   return new ServiceImpl();
                           }

                           @Override
                           protected void configure() {

  bindInterceptor(Matchers.subclassesOf(Service.class), Matchers.any
   (), tracingInterceptor());
                           }
                   };
           }

           protected static MethodInterceptor tracingInterceptor() {
                   return new MethodInterceptor(){
                           @Override
                           public Object invoke(MethodInvocation
  methodInvocation) throws
   Throwable

Re: Forwarding Issue to Servlets

2009-05-28 Thread Alen Vrecko

AFAIK request.getRequestDispatcher(/bar) if Guice managed servlet /
bar is bound then you should get the ManagedServletPipeline$2 (The
special RD) but if it is not known then you should get
ApplicationDispatcher (original RD). I am guessing you dont have a
serve(/bar).with(...) call and you get ApplicationDispatcher
instead.

I am quite sure that /foo/* pattern works with Guice ;)

Cheers
Alen

On May 28, 4:54 am, Steve steveke...@gmail.com wrote:
 Thanks for your response Alen.

 I've double checked my request coming in, it's a ServletDefinition
 that contains the ManagedServletPipeline (although what is returned
 from request.getRequestDispatcher(/bar) is an
 ApplicationDispatcher).

 For the moment I'm using a redirect to the full URL which works fine.

 With regards the url pattern, I'm new to this as well, but when I use
 that pattern you suggest inside Guice it doesn't forward to the
 download servlet at all, forwards or otherwise. It appears Guice does
 not allow that pattern, which is why I am using the regular /
 download pattern.

 On May 28, 12:44 am, Alen Vrecko alen_vre...@yahoo.com wrote:

  While I am not a fan of it works on my machine posts this is it.

  Doing httpRequest.getRequestDispatcher(/bar) returns an instance of
  com.google.inject.servlet.ManagedServletPipeline$2 and calling forward
  on it works as expected.

  I am not a servlet expert but

  serve(/download).with(DownloadServlet.class); is not the same as

  url-pattern/download/*/url-pattern

  the former will match only exactly for /download and nothing else but
  the latter will match /download/foo, /download/bar , /download/

  serve(/download/*) is the same as url-pattern/download/*/url-
  pattern you put in serve method param what you put in url-pattern.

  Cheers
  Alen

  On May 27, 10:47 pm, Steve steveke...@gmail.com wrote:

   I'm grabbing the RequestDispatcher from the actual Request passed into
   the original servlet (that went through the Guice filter chain), not
   the ServletContext, but forwarding to the next Servlet gives me the
   404.

   On May 27, 8:01 pm, Alen Vrecko alen_vre...@yahoo.com wrote:

I assume you get the RequestDispatcher from the ServletContext. This
RD is the original one from the servlet container and as such it
doesn't know about the servlets you specified in your module.

One the other hand if you get the RD from the Request that one is
special (enhanced) and it does know about the servlets you specified
in your module. Try with getting RD from the request.

Cheers
Alen

On May 27, 4:49 pm, Steve steveke...@gmail.com wrote:

 Hey Guys,

 I've seen in another post:

http://groups.google.com/group/google-guice/browse_thread/thread/f06a...

 that there is an issue forwarding with JSPs. I am having an issue
 forwarding from one servlet to another.

 I have migrated my servlet to Guice like so:

serve(/download).with(DownloadServlet.class);

 from web.xml:

 servlet-mapping
 servlet-nameDownloadServlet/servlet-name
 url-pattern/download/*/url-pattern
 /servlet-mapping

 But when I forward (using getRequestDispatcher) to this servlet in
 Guice I'm getting a 404, it works fine when in web.xml.

 I had the servlet forwarding issue outlined in the discussion above,
 and used tchan's hack and it solved the jsp forwarding issue, but
 I'm stumped on this. Any ideas? Is the /download/* pattern in the
 web.xml significant in it's difference from the way it is served with
 Guice?

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



Re: How to inject dependencies when creating objects via reflection..

2009-05-21 Thread Alen Vrecko

Here are some examples of using Assisted Inject and Map Binder

http://groups.google.com/group/google-guice/browse_thread/thread/3c86c7712deae803/50bd5af95622e49b

Maybe it will give you some ideas.

Cheers,
Alen

On May 21, 9:00 pm, David Stenglein david.stengl...@gmail.com wrote:
 Jigar,

 AssistedInject allows you to have a single factory interface for
 creating all of your instances, even if they have different
 dependencies in the constructor arguments. As long as the other
 arguments can be supplied through Injection, it doesn't matter how
 many there are; there just needs to be a match between the arguments
 of the create(...) method of your factory interface and the Assisted
 arguments of each types constructor.

 Given this, all you need is some way to call up the factory for an
 instance you need and you can get that instance without reflection.

 The grouping of all of your implementations could be done with a
 MapBinder (http://code.google.com/p/google-guice/wiki/Multibindings).
 All you need to do is choose a key to select your implementation
 (which you probably have already).

 -Dave

 -Dave

 http://code.google.com/p/google-guice/wiki/Multibindings



 On Thu, May 21, 2009 at 4:18 AM, Jigar Gosar jigar.go...@gmail.com wrote:

  * How Injecting dependencies when creating objects via reflection
  and the object also has a constructor parameters.

  * details:

  I have a Hierachy (tree) of classes.

  class Base{
     Base(String s){...}
  }

  class Child1{
        Child1(String s){super(s)}
  }

  class Child2{
        Child1(String s){super(s)}
  }

  and so on, not that class Child1 also has its own children.

  * Till now I was creating the classes via reflection and invoking the
  string parameter constructor.

  * now the base class has a dependency that I want guice to inject.

  class Base{
     Base(String s, Dep d){...}
  }

  class Child1{
        Child1(String s, Dep d){super(s)}
  }

  class Child2{
        Child1(String s, Dep d){super(s)}
  }

  * I have read up on assisted inject, but am not sure on how to use is
  to solve this problem. Since I am using reflection to to create the
  objects of this class Hierarchy.

  * Note: the reason I am using reflection to create objects is because
  the type of the object to be instantiated is not known till runtime. I
  receive strings from socket and need to wrap them into objects before
  processing them (I have simplified the actual requirement for sake of
  brevity).

  * so the broader question is how do I create objects of class whose
  type is not known till runtime and it has dependinecies and also
  constructor parameters.

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



Re: MethodInterceptor is not applied when using @Provides Provier Methods

2009-05-21 Thread Alen Vrecko

In order for AOP to work Guice needs to create the instance itself
i.e. it must not be created with new. Guice will not just use
constructor on ServiceImpl class but it will first create a new
subclass of ServiceImpl that has the AOP elements in it and use the
constructor on this subclass. But if you create it with new ServiceImpl
() there is no way AOP elements can get in.

Cheers,
Alen

On May 21, 2:58 pm, thomas.darim...@googlemail.com
thomas.darim...@googlemail.com wrote:
 Hello,

 I just tried to use a MethodInterceptor with a Provider-Method binding
 but the method interceptor gets not applied.

 When I use the normal binding style: bind(Service.class).to
 (ServiceImpl.class);
 the inteceptor gets applied.

 Am I doing something wrong here?

 package de.tutorials;

 import java.util.Arrays;

 import org.aopalliance.intercept.MethodInterceptor;
 import org.aopalliance.intercept.MethodInvocation;

 import com.google.inject.AbstractModule;
 import com.google.inject.Guice;
 import com.google.inject.Injector;
 import com.google.inject.Module;
 import com.google.inject.Provides;
 import com.google.inject.matcher.Matchers;

 public class InterceptorIsNotAppliedToProviderMethodBinding {

         public static void main(String[] args) {
                 Injector injector = Guice.createInjector(modules());
                 Service service = injector.getInstance(Service.class);
                 service.service();

         }

         private static IterableModule modules() {
                 return Arrays.ModuleasList(
 //                              interceptorIsApplied()
 //                              ,
                                 interceptorIsNotApplied()
                 );
         }

         private static Module interceptorIsApplied() {
                 return new AbstractModule(){
                         protected void configure() {
                                 bind(Service.class).to(ServiceImpl.class);
                                 
 bindInterceptor(Matchers.subclassesOf(Service.class), Matchers.any
 (), tracingInterceptor());
                         }

                 };
         }

         private static Module interceptorIsNotApplied() {
                 return new AbstractModule(){

                         @SuppressWarnings(unused)
                         @Provides Service services(){
                                 return new ServiceImpl();
                         }

                         @Override
                         protected void configure() {
                                 
 bindInterceptor(Matchers.subclassesOf(Service.class), Matchers.any
 (), tracingInterceptor());
                         }
                 };
         }

         protected static MethodInterceptor tracingInterceptor() {
                 return new MethodInterceptor(){
                         @Override
                         public Object invoke(MethodInvocation 
 methodInvocation) throws
 Throwable {
                                 System.out.println(About to execute:  +
 methodInvocation.getMethod());
                                 return methodInvocation.proceed();
                         }
                 };
         }

         static interface Service{
                 void service();
         }

         static class ServiceImpl implements Service{
                 public void service() {
                         System.out.println(service);
                 }
         }

 }

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



Re: Guice 2.0

2009-05-20 Thread Alen Vrecko

Thank you, Jesse! The new features are awesome!

Maybe GIN can now be released to;)

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



Re: Child Injector Eager Singletons?

2009-05-16 Thread Alen Vrecko

I've debugged a little bit. It is cool to see the inner workings of
Guice. It looks like:

The createChildInjector's injector JIT bindings end up at the root
injector (which is already fully initialized and is not
reinitialized) therefore the bindings just sit there and don't get
processed. Probably better if they'd wind up at the child injector
like it happens with PrivateModules or something.

Probably the easiest if just use explicit bindings instead of
@Singleton.

Cheers,
Alen

On May 16, 8:36 pm, Sam Berlin sber...@gmail.com wrote:
 Did you mean to reply with this in the other thread (about @nullable)?

 Any insight into this child injector eager singleton issue?  The  
 @nullable  one can be worked around, but I don't see a good way to  
 workaround this.

 Sam

 On May 16, 2009, at 1:00 PM, je...@swank.ca limpbiz...@gmail.com  
 wrote:



  Hey Sam, yeah sorry about this. It comes as a consequence of using
  regular Guice stuff to create instances. I've added a note to the
  docs.
     http://tinyurl.com/pn4uca

  If there's any other doc that could be improved, please let me know!
  Or submit patches!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
google-guice group.
To post to this group, send email to google-guice@googlegroups.com
To unsubscribe from this group, send email to 
google-guice+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-guice?hl=en
-~--~~~~--~~--~--~---



Re: Guice 2 SNAPSHOT: migrating from web.xml to ServletModule/GuiceFilter

2009-05-05 Thread Alen Vrecko

 Hey, thanks for the reply.

Hi. You to. I'll learn from this.

 I am just using the snapshot build.

I don't think there is any difference with regards to servlets.

 From my understanding, if I am using the dispatcher from
 ServletRequest, forwards and includes will be relative to the servlet
 path unless preceded by a slash.  In that case, it's relative to
 context root, i.e. WebContent.  At least this is how it works in
 Tomcat and WebSphere.

You're right. In the servlet spec I found this part a bit confusing it
only explicitly mentions the relative paths. Thanks for clarifying
this.

 I tried using the RequestDispatcher from ServletContext without Guice
 (straight web.xml mapping) on Tomcat and it looks like it actually
 wants all paths to start with a slash, it too serves relative to
 context root.

On the other hand this is explicitly mentioned in the spec.
RequestDispatcher for ServletContext must start with a slash. I
thought Context and Request dispatcher are exclusive one is absolute
the other relative. But the latter is only complementary. Great.


 WEB-INF is special in that it can't be access directly from the client
 side but you're allowed to access it internally via a request
 dispatcher.

Right. I've always thought there is somebody with a shotgun protecting
WEB-INF. I was wrong;)

 I experimented with getServletContext().getRequestDispatcher() with
 the Guice servlet adapter and it too doesn't work with forwards but
 it's fine with include.
  So the request dispatcher doesn't seem to
 make a difference and stepping through the debug showed it was the
 same problem with the servlet path reported by the server request
 wrapper.


Got it! Squash! Like there is a saying Premature Optimization is the
root of all evil or something like that.

What happens is that the Wrapper caches the paths but when you forward
the paths in the original request are changed but the wrapper returns
the old cached path!

Quick fix is just to get rid of the Memoizer in ServletDefinition
lines 203+. Hope that helps.

Will take a closer look at this wrapper soon and maybe make a patch or
something.

 I don't think that's the case.  When I tried /test in my browser, it
 did make a request for /test on the servlet side, sans final slash.

Never mind. What was I thinking? Nothing! Today it works as expected.
Must been some Heisenbug in the browser or something.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
google-guice group.
To post to this group, send email to google-guice@googlegroups.com
To unsubscribe from this group, send email to 
google-guice+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-guice?hl=en
-~--~~~~--~~--~--~---



Re: Guice 2 SNAPSHOT: migrating from web.xml to ServletModule/GuiceFilter

2009-05-04 Thread Alen Vrecko

I gave it a quick go (trunk build) and it to works with jsp out of the
box but it is not perfect(calling include works but calling forward
crashes).

IIRC There are 2 different ways of getting the RequestDispatcher

o) From ServletContext in that case you specify the whole path
context.getRequestDispatcher(/fooServlet/whatever.html) it begins
with / i.e. the root
o) From ServletRequest in that case you specify only the part that
comes after the servlet since the request knows for which servlet it
belongs e.g. request.getRequestDispatcher(whatever.html). Note the /
fooServlet/ is figured out from the request.

You're doing req.getRequestDispatcher( /WEB-INF/jsp/test.jsp). I
could be wrong but you are doing the request way your request is
actually for /servlet//WEB-INF/jsp/test.jsp beside I think that
request for WEB-INF/* should return 404 in any case. WEB-INF is
private property.

You can try @Inject ServletContext ctx; and doing
ctx.getRequestDispatcher(/jsp/test.jsp) or properly use request way.

I noticed

serve( /test ).with( TestServlet.class );

If you try /test in the browser it will return 404 since the browser
actually requests /test/ notice the trailing /. Try

serve( /test/ ).with( TestServlet.class )

Dhanji maybe  /test and /test/ should be equivalent in serve
definition? At least I noticed that trailing / makes a big difference.

Anyway. Oddly enough

requestDispatcher = either from context (long path) or request (short
path)

requestDispatcher.forward(httpServletRequest, httpServletResponse); //
this produces SIOOBE WTF?
requestDispatcher.include(httpServletRequest, httpServletResponse); //
works browser returns the correct response

Cheers,
Alen

On May 4, 12:55 am, Dhanji R. Prasanna dha...@gmail.com wrote:
 Yea you're right that that is basically the problem. I'll look into this
 when I have some time later in the month. Any other volunteers?
 Dhanji.

 On Mon, May 4, 2009 at 2:45 AM, tchan tks...@gmail.com wrote:

  All right, I took a stab at it and managed to find the problem but I
  don't understand it well enough to fix it.

  In Tomcat, the forward to the referenced jsp will eventually be
  serviced by the Jasper jsp servlet.  When the target jsp is defined in
  web.xml, it can just grab its path from that servlet definition entry
  otherwise it has to be a request from RequestDispatcher.  So if it's
  an include, then there's a request attribute with the path already
  otherwise for a forward, Jasper will call request.getServletPath() and
  append getPathInfo() on it as needed.  This is where the problem is.

  The request object here is a Guice wrapper object, specifically the
  anonymous HttpServletRequestWrapper class inside
  ServletDefinition.doService().  Its getServlePath() defers to
  computePath() to figure out the servlet path and it *seems* to return
  the servlet mapping of the original servlet rather than the servlet
  path of the jsp forward.  computePath() does defer to its super
  (Tomcat) request object if it can't compute it itself and that wrapped
  request object returns the right servlet path.

  So in short, the request wrapper in ServletDefinition has a bug that
  trips jsp forwards in Tomcat.  But I don't understand why it does what
  it tries to do so I'll have to leave it to Dhanji to take a look at
  it.

  On May 3, 8:51 am, tchan tks...@gmail.com wrote:
   I don`t mind taking a stab at ii if you can point me in the right
   direction.  I tried debugging through Tomcat`s pipeline but that was
   too much for me (and I really couldn`t see a difference between the
   web.xml and GuiceFilter scenarios).

   On May 3, 12:25 am, Dhanji R. Prasanna dha...@gmail.com wrote:

yea this is a known problem, I just have not had any time to address it
  =(
If you would like to contribute a patch we would be thrilled! Otherwise
  I
hope to get to this problem soon.

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



Re: Parameters in Provider.

2009-04-21 Thread Alen Vrecko

I just look at this briefly maybe a long-shot but it can't hurt. Maybe
this code will give you some idea. It uses Guice 2.

http://pastie.org/453944

Cheers,
Alen


On Apr 21, 10:13 pm, ale ale.sch...@gmail.com wrote:
 i can use something like this. but if i have 25 commands ?, i have to
 pass 25 parameters in the constructor. ?

 public class CommandProviderFactory {
         private ProviderCommandX commandXProvider;
         private ProviderCommandY commandYProvider;

         @Inject public CommandProviderFactory(ProviderCommandX
 commandXProvider,
                                                                   
 ProviderCommandY commandYProvider) {
         }

         public Command create(String commandName) throws Exception {
                 if(commandName.equals(commandX))
                         return commandXProvider.get();
                 else if(commandName.equals(commandY))
                         return commandYProvider.get();
                 else
                         throw new Exception(command not found);
         }

 }

 On Apr 21, 3:35 pm, ale ale.sch...@gmail.com wrote:

  Thanks Oliver.

  but i don't understand how assistedinject can help me.

  can you help me fix this example code.

  /* Main */
  public class Main {
          public static class MainModule extends AbstractModule {
                  @Override protected void configure() {
                          
  bind(RemoteServiceX.class).to(RemoteServiceXImpl.class);
                          
  bind(RemoteServiceY.class).to(RemoteServiceYImpl.class);
                  }
          }
          public static void main(String[] args) {
                  Injector inejector = Guice.createInjector(new MainModule());
                  Test test = inejector.getInstance(Test.class);
                  Command command = test.processRequest(commandX);
                  command.execute();
          }}

  public class Test {
          public Command processRequest(String commandName) {
                  if( commandName.equals(commandX) )
                          return new CommandX(?); //HERE IS THE PROBLEM
                  else if ( commandName.equals(commandX) )
                          return new CommandY(?); //HERE IS THE PROBLEM
                  return null;
          }

  }

  /*      Command */
  public interface Command {
          void execute();

  }

  public class CommandX implements Command {
          private RemoteServiceX service;
          private String runtimeParameter;

          @Inject public CommandX(RemoteServiceX service, String
  runtimeParameter) {
                  this.service = service;
                  this.runtimeParameter = runtimeParameter;
          }

          @Override public void execute() { /*TODO: implements this method*/ }

  }

  public class CommandY implements Command{
          private RemoteServiceX service;
          private String runtimeParameter;

          @Inject public CommandY(RemoteServiceX service, String
  runtimeParameter) {
                  this.service = service;
                  this.runtimeParameter = runtimeParameter;
          }

          @Override public void execute() { }

  }

  /* Services */
  public interface RemoteServiceX {
          public void specificMethod1OfServiceX();
          public void specificMethod2OfServiceX();

  }

  public class RemoteServiceXImpl implements RemoteServiceX {
          @Override public void specificMethod1OfServiceX() {/*TODO: 
  implements
  this method*/}
          @Override public void specificMethod2OfServiceX() {/*TODO: 
  implements
  this method*/}

  }

  public interface RemoteServiceY {
          public void specificMethod1OfServiceY();
          public void specificMethod2OfServiceY();

  }

  public class RemoteServiceYImpl implements RemoteServiceY {
          @Override public void specificMethod1OfServiceY() {/*TODO: 
  implements
  this method*/}
          @Override public void specificMethod2OfServiceY() {/*TODO: 
  implements
  this method*/}

  }

  On Apr 21, 1:38 pm, Olivier Grégoire ogrego...@gmail.com wrote:

   Hello,

   You must create a factory instead of using a Provider. To help you, the
   extension AssistedInject exists.

   More details in the 
   wiki:http://code.google.com/p/google-guice/wiki/AssistedInject

   Regards,
   Olivier

   2009/4/21 ale ale.sch...@gmail.com

How can i do this.?

public class CommandProvider implements ProviderCommand {

       public Command get(runtimeValue1, runtimeValue2) {

               if(runtimeValue1.equals( commandX )) {

                       return new FooCommandX( runtimeValue2 );

               } else if (runtimeValue1.equals( commandY )) {

                       return new FooCommandY(runtimeValue2);

               } else if (runtimeValue1.equals( commandZ )) {

                       return new FooCommandZ(runtimeValue2);

               } else {
                   throw new 

Re: Using Guice under Webstart

2009-03-31 Thread Alen Vrecko

Guice tries to call System.getProperty but the Security Manager
doesn't like that so it throws an exception.

I tought that Web Start doesn't allow you to use your own policy file.
This is new.

Cheers,
Alen

On Mar 31, 1:35 pm, Gili gili.tzab...@gmail.com wrote:
 Attempting to use Guice under an unsigned Java Webstart application I
 get:

 Exception in thread AWT-EventQueue-0
 java.lang.ExceptionInInitializerError
         at com.google.inject.InjectorBuilder.init(InjectorBuilder.java:54)
         at com.google.inject.Guice.createInjector(Guice.java:92)
         at com.google.inject.Guice.createInjector(Guice.java:69)
         at com.google.inject.Guice.createInjector(Guice.java:59)
         at videoease.Main$1.run(Main.java:46)
         at java.awt.event.InvocationEvent.dispatch(Unknown Source)
         at java.awt.EventQueue.dispatchEvent(Unknown Source)
         at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown
 Source)
         at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown
 Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.run(Unknown Source)
 Caused by: java.security.AccessControlException: access denied
 (java.util.PropertyPermission guice.allow.nulls.bad.bad.bad read)
         at java.security.AccessControlContext.checkPermission(Unknown Source)
         at java.security.AccessController.checkPermission(Unknown Source)
         at java.lang.SecurityManager.checkPermission(Unknown Source)
         at java.lang.SecurityManager.checkPropertyAccess(Unknown Source)
         at java.lang.System.getProperty(Unknown Source)
         at com.google.inject.internal.Errors.clinit(Errors.java:64)
         ... 13 more

 Any ideas?

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



Re: Binding Interceptor to intercept a method call of objects which are created by a factory method

2009-03-21 Thread Alen Vrecko

Hi Richard,

Yeah, I had dynamically created delegates in mind. Basically I'd use
code generation (handcrafted or ASM or CGLib or ...) to create a
delegate class definition (a perfectly legitimate class) and then ask
Guice to provide an instance of this class after which I set the
actual instance to delegate to (returned by the provider). I'd go and
intercept the provider like this

@CreateDynamicDelegate // this will intercept the instance and do the
magic and return the delegate, which only implements IFoo, instead of
FooImpl.
IFoo get(){
   return new FooImpl(12);
}

There are some issues with this, do you need annotations, how about
other interfaces the instance implements and obviously you can't cast
to a concrete instance and it only works for interfaces...

There are lots of smart people on this list...surely somebody will
come up with something better.

Cheers,
Alen

On Mar 21, 5:54 pm, Richard Hauswald richard.hausw...@googlemail.com
wrote:
 Hi Alen,
 I'm a brave guy so i don't fear intimidating solutions :-) But you are
 right, bindInterceptor would be the way of the hero.

  With the auto delegates I had this craziness in mind:
  when you want IFoo but are supplied with new FooImpl, you'd create a
  delegate class definition for IFoo and ask Guice to provide it (Guice
  will then subclass it with AOP) and then set the FooImpl to the
  created delegate and return the delegate. Not for the faint hearted.

 What do you mean by auto delegates? Dynamicly created or created by
 the IDE? If you mean dynamicly created, I don't have any glue how to
 do this, maybe my brain is trapped at the end of one way dead end
 road...
 Please help me out of this misery,
 Richard

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



Re: PrivateModules

2009-02-28 Thread Alen Vrecko

One more explanation, wrote it before seeing it was already answered:)
This users list has better response time than the fire department:)

The order of the modules doesn't matter. That means

Guice.createInjector(new ModuleOne(), new ModuleTwo(), new LocalModule
());

is equivalent to

Guice.createInjector(new LocalModule(), new ModuleOne(), new ModuleTwo
());

now notice in the second case that String has been exposed meaning
once a binding is created it is immutable and global for all i.e.
nobody is allowed to redefine it. This property of bindings makes it
possible for the module order to be in any way. If bindings could
overwrite each other then the order of modules would matter and that
is not very good idea.

LocalModule addes String to global bindings
ModuleOne addes String to private bindings but it CANNOT work
because it would redefine the global binding.

If you don't expose String in LocalModule it would work fine.

Cheers,
Alen

On 28 feb., 14:26, bank kus kutty.baner...@gmail.com wrote:
 Using snapshot20090205 this code doesnt work. If I removed the
 LocalModule from the injector's constructor it works fine. Is this
 expected? Whats the right way to do this.

 Code =http://eugeneciurana.com/pastebin/pastebin.php?show=40695

 Error:
 A binding to java.lang.String was already configured at
 LocalModule.configure (TestPrivateModules.java:45)

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