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:hudson.security.UnwrapSecurityExceptionFilter.java

public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
        throws IOException, ServletException {
    try {//from   ww w  . j av  a  2 s  .  com
        chain.doFilter(request, response);
    } catch (ServletException e) {
        Throwable t = e.getRootCause();
        if (t instanceof JellyTagException) {
            JellyTagException jte = (JellyTagException) t;
            Throwable cause = jte.getCause();
            if (cause instanceof AcegiSecurityException) {
                AcegiSecurityException se = (AcegiSecurityException) cause;
                throw new ServletException(se);
            }
        }
        throw e;
    }
}

From source file:ResponseTimerFilter.java

public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
        throws ServletException, IOException {
    long startTime = System.currentTimeMillis();
    chain.doFilter(request, response);
    long elapsed = System.currentTimeMillis() - startTime;
    String name = "servlet";
    if (request instanceof HttpServletRequest) {
        name = ((HttpServletRequest) request).getRequestURI();
    }//from  ww  w.ja va2s.  com

    config.getServletContext().log(name + " took " + elapsed + " ms");
}

From source file:com.github.inspektr.error.web.ErrorLoggingFilter.java

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

    try {/*  www  .j ava2  s.  co  m*/
        filterChain.doFilter(request, response);
    } catch (final ServletException e) {
        this.errorLogManager.recordError(e);
        throw e;
    } catch (final IOException e) {
        this.errorLogManager.recordError(e);
        throw e;
    } catch (final Throwable t) {
        this.errorLogManager.recordError(t);
        throw new ServletException(t);
    }
}

From source file:web.logging.LoggingFilter.java

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

    LoggingContext.setContextId();/*from   w  ww  . ja v  a  2s  .  co m*/
    try {
        filterChain.doFilter(request, response);
    } finally {
        LoggingContext.removeContextId();
    }
}

From source file:org.craftercms.engine.servlet.filter.ExceptionHandlingFilter.java

@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
        throws IOException, ServletException {
    try {//from   w w w .ja  v  a2 s .  c o  m
        chain.doFilter(request, response);
    } catch (Exception e) {
        handleException((HttpServletRequest) request, (HttpServletResponse) response, e);
    }
}

From source file:com.netspective.sparx.security.EncryptedParametersFilter.java

public void doFilter(final ServletRequest request, final ServletResponse response, FilterChain chain)
        throws java.io.IOException, javax.servlet.ServletException {
    chain.doFilter(new EncryptedParametersRequestWrapper((HttpServletRequest) request, getUserKey(request)),
            response);//  w  w  w.jav  a2s. c  om
}

From source file:de.itsvs.cwtrpc.controller.UnexpectedErrorFilter.java

public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
        throws IOException, ServletException {
    try {/*from  w  w  w  . j a v a  2 s .  com*/
        chain.doFilter(request, response);
    } catch (IOException e) {
        throw e;
    } catch (Throwable e) {
        processUnexpectedFailure((HttpServletRequest) request, (HttpServletResponse) response, e);
    }
}

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

@Override
protected void doFilterInternal(final HttpServletRequest request, final HttpServletResponse response,
        final FilterChain filterChain) throws ServletException, IOException {
    processRequest(request);//from  www  .  jav a2s.co  m
    filterChain.doFilter(request, response);
}

From source file:org.ujorm.orm.support.OpenSessionInViewFilter.java

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

    ujoSessionFactoryFilter.openSession();
    chain.doFilter(request, response);
    ujoSessionFactoryFilter.closeSession();
}

From source file:info.magnolia.cms.filters.CompositeFilter.java

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

    FilterChain fullchain = new MgnlFilterChain(chain, filters);

    fullchain.doFilter(request, response);
}