pombreda / google-guice

Automatically exported from code.google.com/p/google-guice
Apache License 2.0
0 stars 1 forks source link

Servlet instances in ServletsModule #361

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
It would be convenient to specify a servlet instance with the Servlet 2 syntax:
  serve("/static/*").with(new StaticContentServlet(...));

Original issue reported on code.google.com by limpbizkit on 26 Apr 2009 at 9:09

GoogleCodeExporter commented 9 years ago

Original comment by limpbizkit on 26 Apr 2009 at 9:28

GoogleCodeExporter commented 9 years ago
Couldn't that method just be a small wrapper? Something like:

void with(HttpServlet obj) {
  Key key = Key.get(obj.getClass(), UniqueAnnotations.create());
  bind(key).toInstance(obj);
  with(key);
}

Does Scopes.isSingleton return true for objects bound with .toInstance()?

Original comment by isaac.q....@gmail.com on 24 Aug 2009 at 6:47

GoogleCodeExporter commented 9 years ago
I just realized that I wanted this the other day.
I've attached a attempt at a solution here.

Original comment by isaac.q....@gmail.com on 25 Sep 2009 at 7:22

Attachments:

GoogleCodeExporter commented 9 years ago
excellent!

Original comment by dha...@gmail.com on 26 Sep 2009 at 12:05

GoogleCodeExporter commented 9 years ago
ping! could I get you guys to take a look at this?  thanks

Original comment by isaac.q....@gmail.com on 8 Oct 2009 at 2:58

GoogleCodeExporter commented 9 years ago

Original comment by dha...@gmail.com on 30 Oct 2009 at 1:22