Example usage for javax.servlet FilterChain doFilter

List of usage examples for javax.servlet FilterChain doFilter

Introduction

In this page you can find the example usage for javax.servlet FilterChain doFilter.

Prototype

public void doFilter(ServletRequest request, ServletResponse response) throws IOException, ServletException;

Source Link

Document

Causes the next filter in the chain to be invoked, or if the calling filter is the last filter in the chain, causes the resource at the end of the chain to be invoked.

Usage

From source file:com.acc.filter.SessionAttributesFilter.java

@Override
protected void doFilterInternal(final HttpServletRequest request, final HttpServletResponse response,
        final FilterChain filterChain) throws ServletException, IOException {

    getContextInformationLoader().setLanguageFromRequest(request);
    getContextInformationLoader().setCurrencyFromRequest(request);
    filterChain.doFilter(request, response);
}

From source file:com.gopivotal.cla.security.AdminEmailDomainFilter.java

@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
        throws IOException, ServletException {
    if (!isValidAdminUser()) {
        throw new AccessDeniedException("Not a valid administrative user");
    }//from  w  ww .ja  v  a2s  .  co  m

    chain.doFilter(request, response);
}

From source file:com.graphaware.server.foundation.bootstrap.GraphAwareBootstrappingFilter.java

@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
        throws IOException, ServletException {
    chain.doFilter(request, response);
}

From source file:com.iterzp.momo.filter.SiteStatusFilter.java

@Override
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response,
        FilterChain filterChain) throws ServletException, IOException {
    Setting setting = SettingUtils.get();
    if (setting.getIsSiteEnabled()) {
        filterChain.doFilter(request, response);
    } else {//from  w  w w.  j  a  va2s.c  o m
        String path = request.getServletPath();
        if (path.equals(redirectUrl)) {
            filterChain.doFilter(request, response);
            return;
        }
        if (ignoreUrlPatterns != null) {
            for (String ignoreUrlPattern : ignoreUrlPatterns) {
                if (antPathMatcher.match(ignoreUrlPattern, path)) {
                    filterChain.doFilter(request, response);
                    return;
                }
            }
        }
        response.sendRedirect(request.getContextPath() + redirectUrl);
    }
}

From source file:org.kmnet.com.fw.web.exception.ExceptionLoggingFilter.java

/**
 * Executes next filter. logs exception if exception is occurred.
 * @param servletRequest {@link ServletRequest}
 * @param servletResponse {@link ServletResponse}
 * @param filterChain {@link FilterChain}
 * @see javax.servlet.Filter#doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse,
 *      javax.servlet.FilterChain)//  www .j  av  a 2s. c  o m
 */
@Override
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain)
        throws IOException, ServletException {
    try {
        filterChain.doFilter(servletRequest, servletResponse);
    } catch (IOException e) {
        logIOException(e, servletRequest, servletResponse);
        throw e;
    } catch (ServletException e) {
        logServletException(e, servletRequest, servletResponse);
        throw e;
    } catch (RuntimeException e) {
        logRuntimeException(e, servletRequest, servletResponse);
        throw e;
    }
}

From source file:com.gm.machine.filter.CurrentUrlFilter.java

/**
 * Filters requests to disable URL-based session identifiers.
 *///  w w  w . java2s .  c o  m
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
        throws IOException, ServletException {
    // skip non-http requests
    if (!(request instanceof HttpServletRequest)) {
        chain.doFilter(request, response);
        return;
    }

    HttpServletRequest httpRequest = (HttpServletRequest) request;
    HttpServletResponse httpResponse = (HttpServletResponse) response;

    //fromUrl???????
    String webUrl = RequestUtils.getAppURL(httpRequest);
    //System.out.println("weburl-------------------"+webUrl);
    String returnUrl = httpRequest.getParameter("returnurl");
    if (webUrl != null && StringUtils.isNotBlank(returnUrl)) {
        //System.out.println("returnurl-------------------"+returnUrl);
        httpRequest.getSession().setAttribute(CURREQUESTURL, returnUrl);
    } else {
        // set current request url into request as a attribute
        httpRequest.getSession().setAttribute(CURREQUESTURL, webUrl);
    }

    // process next request in chain
    chain.doFilter(request, httpResponse);
}

From source file:fr.gouv.culture.thesaurus.util.web.VocabularyAutoloadFilter.java

@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain)
        throws IOException, ServletException {
    // On ne fait rien de particulier
    filterChain.doFilter(request, response);
}

From source file:fi.hsl.parkandride.ApplicationVersionFilter.java

@Override
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain)
        throws IOException, ServletException {
    HttpServletResponse response = (HttpServletResponse) res;
    if (StringUtils.hasText(version)) {
        response.setHeader("Liipi-Version", version);
    }/*from   ww  w . j  a v  a 2  s  . c o  m*/
    chain.doFilter(req, res);
}

From source file:com.log4ic.compressor.cache.filter.BrowserCacheFilter.java

public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain)
        throws IOException, ServletException {
    HttpServletResponse response = (HttpServletResponse) servletResponse;
    response.setHeader("Cache-Control", "max-age=" + this.cacheTime);
    filterChain.doFilter(servletRequest, response);
}

From source file:com.jaspersoft.jasperserver.war.TolerantSessionFilter.java

@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
        throws IOException, ServletException {

    TolerantRequest req = new TolerantRequest((HttpServletRequest) request);
    HttpSession session = ((HttpServletRequest) req).getSession();

    chain.doFilter(req, response);

}