本文整理汇总了Java中io.undertow.servlet.api.FilterInfo类的典型用法代码示例。如果您正苦于以下问题:Java FilterInfo类的具体用法?Java FilterInfo怎么用?Java FilterInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FilterInfo类属于io.undertow.servlet.api包,在下文中一共展示了FilterInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addFilter
import io.undertow.servlet.api.FilterInfo; //导入依赖的package包/类
@Override
public FilterRegistration.Dynamic addFilter(final String filterName, final String className) {
ensureNotProgramaticListener();
ensureNotInitialized();
if (deploymentInfo.getFilters().containsKey(filterName)) {
return null;
}
try {
FilterInfo filter = new FilterInfo(filterName, (Class<? extends Filter>) deploymentInfo.getClassLoader().loadClass(className));
deploymentInfo.addFilter(filter);
deployment.getFilters().addFilter(filter);
return new FilterRegistrationImpl(filter, deployment, this);
} catch (ClassNotFoundException e) {
throw UndertowServletMessages.MESSAGES.cannotLoadClass(className, e);
}
}
示例2: configurePathInfoFilter
import io.undertow.servlet.api.FilterInfo; //导入依赖的package包/类
@SuppressWarnings({ "rawtypes", "unchecked" })
private void configurePathInfoFilter(DeploymentInfo servletBuilder) throws ClassNotFoundException, IOException {
if(serverOptions.isFilterPathInfoEnabled()) {
log.debug("enabling path_info filter");
Class regexPathInfoFilter;
try{
regexPathInfoFilter = _classLoader.loadClass("org.cfmlprojects.regexpathinfofilter.RegexPathInfoFilter");
} catch (java.lang.ClassNotFoundException e) {
regexPathInfoFilter = Server.class.getClassLoader().loadClass("org.cfmlprojects.regexpathinfofilter.RegexPathInfoFilter");
}
servletBuilder.addFilter(new FilterInfo("RegexPathInfoFilter", regexPathInfoFilter));
servletBuilder.addFilterUrlMapping("RegexPathInfoFilter", "/*", DispatcherType.REQUEST);
servletBuilder.addFilterUrlMapping("RegexPathInfoFilter", "/*", DispatcherType.FORWARD);
} else {
log.debug("path_info filter is disabled");
}
}
示例3: getDeploymentInfo
import io.undertow.servlet.api.FilterInfo; //导入依赖的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;
}
示例4: testUndertowLoading
import io.undertow.servlet.api.FilterInfo; //导入依赖的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();
}
示例5: handleDeployment
import io.undertow.servlet.api.FilterInfo; //导入依赖的package包/类
@Override
public void handleDeployment(DeploymentInfo deploymentInfo, ServletContext servletContext) {
if (!contextBlacklist.contains(deploymentInfo.getContextPath())) {
LOG.info("Adding metrics filter to deployment for context " + deploymentInfo.getContextPath());
FilterInfo metricsFilterInfo = new FilterInfo("metricsfilter", ServletMetricsFilter.class);
metricsFilterInfo.setAsyncSupported(true);
metricsFilterInfo.addInitParam(ServletMetricsFilter.BUCKET_CONFIG_PARAM,System.getProperty("prometheus.wildfly.filter.buckets",""));
deploymentInfo.addFilter(metricsFilterInfo);
deploymentInfo.addFilterUrlMapping("metricsfilter", "/*", DispatcherType.REQUEST);
} else {
LOG.info("Metrics filter not added to black listed context " + deploymentInfo.getContextPath());
LOG.info(contextBlacklist.toString());
}
}
示例6: getFilterRegistration
import io.undertow.servlet.api.FilterInfo; //导入依赖的package包/类
@Override
public FilterRegistration getFilterRegistration(final String filterName) {
ensureNotProgramaticListener();
final FilterInfo filterInfo = deploymentInfo.getFilters().get(filterName);
if (filterInfo == null) {
return null;
}
return new FilterRegistrationImpl(filterInfo, deployment, this);
}
示例7: getFilterRegistrations
import io.undertow.servlet.api.FilterInfo; //导入依赖的package包/类
@Override
public Map<String, ? extends FilterRegistration> getFilterRegistrations() {
ensureNotProgramaticListener();
final Map<String, FilterRegistration> ret = new HashMap<>();
for (Map.Entry<String, FilterInfo> entry : deploymentInfo.getFilters().entrySet()) {
ret.put(entry.getKey(), new FilterRegistrationImpl(entry.getValue(), deployment, this));
}
return ret;
}
示例8: LifecyleInterceptorInvocation
import io.undertow.servlet.api.FilterInfo; //导入依赖的package包/类
LifecyleInterceptorInvocation(List<LifecycleInterceptor> list, FilterInfo filterInfo, Filter filter, FilterConfig filterConfig) {
this.list = list;
this.servlet = null;
this.servletConfig = null;
this.filter = filter;
this.filterConfig = filterConfig;
this.filterInfo = filterInfo;
this.servletInfo = null;
i = list.size();
}
示例9: createServletsAndFilters
import io.undertow.servlet.api.FilterInfo; //导入依赖的package包/类
private void createServletsAndFilters(final DeploymentImpl deployment, final DeploymentInfo deploymentInfo) {
for (Map.Entry<String, ServletInfo> servlet : deploymentInfo.getServlets().entrySet()) {
deployment.getServlets().addServlet(servlet.getValue());
}
for (Map.Entry<String, FilterInfo> filter : deploymentInfo.getFilters().entrySet()) {
deployment.getFilters().addFilter(filter.getValue());
}
}
示例10: addFilter
import io.undertow.servlet.api.FilterInfo; //导入依赖的package包/类
public ManagedFilter addFilter(final FilterInfo filterInfo) {
ManagedFilter managedFilter = new ManagedFilter(filterInfo, deployment.getServletContext());
managedFilterMap.put(filterInfo.getName(),managedFilter);
deployment.addLifecycleObjects(managedFilter);
servletPathMatches.invalidate();
return managedFilter;
}
示例11: createFathomDeploymentManager
import io.undertow.servlet.api.FilterInfo; //导入依赖的package包/类
protected DeploymentManager createFathomDeploymentManager() throws ServletException {
DeploymentInfo info = Servlets.deployment();
info.setDeploymentName("Fathom");
info.setClassLoader(this.getClass().getClassLoader());
info.setContextPath(settings.getContextPath());
info.setIgnoreFlush(true);
info.setDefaultEncoding("UTF-8");
FilterInfo guiceFilter = new FilterInfo("GuiceFilter", GuiceFilter.class);
guiceFilter.setAsyncSupported(true);
info.addFilterUrlMapping("GuiceFilter", "/*", DispatcherType.REQUEST);
info.addFilters(guiceFilter);
ServletInfo defaultServlet = new ServletInfo("DefaultServlet", DefaultServlet.class);
defaultServlet.setAsyncSupported(true);
defaultServlet.addMapping("/");
ServletContextListener fathomListener = new ServletContextListener(settings);
info.addListeners(new ListenerInfo(ServletContextListener.class, new ImmediateInstanceFactory<>(fathomListener)));
MultipartConfigElement multipartConfig = new MultipartConfigElement(settings.getUploadFilesLocation(), settings.getUploadFilesMaxSize(), -1L, 0);
defaultServlet.setMultipartConfig(multipartConfig);
info.addServlets(defaultServlet);
DeploymentManager deploymentManager = Servlets.defaultContainer().addDeployment(info);
deploymentManager.deploy();
return deploymentManager;
}
示例12: postProcess
import io.undertow.servlet.api.FilterInfo; //导入依赖的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);
}
示例13: addPippoFilter
import io.undertow.servlet.api.FilterInfo; //导入依赖的package包/类
private void addPippoFilter(DeploymentInfo info) {
if (pippoFilterPath == null) {
pippoFilterPath = "/*"; // default value
}
info.addFilter(new FilterInfo("PippoFilter", PippoFilter.class, new ImmediateInstanceFactory<>(getPippoFilter())));
info.addFilterUrlMapping("PippoFilter", pippoFilterPath, DispatcherType.REQUEST);
log.debug("Using pippo filter for path '{}'", pippoFilterPath);
}
示例14: FilterConfigImpl
import io.undertow.servlet.api.FilterInfo; //导入依赖的package包/类
public FilterConfigImpl(final FilterInfo filterInfo, final ServletContext servletContext) {
this.filterInfo = filterInfo;
this.servletContext = servletContext;
}
示例15: FilterRegistrationImpl
import io.undertow.servlet.api.FilterInfo; //导入依赖的package包/类
public FilterRegistrationImpl(final FilterInfo filterInfo, final Deployment deployment, ServletContextImpl servletContext) {
this.filterInfo = filterInfo;
this.deployment = deployment;
this.servletContext = servletContext;
}