src/main/java/de/qaware/xff/filter/OncePerRequestFilter.java
/**
     * This {@code doFilter} implementation stores a request attribute for
     * "already filtered", proceeding without filtering again if the
     * attribute is already there.
     *
     * @see #getAlreadyFilteredAttributeName
     * @see #shouldNotFilter
     * @see #doFilterInternal
     */
This  doFilter implementation stores a request attribute for
"already filtered", proceeding without filtering again if the
attribute is already there.


This doFilter implementation stores a request attribute for " already filtered " proceeding without filtering again if the attribute is already there .
@Override
    public final void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain)
            throws ServletException, IOException {
        if (!(request instanceof HttpServletRequest) || !(response instanceof HttpServletResponse)) {
            throw new ServletException("OncePerRequestFilter just supports HTTP requests");
        }
        HttpServletRequest httpRequest = (HttpServletRequest) request;
        HttpServletResponse httpResponse = (HttpServletResponse) response;
        String alreadyFilteredAttribute = getAlreadyFilteredAttributeName();
        boolean hasAlreadyFilteredAttribute = request.getAttribute(alreadyFilteredAttribute) != null;
        if (hasAlreadyFilteredAttribute || skipDispatch(httpRequest) || shouldNotFilter(httpRequest)) {
            filterChain.doFilter(request, response);
        } else {
            request.setAttribute(alreadyFilteredAttribute, Boolean.TRUE);
            try {
                doFilterInternal(httpRequest, httpResponse, filterChain);
            } finally {
                request.removeAttribute(alreadyFilteredAttribute);
            }
        }
    }
@ Override public final void doFilter ( ServletRequest request , ServletResponse response , FilterChain filterChain ) throws ServletException , IOException { if ( ! ( request instanceof HttpServletRequest ) || ! ( response instanceof HttpServletResponse ) ) { throw new ServletException ( "OncePerRequestFilter just supports HTTP requests" ) ; } HttpServletRequest httpRequest = ( HttpServletRequest ) request ; HttpServletResponse httpResponse = ( HttpServletResponse ) response ; String alreadyFilteredAttribute = getAlreadyFilteredAttributeName ( ) ; boolean hasAlreadyFilteredAttribute = request . getAttribute ( alreadyFilteredAttribute ) != null ; if ( hasAlreadyFilteredAttribute || skipDispatch ( httpRequest ) || shouldNotFilter ( httpRequest ) ) { filterChain . doFilter ( request , response ) ; } else { request . setAttribute ( alreadyFilteredAttribute , Boolean . TRUE ) ; try { doFilterInternal ( httpRequest , httpResponse , filterChain ) ; } finally { request . removeAttribute ( alreadyFilteredAttribute ) ; } } }
This {@code doFilter} implementation stores a request attribute for
 "already filtered", proceeding without filtering again if the
 attribute is already there.
This { @code doFilter } implementation stores a request attribute for " already filtered " proceeding without filtering again if the attribute is already there .
// Proceed without invoking this filter... // Do invoke this filter... // Remove the "already filtered" request attribute for this request.