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:fi.hsl.parkandride.MDCFilter.java

@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
        throws IOException, ServletException {
    setValues(request);//ww  w.j a v a2  s. c o m
    try {
        chain.doFilter(request, response);
    } finally {
        unsetValues();
    }
}

From source file:com.amalto.core.servlet.TransactionsGuardFilter.java

@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
        throws IOException, ServletException {
    doCheck(Phase.BEFORE);/* w w  w.ja  v a 2s.c om*/
    chain.doFilter(request, response);
    doCheck(Phase.AFTER);
}

From source file:demo.SessionMDCFilter.java

@Override
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain)
        throws ServletException, IOException {
    try {//from w  w w.  j  a v  a 2 s . com
        configureMDC(request);
        chain.doFilter(request, response);
    } finally {
        MDC.remove(MDC_KEY);
    }
}

From source file:grails.plugins.jaxrs.web.JaxrsFilter.java

/**
 * Stores the request URI as request attribute.
 *
 * @see JaxrsUtils#REQUEST_URI_ATTRIBUTE_NAME
 *///from  w  w w .j  a  v  a2 s . c  o m
@Override
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain)
        throws ServletException, IOException {
    JaxrsUtils.setRequestUriAttribute(request, request.getRequestURI());
    chain.doFilter(request, response);
}

From source file:net.sourceforge.vulcan.web.PreferencesFilter.java

@Override
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain)
        throws ServletException, IOException {
    setupPreferences(request);/*from  w  ww. ja  v a 2s. c om*/

    chain.doFilter(request, response);
}

From source file:photogift.server.filter.AuthenticatedFilter.java

private void filter(FilterChain chain, HttpServletRequest request, HttpServletResponse response) {
    try {/*from  ww  w  . ja va 2 s . c o  m*/
        chain.doFilter(request, response);
    } catch (IOException e) {
        // Likely a temporary network error
        response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
    } catch (ServletException e) {
        // Something went wrong with Jetty serving requests.
        response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
    }
}

From source file:LogFilter.java

public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) {
    ServletContext context = getFilterConfig().getServletContext();
    long bef = System.currentTimeMillis();
    try {//from  ww w .  j av a2s  . co  m
        chain.doFilter(req, res);
    } catch (Exception e) {
    }
    long aft = System.currentTimeMillis();
    context.log("Request to " + req.getRemoteHost() + ": " + (aft - bef));
}

From source file:org.sakaiproject.scorm.ui.player.ScormSecurityFilter.java

public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
        throws IOException, ServletException {
    SecurityService.pushAdvisor(new ScormSecurityAdvisor());
    try {/*from   w  w w  .  j a  v  a 2 s  .  co  m*/
        chain.doFilter(request, response);
    } finally {
        SecurityService.popAdvisor();
    }
}

From source file:it.tidalwave.northernwind.frontend.util.NorthernWindResponseHeaderFilter.java

/*******************************************************************************************************************
 *
 * {@inheritDoc}/*from  w w  w . j  a v  a  2  s.  c  o m*/
 *
 ******************************************************************************************************************/
@Override
public void doFilter(final @Nonnull ServletRequest request, final @Nonnull ServletResponse response,
        final @Nonnull FilterChain chain) throws IOException, ServletException {
    addNorthernWindHeader(request, response);
    chain.doFilter(request, response);
}

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

/**
 * @see javax.servlet.Filter#doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse,
 * javax.servlet.FilterChain)/*from w  w  w  . j a  va  2 s  .c  o  m*/
 */
public void doFilter(ServletRequest req, ServletResponse resp, FilterChain filterChain)
        throws IOException, ServletException {
    this.setContentType(req, resp);
    filterChain.doFilter(req, resp);
}