public class JerseyMultiGuiceModule
extends com.google.inject.AbstractModule
Provides much of the functionality of the Guice ServletModule (https://github.com/google/guice/wiki/ServletModule). All registrations are forwarded to the appropriate Dropwizard/Jersey/Jetty methods.
heavily copied from Guice Servlet
     Abstracted so that you can have multiple jersey-style modules in your injector. You must
     have at least one JerseyGuiceModule but can have as many JerseyMultiGuiceModules as you
     want.
 
| Constructor and Description | 
|---|
JerseyMultiGuiceModule()  | 
| Modifier and Type | Method and Description | 
|---|---|
protected void | 
configure()  | 
protected void | 
configureServlets()
Servlet Mapping EDSL 
 | 
FilterKeyBindingBuilder | 
filter(String... urlPatterns)  | 
ServletKeyBindingBuilder | 
serve(String... urlPatterns)  | 
addError, addError, addError, bind, bind, bind, bindConstant, binder, bindInterceptor, bindListener, bindListener, bindScope, configure, convertToTypes, currentStage, getMembersInjector, getMembersInjector, getProvider, getProvider, install, requestInjection, requestStaticInjection, requireBinding, requireBindingpublic FilterKeyBindingBuilder filter(String... urlPatterns)
public ServletKeyBindingBuilder serve(String... urlPatterns)
protected final void configure()
configure in class com.google.inject.AbstractModuleprotected void configureServlets()
Part of the EDSL builder language for configuring servlets and filters with guice-servlet. Think of this as an in-code replacement for web.xml. Filters and servlets are configured here using simple java method calls. Here is a typical example of registering a filter when creating your Guice injector:
   Guice.createInjector(..., new ServletModule() {
      @Override
     protected void configureServlets() {
       serve("*.html").with(MyServlet.class)
     }
   }
 
 This registers a servlet (subclass of HttpServlet) called MyServlet to service
 any web pages ending in .html. You can also use a path-style syntax to register
 servlets:
 
       serve("/my/*").with(MyServlet.class)
 
 Every servlet (or filter) is required to be a singleton. If you cannot annotate the class
 directly, you should add a separate bind(..).in(Singleton.class) rule elsewhere in
 your module. Mapping a servlet that is bound under any other scope is an error.
 <init-param> tag in web.xml. You can similarly pass in parameters to
 Servlets and filters registered in Guice-servlet using a Map of parameter
 name/value pairs. For example, to initialize MyServlet with two parameters
 (name="Dhanji", site="google.com") you could write:
 
  Map<String, String> params = new HashMap<String, String>();
  params.put("name", "Dhanji");
  params.put("site", "google.com");
  ...
      serve("/*").with(MyServlet.class, params)
 
 
  ...
      filter("/*").through(Key.get(Filter.class, Fave.class));
 
 Where Filter.class refers to the Servlet API interface and Fave.class is a
 custom binding annotation. Elsewhere (in one of your own modules) you can bind this
 filter's implementation:
 bind(Filter.class).annotatedWith(Fave.class).to(MyFilterImpl.class);See
Binder for more information on binding syntax.Copyright © 2014–2016 Soabase. All rights reserved.