But you can add new modules to the injector cant you? That is all I am
suggesting you do. Guice supports multiple ServletModules.

Dhanji.

On Sun, Jun 6, 2010 at 8:35 AM, Vega <[email protected]> wrote:

> Thanks
> THe proble is - I don't have control over GuiceServletConfig class, so
> I need somehow to add new "serves" bindings without change to it...
>
> On Jun 5, 6:41 pm, "Dhanji R. Prasanna" <[email protected]> wrote:
> > Don't do this, instead just install another top level module. Or if you
> want
> > to encapsulate your new bindings completely, then install it from your
> > GuiceServletConfig module. If you override configureServlets() you will
> be
> > forcing yourself and your users to be aware of the super class and to
> always
> > call super.configureServlets() and so forth, which is a maintenance mess.
> >
> > If you decompose into separate modules, then things become very simple.
> >
> > Dhanji.
> >
> > On Sat, Jun 5, 2010 at 7:04 AM, Vega <[email protected]> wrote:
> > > I have a trouble with subclassing class that extends ... . The problem
> > > is - I don't know how to add more "serve" bindings in the subclass.
> > > For example
> >
> > > public class GuiceServletConfig extends GuiceServletContextListener {
> > >  private static final Logger LOG =
> > > Logger.getLogger(GuiceServletConfig.class.getName());
> >
> > >  @Override
> > >  protected Injector getInjector() {
> > >    ServletModule servletModule = new ServletModule() {
> > >      @Override
> > >      protected void configureServlets() {
> > >        serveRegex("\\/_wave/.*").with(ForumBotty.class);
> > >        serve("/admin/jsonrpc").with(JsonRpcProcessor.class);
> >
> > >        serve("/send_email_updates").with(SendEmailUpdates.class);
> > >        serve("/send_wave_updates").with(SendWaveUpdates.class);
> > >        serve("/
> > > add_participants_task").with(AddParticipantsTask.class);
> >
> > >        serve("/feeds/
> > > get_tag_counts").with(GetTagCounts.class);
> > >        serve("/feeds/get_post_counts").with(GetPostCounts.class);
> > >        serve("/feeds/get_forum_posts").with(GetForumPosts.class);
> > >        serve("/feeds/get_latest_digest").with(GetLatestDigest.class);
> > >        serve("/feeds/json").with(JsonGenerator.class);
> > >        serve("/feeds/atom").with(AtomGenerator.class);
> >
> > >        serve("/info").with(InfoServlet.class);  //TODO remove
> >
> > >        //serve("/migrateTags").with(MigrateTags.class);
> > >        //serve("/migrateTagsTask").with(MigrateTagsTask.class);
> > >      }
> > >    };
> > >   // more stuff
> > >  return Guice.createInjector(servletModule, businessModule);
> > > }
> >
> > > Now, I have a class
> > > public class AggfiGuiceServiceConfig extends GuiceServletConfig{
> > > //
> > > }
> >
> > > --
> > > You received this message because you are subscribed to the Google
> Groups
> > > "google-guice" group.
> > > To post to this group, send email to [email protected].
> > > To unsubscribe from this group, send email to
> > > [email protected]<google-guice%[email protected]>
> <google-guice%[email protected]<google-guice%[email protected]>
> >
> > > .
> > > For more options, visit this group at
> > >http://groups.google.com/group/google-guice?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "google-guice" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<google-guice%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-guice?hl=en.
>
>

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

Reply via email to