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


Java Dynamic.setAsyncSupported方法代码示例

本文整理汇总了Java中javax.servlet.FilterRegistration.Dynamic.setAsyncSupported方法的典型用法代码示例。如果您正苦于以下问题:Java Dynamic.setAsyncSupported方法的具体用法?Java Dynamic.setAsyncSupported怎么用?Java Dynamic.setAsyncSupported使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.servlet.FilterRegistration.Dynamic的用法示例。


在下文中一共展示了Dynamic.setAsyncSupported方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onStartup

import javax.servlet.FilterRegistration.Dynamic; //导入方法依赖的package包/类
@Override
  public void onStartup(ServletContext servletContext) throws ServletException {
Dynamic fr = servletContext.addFilter("org.springframework.security.web.access.intercept.FilterSecurityInterceptor#0", EmptyFilter.class);
if(fr!=null){
	fr.addMappingForUrlPatterns(EnumSet.of(DispatcherType.REQUEST, DispatcherType.FORWARD), true, "/fuckSpringBootFilterSecurityInterceptor");
	fr.setAsyncSupported(true);
}

fr = servletContext.addFilter("org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter#0", EmptyFilter.class);
if(fr!=null){
	fr.addMappingForUrlPatterns(EnumSet.of(DispatcherType.REQUEST, DispatcherType.FORWARD), true, "/fuckSpringBootFilterSecurityInterceptor");
	fr.setAsyncSupported(true);
}

fr = servletContext.addFilter("casFilter", EmptyFilter.class);
if(fr!=null){
	fr.addMappingForUrlPatterns(EnumSet.of(DispatcherType.REQUEST, DispatcherType.FORWARD), true, "/fuckSpringBootFilterSecurityInterceptor");
	fr.setAsyncSupported(true);
}
  }
 
开发者ID:wayshall,项目名称:onetwo,代码行数:21,代码来源:FixSecurityFilterBugServletContextInitializer.java

示例2: registerServletFilter

import javax.servlet.FilterRegistration.Dynamic; //导入方法依赖的package包/类
/**
 * Add the given filter to the ServletContext and map it to the
 * {@code DispatcherServlet} as follows:
 * <ul>
 * <li>a default filter name is chosen based on its concrete type
 * <li>the {@code asyncSupported} flag is set depending on the
 * return value of {@link #isAsyncSupported() asyncSupported}
 * <li>a filter mapping is created with dispatcher types {@code REQUEST},
 * {@code FORWARD}, {@code INCLUDE}, and conditionally {@code ASYNC} depending
 * on the return value of {@link #isAsyncSupported() asyncSupported}
 * </ul>
 * <p>If the above defaults are not suitable or insufficient, override this
 * method and register filters directly with the {@code ServletContext}.
 * @param servletContext the servlet context to register filters with
 * @param filter the filter to be registered
 * @return the filter registration
 */
protected FilterRegistration.Dynamic registerServletFilter(ServletContext servletContext, Filter filter) {
	String filterName = Conventions.getVariableName(filter);
	Dynamic registration = servletContext.addFilter(filterName, filter);
	if (registration == null) {
		int counter = -1;
		while (counter == -1 || registration == null) {
			counter++;
			registration = servletContext.addFilter(filterName + "#" + counter, filter);
			Assert.isTrue(counter < 100,
					"Failed to register filter '" + filter + "'." +
					"Could the same Filter instance have been registered already?");
		}
	}
	registration.setAsyncSupported(isAsyncSupported());
	registration.addMappingForServletNames(getDispatcherTypes(), false, getServletName());
	return registration;
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:35,代码来源:AbstractDispatcherServletInitializer.java

示例3: onStartup

import javax.servlet.FilterRegistration.Dynamic; //导入方法依赖的package包/类
@Override
public void onStartup(ServletContext servletContext) throws ServletException {
    super.onStartup(servletContext);

    Thread.setDefaultUncaughtExceptionHandler(new DefaultExceptionHandler());

    configureSessionCookie(servletContext);
    
    CharacterEncodingFilter cef = new CharacterEncodingFilter();
    cef.setEncoding("UTF-8");
    cef.setForceEncoding(true);
    
    Dynamic characterEncodingFilter = servletContext.addFilter("CharacterEncodingFilter", cef);
    characterEncodingFilter.setAsyncSupported(true);
    characterEncodingFilter.addMappingForUrlPatterns(null, false, "/*");

    //force log initialization, then disable it
    XRLog.setLevel(XRLog.EXCEPTION, Level.WARNING);
    XRLog.setLoggingEnabled(false);

}
 
开发者ID:alfio-event,项目名称:alf.io,代码行数:22,代码来源:Initializer.java

示例4: registerFilter

import javax.servlet.FilterRegistration.Dynamic; //导入方法依赖的package包/类
/**
 * Registers the provided filter using the {@link #isAsyncSessionSupported()} and
 * {@link #getSessionDispatcherTypes()}.
 *
 * @param servletContext the servlet context
 * @param insertBeforeOtherFilters should this Filter be inserted before or after
 * other {@link Filter}
 * @param filterName the filter name
 * @param filter the filter
 */
private void registerFilter(ServletContext servletContext,
		boolean insertBeforeOtherFilters, String filterName, Filter filter) {
	Dynamic registration = servletContext.addFilter(filterName, filter);
	if (registration == null) {
		throw new IllegalStateException(
				"Duplicate Filter registration for '" + filterName
						+ "'. Check to ensure the Filter is only configured once.");
	}
	registration.setAsyncSupported(isAsyncSessionSupported());
	EnumSet<DispatcherType> dispatcherTypes = getSessionDispatcherTypes();
	registration.addMappingForUrlPatterns(dispatcherTypes, !insertBeforeOtherFilters,
			"/*");
}
 
开发者ID:spring-projects,项目名称:spring-session,代码行数:24,代码来源:AbstractHttpSessionApplicationInitializer.java

示例5: registerServletFilter

import javax.servlet.FilterRegistration.Dynamic; //导入方法依赖的package包/类
/**
 * Add the given filter to the ServletContext and map it to the
 * {@code DispatcherServlet} as follows:
 * <ul>
 * <li>a default filter name is chosen based on its concrete type
 * <li>the {@code asyncSupported} flag is set depending on the
 * return value of {@link #isAsyncSupported() asyncSupported}
 * <li>a filter mapping is created with dispatcher types {@code REQUEST},
 * {@code FORWARD}, {@code INCLUDE}, and conditionally {@code ASYNC} depending
 * on the return value of {@link #isAsyncSupported() asyncSupported}
 * </ul>
 * <p>If the above defaults are not suitable or insufficient, override this
 * method and register filters directly with the {@code ServletContext}.
 * @param servletContext the servlet context to register filters with
 * @param filter the filter to be registered
 * @return the filter registration
 */
protected FilterRegistration.Dynamic registerServletFilter(ServletContext servletContext, Filter filter) {
	String filterName = Conventions.getVariableName(filter);
	Dynamic registration = servletContext.addFilter(filterName, filter);
	registration.setAsyncSupported(isAsyncSupported());
	registration.addMappingForServletNames(getDispatcherTypes(), false, getServletName());
	return registration;
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:25,代码来源:AbstractDispatcherServletInitializer.java


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