本文整理汇总了Java中org.jboss.resteasy.plugins.guice.GuiceResteasyBootstrapServletContextListener类的典型用法代码示例。如果您正苦于以下问题:Java GuiceResteasyBootstrapServletContextListener类的具体用法?Java GuiceResteasyBootstrapServletContextListener怎么用?Java GuiceResteasyBootstrapServletContextListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GuiceResteasyBootstrapServletContextListener类属于org.jboss.resteasy.plugins.guice包,在下文中一共展示了GuiceResteasyBootstrapServletContextListener类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: GitServerHandler
import org.jboss.resteasy.plugins.guice.GuiceResteasyBootstrapServletContextListener; //导入依赖的package包/类
private GitServerHandler(final Config config, final Module... overrides) {
addEventListener(new GuiceResteasyBootstrapServletContextListener() {
@Override
protected List<Module> getModules(ServletContext context) {
return ImmutableList.<Module> of(Modules.override(new GitServerModule(config)).with(overrides));
}
@Override
protected void withInjector(Injector injector) {
injectorAtomicReference.set(injector);
// No interaction with injector required. Skipping...
}
});
addServlet(HttpServletDispatcher.class, "/");
}
示例2: main
import org.jboss.resteasy.plugins.guice.GuiceResteasyBootstrapServletContextListener; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
Injector injector = Guice.createInjector(getModules(args));
Server server = new Server(injector.getInstance(Key.get(Integer.class, Port.class)));
ServletContextHandler handler = new ServletContextHandler(server, "/pvwatts");
handler.addEventListener(injector.getInstance(
GuiceResteasyBootstrapServletContextListener.class));
ServletHolder sh = new ServletHolder(HttpServletDispatcher.class);
handler.addServlet(sh, "/*");
server.setHandler(handler);
server.start();
server.join();
}
示例3: ServerRuntime
import org.jboss.resteasy.plugins.guice.GuiceResteasyBootstrapServletContextListener; //导入依赖的package包/类
public ServerRuntime(Options options,
GuiceResteasyBootstrapServletContextListener resteasyContextListener,
SwaggerServletContextListener swaggerContextListener,
HttpServletDispatcher httpServletDispatcher,
SecurityHandler securityHandler,
@Named("system.environment") String environment,
@Named("systemRuntime.resourceDir") String resourceDir) {
this.options = options;
this.resteasyContextListener = resteasyContextListener;
this.swaggerContextListener = swaggerContextListener;
this.httpServletDispatcher = httpServletDispatcher;
this.securityHandler = securityHandler;
this.environment = environment;
this.resourceDir = resourceDir;
RegisterBuiltin.register(ResteasyProviderFactory.getInstance());
}
示例4: main
import org.jboss.resteasy.plugins.guice.GuiceResteasyBootstrapServletContextListener; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
Injector injector = Guice.createInjector(new HelloModule(args));
injector.getAllBindings();
injector.createChildInjector().getAllBindings();
Server server = new Server(8080);
ServletContextHandler servletHandler = new ServletContextHandler();
servletHandler.addEventListener(injector.getInstance(GuiceResteasyBootstrapServletContextListener.class));
ServletHolder sh = new ServletHolder(HttpServletDispatcher.class);
servletHandler.setInitParameter("resteasy.role.based.security", "true");
servletHandler.addFilter(new FilterHolder(injector.getInstance(HelloFilter.class)), "/*", null);
//servletHandler.addServlet(DefaultServlet.class, "/*");
servletHandler.addServlet(sh, "/*");
server.setHandler(servletHandler);
server.start();
server.join();
}
示例5: configure
import org.jboss.resteasy.plugins.guice.GuiceResteasyBootstrapServletContextListener; //导入依赖的package包/类
@Override
public void configure() {
binder().requireExplicitBindings();
bind(GuiceResteasyBootstrapServletContextListener.class).in(Scopes.SINGLETON);
bind(ObjectMapper.class).toProvider(this::customMapper).asEagerSingleton();
bind(GuiceFilter.class);
bind(HttpServletDispatcher.class).in(Scopes.SINGLETON);
install(new HealthModule());
}
示例6: servletContext
import org.jboss.resteasy.plugins.guice.GuiceResteasyBootstrapServletContextListener; //导入依赖的package包/类
@Provides
public ServletContextHandler servletContext(GuiceResteasyBootstrapServletContextListener resteasyListener,
GuiceFilter guiceFilter,
GuiceServletContextListener guiceServletContextListener) {
final FilterHolder guiceFilterHolder = new FilterHolder(guiceFilter);
final ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
context.addFilter(guiceFilterHolder, "/*", EnumSet.allOf(DispatcherType.class));
context.addEventListener(resteasyListener);
context.addEventListener(guiceServletContextListener);
return context;
}
示例7: setUp
import org.jboss.resteasy.plugins.guice.GuiceResteasyBootstrapServletContextListener; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
server = new Server(8080);
ServletContextHandler servletHandler = new ServletContextHandler();
servletHandler.addEventListener(Guice.createInjector(new TestModule()).getInstance((GuiceResteasyBootstrapServletContextListener.class)));
servletHandler.addServlet(HttpServletDispatcher.class, "/*");
server.setHandler(servletHandler);
server.start();
}
示例8: ApiServer
import org.jboss.resteasy.plugins.guice.GuiceResteasyBootstrapServletContextListener; //导入依赖的package包/类
@Inject
public ApiServer(@Named("api.server.port") String port, GuiceResteasyBootstrapServletContextListener listener) {
this.port = Integer.parseInt(port);
this.listener = listener;
}
示例9: provideServerRuntime
import org.jboss.resteasy.plugins.guice.GuiceResteasyBootstrapServletContextListener; //导入依赖的package包/类
@Provides
@Singleton
public IServerRuntime provideServerRuntime(@Named("system.environment") String environment,
@Named("systemRuntime.resourceDir") String resourceDir,
@Named("webServer.applicationConfigurationClass") String applicationConfigurationClass,
@Named("webServer.host") String host,
@Named("webServer.httpPort") Integer httpPort,
@Named("webServer.httpsPort") Integer httpsPort,
@Named("webServer.keyStorePassword") String keyStorePassword,
@Named("webServer.keyStorePath") String keyStorePath,
@Named("webServer.defaultPath") String defaultPath,
@Named("webServer.responseDelayInMillis") Long responseDelayInMillis,
@Named("webServer.virtualHosts") String virtualHosts,
@Named("webServer.useCrossSiteScriptingHeaderParam") Boolean useCrossSiteScriptingHeaderParam,
@Named("webServer.idleTime") Long idleTime,
@Named("webServer.outputBufferSize") Integer outputBufferSize,
GuiceResteasyBootstrapServletContextListener contextListener,
SwaggerServletContextListener swaggerContextListener,
HttpServletDispatcher httpServletDispatcher,
LoginService mongoLoginService) throws ClassNotFoundException {
ServerRuntime.Options options = new ServerRuntime.Options();
options.applicationConfiguration = Class.forName(applicationConfigurationClass);
options.loginService = mongoLoginService;
options.host = host;
options.httpPort = httpPort;
options.httpsPort = httpsPort;
options.keyStorePassword = keyStorePassword;
options.keyStorePath = StringUtilities.joinStrings(File.separator,
System.getProperty("user.dir"), "resources",
keyStorePath);
options.defaultPath = defaultPath;
options.responseDelayInMillis = responseDelayInMillis;
options.virtualHosts = virtualHosts.split(";");
options.useCrossSiteScripting = useCrossSiteScriptingHeaderParam;
options.idleTime = idleTime;
options.outputBufferSize = outputBufferSize;
return new ServerRuntime(options, contextListener, swaggerContextListener, httpServletDispatcher,
null, environment, resourceDir);
}