本文整理汇总了Java中com.google.inject.persist.PersistFilter类的典型用法代码示例。如果您正苦于以下问题:Java PersistFilter类的具体用法?Java PersistFilter怎么用?Java PersistFilter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PersistFilter类属于com.google.inject.persist包,在下文中一共展示了PersistFilter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configureServlets
import com.google.inject.persist.PersistFilter; //导入依赖的package包/类
@Override
protected void configureServlets() {
filter("/services/*").through(PersistFilter.class);
final Map<String, String> parameters = Maps.newHashMap();
parameters.put(JSONConfiguration.FEATURE_POJO_MAPPING, "true");
parameters.put("com.sun.jersey.config.property.packages", "spypunk.ephealth");
parameters.put("com.sun.jersey.spi.container.ContainerResponseFilters",
"com.sun.jersey.api.container.filter.GZIPContentEncodingFilter");
serve("/services/*").with(GuiceContainer.class, parameters);
bind(LockService.class).to(LockServiceImpl.class);
bind(EndPointCheckerFactory.class).to(EndPointCheckerFactoryImpl.class);
bind(EndPointCheckService.class).to(EndPointCheckServiceImpl.class);
bind(EndPointCheckSchedulerService.class).to(EndPointCheckSchedulerServiceImpl.class);
bind(EndPointService.class).to(EndPointServiceImpl.class);
bind(EndPointResource.class).to(EndPointResourceImpl.class);
bind(EndPointCheckResource.class).to(EndPointCheckResourceImpl.class);
}
示例2: getInjector
import com.google.inject.persist.PersistFilter; //导入依赖的package包/类
@Override
protected Injector getInjector() {
injector = Guice.createInjector(new ServletModule() {
@Override
protected void configureServlets() {
String persistenceUnitName = PersistenceInitializeListener.getPersistenceUnitName();
install(new JpaPersistModule(persistenceUnitName));
filter("/*").through(PersistFilter.class);
requestStaticInjection(EntityOperatorProvider.class);
bind(GitOperation.class).in(Singleton.class);
bind(GitApi.class).in(Singleton.class);
ClassFinder.findClasses("gw.service").forEach(clazz -> bind(clazz).in(Singleton.class));
}
});
return injector;
}
示例3: configureServlets
import com.google.inject.persist.PersistFilter; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected void configureServlets() {
if (LOG.isInfoEnabled()) {
LOG.info("Installing servlets module.");
}
// Filters.
filter("/*").through(PersistFilter.class);
filter("/*").through(CacheFilter.class);
// Servlets.
serve(ENDPOINT + SecureDispatchService.REMOTE_SERVICE_RELATIVE_PATH).with(SecureDispatchServlet.class);
serve("/").with(SigmahHostController.class);
serve("/healthcheck").with(HealthCheckServlet.class);
serve(ENDPOINT + Servlet.FILE.getPathName()).with(FileServlet.class);
serve(ENDPOINT + Servlet.MANIFEST.getPathName()).with(ManifestServlet.class);
serve(ENDPOINT + Servlet.EXPORT.getPathName()).with(ExportServlet.class);
serve(ENDPOINT + Servlet.IMPORT.getPathName()).with(ImportServlet.class);
}
示例4: getInjector
import com.google.inject.persist.PersistFilter; //导入依赖的package包/类
@Override
protected Injector getInjector() {
return Guice.createInjector(new ServletModule() {
protected void configureServlets() {
install(new JpaPersistModule("IneFormShowCaseWithEjbs"));
filter("/*").through(PersistFilter.class);
};
}
, new IneFrameBaseServletModule("ineformshowcasewithejbs", ShowcaseDispatchServlet.class)
// , new IneCoreBaseServletModule("ineformshowcasewithejbs", ShowcaseDispatchServlet.class)
, new UploadServletModule()
, new TestServletModule()
, new IneFrameBaseActionHanlderModule()
, new IneFrameBaseModule()
, new IneFormActionHanlderModule()
, new IneFormDispatcherGuiceModule()
// , new IneFrameModuleGuiceModule()
, new IneModuleGuiceModule(false)
);
}
示例5: configureServlets
import com.google.inject.persist.PersistFilter; //导入依赖的package包/类
@Override
protected void configureServlets() {
bind(BuildInfo.class).toInstance(buildInfo);
bind(ServerConfig.class).toInstance(serverConfig);
// For metrics
bind(InstrumentedResourceMethodDispatchAdapter.class).in(Singleton.class);
install(new SecurityModule(servletContext));
install(new PersistenceModule(serverConfig.getDbConfig(), ""));
install(new MailModule(serverConfig.getMailConfig()));
LOG.debug("Configuring servlets and URLs");
filter("/*").through(PersistFilter.class);
filter("/*").through(GuiceShiroFilter.class);
bind(Provisioner.class).in(Scopes.SINGLETON);
bind(JacksonJsonProvider.class).in(Scopes.SINGLETON);
final Map<String, String> params = Maps.newHashMap();
params.put("com.sun.jersey.config.property.packages", "nl.tudelft.ewi.dea.jaxrs");
params.put(ServletContainer.PROPERTY_WEB_PAGE_CONTENT_REGEX, "/.*\\.(html|js|gif|png|jpg|jpeg|css|ico)");
filter("/*").through(GuiceContainer.class, params);
}
示例6: configureServlets
import com.google.inject.persist.PersistFilter; //导入依赖的package包/类
@Override
protected void configureServlets() {
install(new JpaPersistModule("transactions-optional"));
filterRegex("^/(?!_ah/(upload|admin)).*$").through(PersistFilter.class);
MethodInterceptor finderInterceptor = new JpaFinderProxy();
requestInjection(finderInterceptor);
bindInterceptor(Matchers.any(), Matchers.annotatedWith(Finder.class), finderInterceptor);
filter(ProxyFilter.PROXY_PATH + "*").through(ProxyFilter.class);
if (SystemProperty.environment.value() == SystemProperty.Environment.Value.Development) {
filter("/_ah/api/" + "*").through(LocalDevServerFilter.class);
}
Set<Class<?>> serviceClasses = new HashSet<Class<?>>();
serviceClasses.add(DeviceEndpoint.class);
serviceClasses.add(AccountEndpoint.class);
serviceClasses.add(PresenceEndpoint.class);
serviceClasses.add(AppEngineChannelService.class);
serviceClasses.add(GoogleCloudMessaging.class);
serviceClasses.add(ApplePushNotification.class);
this.serveGuiceSystemServiceServlet("/_ah/spi/*", serviceClasses);
}
示例7: getInjector
import com.google.inject.persist.PersistFilter; //导入依赖的package包/类
@Override
protected Injector getInjector() {
try {
injector = Guice.createInjector(new GeeMvcModule(), new GeeTicketModule(), new ServletModule() {
@Override
protected void configureServlets() {
install(new JpaPersistModule("geeticketPU"));
filter("/*").through(PersistFilter.class);
Map<String, String> params = new HashMap<String, String>();
params.put(Configuration.VIEW_PREFIX_KEY, "/jsp/pages");
params.put(Configuration.VIEW_SUFFIX_KEY, ".jsp");
params.put(Configuration.SUPPORTED_LOCALES_KEY, "en, de_DE, fr_FR, es_ES, ru_RU:UTF-8, ja_JP:Shift_JIS, zh:UTF-8");
params.put(Configuration.DEFAULT_CHARACTER_ENCODING_KEY, "UTF-8");
params.put(Configuration.DEFAULT_CONTENT_TYPE_KEY, "text/html");
serve("/geeticket/*").with(DispatcherServlet.class, params);
}
});
} catch (Throwable t) {
System.out.println("!! An error occured during initialization of the GeeticketGuiceServletContextListener.");
if (t instanceof com.google.inject.CreationException) {
System.out.println("It seems that Guice was not able to create the injector due to problems with unregistered or incorrectly registered classes. Please check the Guice errors below!");
}
t.printStackTrace();
}
return injector;
}
开发者ID:geetools,项目名称:geeMVC-Java-MVC-Framework,代码行数:34,代码来源:GeeticketGuiceServletContextListener.java
示例8: beforeEach
import com.google.inject.persist.PersistFilter; //导入依赖的package包/类
@Override
public void beforeEach(final ExtensionContext context) throws Exception {
final Injector injector = GuiceExtension.getInjector(context);
final PersistFilter filter = injector.getInstance(PersistFilter.class);
final Requestor requestor = injector.getInstance(Requestor.class);
requestor.addFilter(new ServletFilterAdapter(filter));
filter.init(null);
}
示例9: afterEach
import com.google.inject.persist.PersistFilter; //导入依赖的package包/类
@Override
public void afterEach(final ExtensionContext context) throws Exception {
final Injector injector = GuiceExtension.getInjector(context);
final PersistFilter filter = injector.getInstance(PersistFilter.class);
filter.destroy();
}
示例10: configureServlets
import com.google.inject.persist.PersistFilter; //导入依赖的package包/类
protected void configureServlets() {
h4Properties = new Properties();
String configFile = System.getProperty(FDC.DASH_H4_CONFIG_FILE);
logger.info("Building Persistence Manager - Servlet Persistence");
JpaPersistModule persistModule = new JpaPersistModule(FDC.H4_MANAGER);
persistModule.properties(ConfigUtil.loadConfig(h4Properties, configFile));
logger.info("Installing Persistence Manager for filter {}", FDC.PERSISTENCE_FILTER);
install(persistModule);
filter(FDC.PERSISTENCE_FILTER).through(PersistFilter.class);
}
示例11: bindDatabaseModule
import com.google.inject.persist.PersistFilter; //导入依赖的package包/类
private void bindDatabaseModule() {
install(new DbModule());
filter("/*").through(PersistFilter.class);
requireBinding(EntityManager.class);
requireBinding(EntityManagerFactory.class);
}
示例12: configureJetty
import com.google.inject.persist.PersistFilter; //导入依赖的package包/类
/**
* Function used to configure Jetty and return a Server instance.
* @param port the port to run Jetty on.
* @return the {@link Server} instance.
*/
protected Server configureJetty(final int port) {
final Server server = new Server();
final ServerConnector connector = new ServerConnector(server);
final ServletContextHandler sch = getServletContextHandler();
// TODO: make all of this configurable
connector.setIdleTimeout((int)TimeUnit.HOURS.toMillis(1));
connector.setSoLingerTime(-1);
connector.setPort(port);
server.addConnector(connector);
// set the injector as an attribute in the context
sch.setAttribute("guice-injector", getInjector());
// prevent the JSESSIONID from getting set via a URL argument
sch.setInitParameter("org.eclipse.jetty.servlet.SessionIdPathParameterName", "none");
// if we're using a database, then install the filter
if(!settings.getDatabaseSettings().getNotUsed()) {
// setup a FilterHolder for the Guice Persistence
final FilterHolder persistFilter = new FilterHolder(getInjector().getInstance(PersistFilter.class));
// add the filter to the context
sch.addFilter(persistFilter, "/*", DISPATCHER_TYPES);
}
// configure a FilterHolder for Guice
final FilterHolder filterHolder = new FilterHolder(GuiceFilter.class);
sch.addFilter(filterHolder, "/*", DISPATCHER_TYPES);
sch.addServlet(DefaultServlet.class, "/*");
//server.setDumpAfterStart(true);
server.setHandler(sch);
return server;
}
示例13: configureServlets
import com.google.inject.persist.PersistFilter; //导入依赖的package包/类
@Override
protected void configureServlets() {
// start the JPA service
bind(JPAInitializer.class).asEagerSingleton();
// PersistFilter
filter("/*").through(PersistFilter.class);
// jpa + guice
install(new JpaPersistModule("persistenceUnit")); // same as persistence.xml
// Guice bindings
bind(UserService.class).to(UserServiceImpl.class);
}
示例14: bindDatabaseModule
import com.google.inject.persist.PersistFilter; //导入依赖的package包/类
private void bindDatabaseModule() {
install(new DbModule());
filter("/*").through(PersistFilter.class);
requireBinding(EntityManager.class);
requireBinding(EntityManagerFactory.class);
}
示例15: configureJetty
import com.google.inject.persist.PersistFilter; //导入依赖的package包/类
/**
* Function used to configure Jetty and return a Server instance.
* @param port the port to run Jetty on.
* @return the {@link Server} instance.
*/
protected Server configureJetty(final int port) {
final Server server = new Server();
final ServerConnector connector = new ServerConnector(server);
// TODO: make all of this configurable
connector.setIdleTimeout((int)TimeUnit.HOURS.toMillis(1));
connector.setSoLingerTime(-1);
connector.setPort(port);
server.addConnector(connector);
// set the injector as an attribute in the context
sch.setAttribute("guice-injector", injector);
// prevent the JSESSIONID from getting set via a URL argument
sch.setInitParameter("org.eclipse.jetty.servlet.SessionIdPathParameterName", "none");
// add the font mime type by default
sch.getMimeTypes().addMimeMapping("woff", "application/x-font-woff");
// if we're using a database, then install the filter
if(!settings.getDatabaseSettings().getNotUsed()) {
// setup a FilterHolder for the Guice Persistence
final FilterHolder persistFilter = new FilterHolder(injector.getInstance(PersistFilter.class));
// add the filter to the context
sch.addFilter(persistFilter, "/*", DISPATCHER_TYPES);
}
// setup a FilterHolder for WebSockets
final FilterHolder webSocketFilter = new FilterHolder(Jetty9WebSocketFilter.class);
// set the app factor as the Guice Web App Factory
webSocketFilter.setInitParameter("applicationFactoryClassName", GuiceWebApplicationFactory.class.getName());
// tell the filter to use the injector in the context instead of making a new one
webSocketFilter.setInitParameter("injectorContextAttribute", "guice-injector");
// setup the filter mapping
webSocketFilter.setInitParameter(WicketFilter.FILTER_MAPPING_PARAM, "/*");
webSocketFilter.setInitParameter("configuration", "deployment");
// add the filter to the context
sch.addFilter(webSocketFilter, "/*", DISPATCHER_TYPES);
// add the default servlet as Guice & Wicket will take care of everything for us
sch.addServlet(DefaultServlet.class, "/*");
server.setHandler(sch);
return server;
}