本文整理汇总了Java中io.undertow.servlet.Servlets.filter方法的典型用法代码示例。如果您正苦于以下问题:Java Servlets.filter方法的具体用法?Java Servlets.filter怎么用?Java Servlets.filter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.undertow.servlet.Servlets
的用法示例。
在下文中一共展示了Servlets.filter方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDeploymentInfo
import io.undertow.servlet.Servlets; //导入方法依赖的package包/类
@Override
public DeploymentInfo getDeploymentInfo() {
FilterInfo filter = Servlets.filter(RACK_FILTER, RackFilter.class);
// TODO extend listener and setup the jruby env based on reloaded gems
// and jars
// Override appfactory?
ListenerInfo listenerInfo = Servlets.listener(ServletContextListener.class);
DeploymentInfo di = new DeploymentInfo().addListener(listenerInfo).setContextPath(config.getRootUrlPath()).addFilter(filter)
.addFilterUrlMapping(RACK_FILTER, "/*", DispatcherType.REQUEST).setDeploymentName(config.getName())
.setClassLoader(ClassLoader.getSystemClassLoader());
setupInitParams(di);
return di;
}
示例2: testUndertowLoading
import io.undertow.servlet.Servlets; //导入方法依赖的package包/类
@Test
public void testUndertowLoading() throws Exception {
int port = 8888;
FilterInfo filter = Servlets.filter("RackFilter", RackFilter.class);
ListenerInfo listenerInfo = Servlets.listener(RackServletContextListener.class);
DeploymentInfo di = new DeploymentInfo()
.addListener(listenerInfo)
.setContextPath("/")
// .addInitParameter(name, value)
.addFilter(filter)
.addFilterUrlMapping("RackFilter", "/*", DispatcherType.ASYNC)
// .addServlet(servletInfo)
.setDeploymentName("RackServlet")
.setClassLoader(ClassLoader.getSystemClassLoader());
DeploymentManager deploymentManager = Servlets.defaultContainer().addDeployment(di);
deploymentManager.deploy();
Undertow server = Undertow.builder()
.addHttpListener(port, "localhost")
.setHandler(deploymentManager.start())
.build();
Assert.assertNotNull(server);
// server.start();
}
示例3: postProcess
import io.undertow.servlet.Servlets; //导入方法依赖的package包/类
@Override
public void postProcess(BootContext context) {
CachePolicy cachePolicy = new CachePolicy(context.properties());
if(!cachePolicy.enabled) {
return;
}
EtagCache etagCache = context.getService(EtagCache.class);
InstanceFactory<CacheFilter> instanceFactory = new ImmediateInstanceFactory<>(new CacheFilter(etagCache));
FilterInfo filterInfo = Servlets.filter(FILTER_NAME, CacheFilter.class, instanceFactory);
context.deploymentInfo().addFilter(filterInfo);
context.deploymentInfo().addFilterUrlMapping(FILTER_NAME, StationsAroundJaxrsDescriptor.MAPPING,
DispatcherType.REQUEST);
}