Spring Framework OncePerRequestFilter - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Spring Framework OncePerRequestFilter class.

This code example shows how to use the following methods:
		public String forward() { 
			return "forward:/persons"; 
		} 
	} 
 
	private class ContinueFilter extends OncePerRequestFilter { 
		@Override 
		protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, 
				FilterChain filterChain) throws ServletException, IOException { 
			filterChain.doFilter(request, response); 
		} 
	} 
 
} 
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
 * @see OpenPersistenceManagerInViewInterceptor 
 * @see org.springframework.orm.jdo.JdoTransactionManager 
 * @see org.springframework.orm.jdo.PersistenceManagerFactoryUtils#getPersistenceManager 
 * @see org.springframework.transaction.support.TransactionSynchronizationManager 
 */ 
public class OpenPersistenceManagerInViewFilter extends OncePerRequestFilter { 
 
	public static final String DEFAULT_PERSISTENCE_MANAGER_FACTORY_BEAN_NAME = "persistenceManagerFactory"; 
 
	private String persistenceManagerFactoryBeanName = DEFAULT_PERSISTENCE_MANAGER_FACTORY_BEAN_NAME; 
 
 
	/** 
	 * Set the bean name of the PersistenceManagerFactory to fetch from Spring's 
	 * root application context. Default is "persistenceManagerFactory". 
	 * @see #DEFAULT_PERSISTENCE_MANAGER_FACTORY_BEAN_NAME 
	 */ 
	public void setPersistenceManagerFactoryBeanName(String persistenceManagerFactoryBeanName) { 
		this.persistenceManagerFactoryBeanName = persistenceManagerFactoryBeanName; 
	} 
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
 * @see #setMultipartResolverBeanName 
 * @see #lookupMultipartResolver 
 * @see org.springframework.web.multipart.MultipartResolver 
 * @see org.springframework.web.servlet.DispatcherServlet 
 */ 
public class MultipartFilter extends OncePerRequestFilter { 
 
	public static final String DEFAULT_MULTIPART_RESOLVER_BEAN_NAME = "filterMultipartResolver"; 
 
	private final MultipartResolver defaultMultipartResolver = new StandardServletMultipartResolver(); 
 
	private String multipartResolverBeanName = DEFAULT_MULTIPART_RESOLVER_BEAN_NAME; 
 
 
	/** 
	 * Set the bean name of the MultipartResolver to fetch from Spring's 
	 * root application context. Default is "filterMultipartResolver". 
	 */ 
	public void setMultipartResolverBeanName(String multipartResolverBeanName) { 
		this.multipartResolverBeanName = multipartResolverBeanName; 
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
 * to populate the {@link SecurityContext} on the {@link Callable}. 
 * 
 * @author Rob Winch 
 * @see SecurityContextCallableProcessingInterceptor 
 */ 
public final class WebAsyncManagerIntegrationFilter extends OncePerRequestFilter { 
    private static final Object CALLABLE_INTERCEPTOR_KEY = new Object(); 
 
    @Override 
    protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) 
            throws ServletException, IOException { 
        WebAsyncManager asyncManager = WebAsyncUtils.getAsyncManager(request); 
 
        SecurityContextCallableProcessingInterceptor securityProcessingInterceptor = (SecurityContextCallableProcessingInterceptor) asyncManager.getCallableInterceptor(CALLABLE_INTERCEPTOR_KEY); 
        if (securityProcessingInterceptor == null) { 
            asyncManager.registerCallableInterceptor(CALLABLE_INTERCEPTOR_KEY, 
                    new SecurityContextCallableProcessingInterceptor()); 
        } 
 
        filterChain.doFilter(request, response); 
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:defaultIfEmpty, initFilterBean, randomAlphanumeric
        this.version = version; 
    } 
 
    @Override 
    protected void initFilterBean() throws ServletException { 
        version = defaultIfEmpty(version, randomAlphanumeric(7)); 
        super.initFilterBean(); 
    } 
 
    @Override 
    protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) 
            throws ServletException, IOException { 
 
        request.setAttribute("servletPath", request.getContextPath() + request.getServletPath()); 
        request.setAttribute("contextPath", request.getContextPath()); 
        request.setAttribute("version", version); 
        filterChain.doFilter(request, response); 
    } 
} 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
 
/** 
 * @author Jeff Fischer 
 */ 
@Component("blJSCompatibilityRequestFilter") 
public class JSCompatibilityRequestFilter extends OncePerRequestFilter { 
 
    @Override 
    protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain 
            filterChain) throws ServletException, IOException { 
        filterChain.doFilter(new JSCompatibilityRequestWrapper(request), response); 
    } 
 
} 
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
 
/** 
 * @author Jeff Fischer 
 */ 
@Component("blAdminSandBoxFilter") 
public class AdminSandBoxFilter extends OncePerRequestFilter { 
 
    private static final String SANDBOX_ADMIN_ID_VAR = "blAdminCurrentSandboxId"; 
    private static String SANDBOX_ID_VAR = "blSandboxId"; 
 
    @Resource(name="blSandBoxService") 
    protected SandBoxService sandBoxService; 
 
    @Resource(name="blAdminSecurityRemoteService") 
    protected SecurityVerifier adminRemoteSecurityService; 
 
    @Override 
    protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException { 
        // this filter is not currently wired in 
        HttpSession session = request.getSession(); 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
import java.util.Set; 
 
/** 
 * @author Jeff Fischer 
 */ 
public abstract class AbstractBroadleafAdminRequestFilter extends OncePerRequestFilter { 
 
    private final Log LOG = LogFactory.getLog(AbstractBroadleafAdminRequestFilter.class); 
 
    private Set<String> ignoreSuffixes; 
 
    @Value("${asset.server.url.prefix.internal}") 
    private String assetPrefix; 
 
    /** 
     * Determines if the passed in URL should be processed by the content management system. 
     * <p/> 
     * By default, this method returns false for any BLC-Admin URLs and service calls and for all 
     * common image/digital mime-types (as determined by an internal call to {@code getIgnoreSuffixes}. 
     * <p/> 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
import javax.servlet.http.HttpServletRequest; 
import javax.servlet.http.HttpServletResponse; 
 
import org.springframework.web.filter.OncePerRequestFilter; 
 
public class CorsFilter extends OncePerRequestFilter { 
 
    @Override 
    protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) 
                    throws ServletException, IOException { 
        response.addHeader("Access-Control-Allow-Origin", "*"); 
        if (request.getHeader("Access-Control-Request-Method") != null && "OPTIONS".equals(request.getMethod())) { 
            // CORS "pre-flight" request 
            response.addHeader("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE"); 
            response.addHeader("Access-Control-Allow-Headers", "Authorization"); 
            response.addHeader("Access-Control-Max-Age", "1728000"); 
        } else { 
            filterChain.doFilter(request, response); 
        } 
    } 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
import java.util.Map; 
 
/** 
 * Filter to wrap request with a request including user preferred locale. 
 */ 
public class LocaleFilter extends OncePerRequestFilter { 
 
    /** 
     * This method looks for a "locale" request parameter. If it finds one, it sets it as the preferred locale 
     * and also configures it to work with JSTL. 
     *  
     * @param request the current request 
     * @param response the current response 
     * @param chain the chain 
     * @throws IOException when something goes wrong 
     * @throws ServletException when a communication failure happens 
     */ 
    @SuppressWarnings("unchecked") 
    public void doFilterInternal(HttpServletRequest request, HttpServletResponse response, 
                                 FilterChain chain) 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java