当前位置: 首页>>代码示例>>Java>>正文


Java Servlets.filter方法代码示例

本文整理汇总了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;
}
 
开发者ID:stokesdrift,项目名称:stokesdrift,代码行数:16,代码来源:RackApplication.java

示例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();

}
 
开发者ID:stokesdrift,项目名称:stokesdrift,代码行数:25,代码来源:UndertowTest.java

示例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);
}
 
开发者ID:vvergnolle,项目名称:vas,代码行数:15,代码来源:HttpCacheHttpHandlerPostProcessorDescriptor.java


注:本文中的io.undertow.servlet.Servlets.filter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。