本文整理了Java中org.glassfish.grizzly.servlet.WebappContext.addFilter()
方法的一些代码示例,展示了WebappContext.addFilter()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebappContext.addFilter()
方法的具体详情如下:
包路径:org.glassfish.grizzly.servlet.WebappContext
类名称:WebappContext
方法名:addFilter
[英]Adds the filter with the given name and class type to this servlet context.
The registered filter may be further configured via the returned FilterRegistration object.
If this WebappContext already contains a preliminary FilterRegistration for a filter with the given filterName, it will be completed (by assigning the name of the given filterClass to it) and returned.
[中]将具有给定名称和类类型的筛选器添加到此servlet上下文。
注册的过滤器可以通过返回的FilterRegistration对象进一步配置。
如果此WebappContext已包含具有给定filterName的筛选器的初步FilterRegistration,则将完成(通过为其指定给定filterClass的名称)并返回。
代码示例来源:origin: jersey/jersey
context.addFilter(filterDescriptor.getFilterName(), filterDescriptor.getFilterClass());
代码示例来源:origin: stackoverflow.com
WebappContext webappContext = new WebappContext("grizzly web context", "");
FilterRegistration testFilterReg = webappContext.addFilter("TestFilter", TestFilter.class);
testFilterReg.addMappingForUrlPatterns(EnumSet.allOf(DispatcherType.class), "/*");
ServletRegistration servletRegistration = webappContext.addServlet("Jersey", org.glassfish.jersey.servlet.ServletContainer.class);
servletRegistration.addMapping("/myapp/*");
servletRegistration.setInitParameter("jersey.config.server.provider.packages", "com.example");
HttpServer server = HttpServer.createSimpleServer();
webappContext.deploy(server);
server.start();
代码示例来源:origin: com.sun.jersey.jersey-test-framework/jersey-test-framework-grizzly2
context.addFilter(filterDescriptor.getFilterName(), filterDescriptor.getFilterClass());
代码示例来源:origin: org.glassfish.jersey.test-framework.providers/jersey-test-framework-provider-grizzly2
context.addFilter(filterDescriptor.getFilterName(), filterDescriptor.getFilterClass());
内容来源于网络,如有侵权,请联系作者删除!