org.norther.tammi.spray.filter.chain
Interface HttpFilterChain

All Superinterfaces:
FilterChain
All Known Implementing Classes:
ChainTool, DefaultFilterChain

public interface HttpFilterChain
extends FilterChain

HttpFilterChain extends javax.servlet.FilterChain by providing more information about the chain of filters invoked for a filtered request of a resource.

Version:
$Id: HttpFilterChain.java,v 1.19 2010-03-22 17:19:16 cvsimp Exp $
Author:
Ilkka Priha

Method Summary
 void clearErrors()
          Clears throwables from the error stack.
 boolean containsErrors()
          Checks whether the error stack contains errors.
 void doFilter(ServletRequest request, ServletResponse response)
          Passes the request and response to the next filter.
 void doFilter(ServletRequest request, ServletResponse response, Filter filter)
          Invokes the specified filter.
 void doFilter(ServletRequest request, ServletResponse response, FilterReference<?>[] filters)
          Invokes the first filter in a list of filter handles and continues with the rest as long as the preceding filter passes the request forward.
 Filter getCurrentFilter()
          Gets the current filter of this chain.
 Pipe getCurrentPipe()
          Gets the current pipe of this chain.
 List<Throwable> getErrors()
          Gets a list of all throwables in the error stack.
 MBeanServer getMBeanServer()
          Gets the MBean server.
<F extends Filter>
F
getNearestFilter(Class<F> clazz)
          Gets the nearest registered filter of the specified class from the filter stack of this chain.
<F extends Filter>
F
getNextFilter(Class<F> clazz)
          Gets the next registered filter of the specified class in the current pipe to be activated after the current one.
<F extends Filter>
F
getPreviousFilter(Class<F> clazz)
          Gets the previous registered filter of the specified class activated before the current one from the filter stack of this chain.
 List<Filter> getPreviousFilters()
          Gets a list of all filters activated before the current one from the filter stack of this chain.
 ServletRequest getRequest()
          Gets the active request.
 ServletResponse getResponse()
          Gets the active response.
 boolean isInvalidatedSession()
          Checks whether the active session is invalidated.
 Throwable popError()
          Pops a throwable from the error stack.
 void pushError(Throwable error)
          Pushes a throwable to the error stack without throwing one.
 void setInvalidatedSession(boolean flag)
          Sets whether the active session is invalidated.
 void terminate()
          Terminates the filter chain.
 

Method Detail

getRequest

ServletRequest getRequest()
Gets the active request.

Returns:
the request or null.

getResponse

ServletResponse getResponse()
Gets the active response.

Returns:
the response or null.

isInvalidatedSession

boolean isInvalidatedSession()
Checks whether the active session is invalidated.

Returns:
true if invalidated, false otherwise.

setInvalidatedSession

void setInvalidatedSession(boolean flag)
Sets whether the active session is invalidated.

Parameters:
flag - true if invalidated, false otherwise.

getCurrentPipe

Pipe getCurrentPipe()
Gets the current pipe of this chain.

Returns:
the current pipe or null.

getCurrentFilter

Filter getCurrentFilter()
Gets the current filter of this chain.

Returns:
the current filter or null.

getPreviousFilter

<F extends Filter> F getPreviousFilter(Class<F> clazz)
Gets the previous registered filter of the specified class activated before the current one from the filter stack of this chain. The current filter is included in the search.

Type Parameters:
F - the filter type.
Parameters:
clazz - the class or interface of the filter.
Returns:
the previous filter or null.

getPreviousFilters

List<Filter> getPreviousFilters()
Gets a list of all filters activated before the current one from the filter stack of this chain. The current filter is included in the list.

Returns:
an unmodiafiable list of activated filters.

getNextFilter

<F extends Filter> F getNextFilter(Class<F> clazz)
Gets the next registered filter of the specified class in the current pipe to be activated after the current one. The current filter is not included in the search.

Type Parameters:
F - the filter type.
Parameters:
clazz - the class or interface of the filter.
Returns:
the next filter or null.

getNearestFilter

<F extends Filter> F getNearestFilter(Class<F> clazz)
Gets the nearest registered filter of the specified class from the filter stack of this chain. The non-activated filters in the current pipe are included in the search if the filter is not in the filter stack.

Type Parameters:
F - the filter type.
Parameters:
clazz - the class or interface of the filter.
Returns:
the nearest filter or null.

getMBeanServer

MBeanServer getMBeanServer()
Gets the MBean server.

Returns:
the MBean server or null.

getErrors

List<Throwable> getErrors()
Gets a list of all throwables in the error stack.

Returns:
an unmodifiable list of throwables.

pushError

void pushError(Throwable error)
Pushes a throwable to the error stack without throwing one.

Parameters:
error - the throwable.

popError

Throwable popError()
Pops a throwable from the error stack.

Returns:
the thowable or null.

containsErrors

boolean containsErrors()
Checks whether the error stack contains errors.

Returns:
true if the error stack is not empty.

clearErrors

void clearErrors()
Clears throwables from the error stack.


doFilter

void doFilter(ServletRequest request,
              ServletResponse response)
              throws ServletException,
                     IOException
Passes the request and response to the next filter.

Specified by:
doFilter in interface FilterChain
Parameters:
request - the request to pass along in the chain.
response - the response to pass along in the chain.
Throws:
ServletException - for servlet errors.
IOException - for general errors.

doFilter

void doFilter(ServletRequest request,
              ServletResponse response,
              Filter filter)
              throws ServletException,
                     IOException
Invokes the specified filter.

Parameters:
request - the request to pass along in the chain.
response - the response to pass along in the chain.
filter - the filter to invoke.
Throws:
ServletException - for servlet errors.
IOException - for general errors.

doFilter

void doFilter(ServletRequest request,
              ServletResponse response,
              FilterReference<?>[] filters)
              throws ServletException,
                     IOException
Invokes the first filter in a list of filter handles and continues with the rest as long as the preceding filter passes the request forward.

Parameters:
request - the request to pass along in the chain.
response - the response to pass along in the chain.
filters - an array of filter references.
Throws:
ServletException - for servlet errors.
IOException - for general errors.

terminate

void terminate()
Terminates the filter chain.



Copyright © 2004 The Norther Organization. All rights reserved.