org.norther.tammi.spray.protocol
Class DefaultHttpFilter

java.lang.Object
  extended by org.norther.tammi.core.base.Adaptee
      extended by org.norther.tammi.spray.filter.DefaultFilter
          extended by org.norther.tammi.spray.protocol.DefaultHttpFilter
All Implemented Interfaces:
Serializable, NotificationBroadcaster, NotificationEmitter, Filter, Manageable, MBeanDelegate, HttpFilter

public class DefaultHttpFilter
extends DefaultFilter
implements HttpFilter

A default implementation of HttpFilter.

Version:
$Id: DefaultHttpFilter.java,v 1.15 2010-05-11 04:40:27 cvsimp Exp $
Author:
Ilkka Priha
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.norther.tammi.spray.protocol.HttpFilter
HttpFilter.SessionIdPolicy
 
Field Summary
 
Fields inherited from class org.norther.tammi.core.base.Adaptee
ADAPTEE_NOTIF_DESCRIPTION, ADAPTEE_NOTIFICATIONS
 
Constructor Summary
DefaultHttpFilter()
          Constructs a new filter.
 
Method Summary
 void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
           
 String getCharacterEncoding()
          Gets the default character encoding for requests and responses if not explicitly specified.
 String getCharacterEncoding(Locale locale, ServletRequest request, ServletResponse response, FilterChain chain)
          Gets the default character encoding for a specific locale and request if not explicitly specified.
 String getContextPath()
          Gets the external context path.
 String getLoginCheck()
          Gets the check part of the path info of the login URL to apply.
 int getMaxRequestLength()
          Gets the maximum allowed length of the first line of the request.
 int getResponseBufferSize()
          Gets the response buffer size.
 HttpFilter.SessionIdPolicy getSessionIdPolicy()
          Gets the session id policy.
 boolean isAbsoluteURLLinks()
          Gets the absolute URL links option.
 boolean isFormDataParsed()
          Gets the form data to be parsed as parameters option.
 boolean isPathInfoParsed()
          Gets the path info to be parsed as parameters option.
 boolean isReverseProxyAccepted()
          Checks whether a reverse proxy is accepted.
 boolean isRoamingClientsPermitted()
          Checks whether roaming clients are permitted.
 void setAbsoluteURLLinks(boolean flag)
          Sets the absolute URL links option to use absolute links for local addresses also.
 void setCharacterEncoding(String encoding)
          Sets the default character encoding for requests and responses if not explicitly specified.
 void setContextPath(String path)
          Sets the external context path.
 void setFormDataParsed(boolean flag)
          Sets the form data to be parsed as parameters option.
 void setLoginCheck(String check)
          Sets the check part of the path info of the login URL to apply.
 void setMaxRequestLength(int length)
          Sets the maximum allowed length of the first line of the request.
 void setPathInfoParsed(boolean flag)
          Sets the path info to be parsed as parameters option.
 void setResponseBufferSize(int size)
          Sets the response buffer size.
 void setReverseProxyAccepted(boolean flag)
          Sets whether a reverse proxy is accepted.
 void setRoamingClientsPermitted(boolean flag)
          Sets whether roaming clients are permitted.
 void setSessionIdPolicy(HttpFilter.SessionIdPolicy policy)
          Sets the session id policy.
 
Methods inherited from class org.norther.tammi.spray.filter.DefaultFilter
destroy, getFilterConfig, getRequestMap, getSessionMap, init
 
Methods inherited from class org.norther.tammi.core.base.Adaptee
addAdaptee, addNotificationListener, getAttributeSupport, getBroker, getCanonicalName, getDomain, getFactory, getLoader, getLog, getLog, getMBean, getMBeanServer, getNotificationInfo, getObjectName, getRegistrationTime, getSequenceNumber, hasListeners, isRegistered, postmanaged, premanaged, removeNotificationListener, removeNotificationListener, sendNotification, sendNotification, sendNotification, sendNotification, unmanaged, unregister
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.servlet.Filter
destroy, init
 

Constructor Detail

DefaultHttpFilter

public DefaultHttpFilter()
Constructs a new filter.

Method Detail

getContextPath

public String getContextPath()
Description copied from interface: HttpFilter
Gets the external context path.

Specified by:
getContextPath in interface HttpFilter
Returns:
the context path.

setContextPath

public void setContextPath(String path)
Description copied from interface: HttpFilter
Sets the external context path.

The external context path may be applied in proxies and relays where the protocol filter can't parse the URI components correctly without hints.

Specified by:
setContextPath in interface HttpFilter
Parameters:
path - the context path.

isAbsoluteURLLinks

public boolean isAbsoluteURLLinks()
Description copied from interface: HttpFilter
Gets the absolute URL links option.

Specified by:
isAbsoluteURLLinks in interface HttpFilter
Returns:
the absolute URL links option.

setAbsoluteURLLinks

public void setAbsoluteURLLinks(boolean flag)
Description copied from interface: HttpFilter
Sets the absolute URL links option to use absolute links for local addresses also.

Specified by:
setAbsoluteURLLinks in interface HttpFilter
Parameters:
flag - the absolute URL links option.

isRoamingClientsPermitted

public boolean isRoamingClientsPermitted()
Description copied from interface: HttpFilter
Checks whether roaming clients are permitted.

Specified by:
isRoamingClientsPermitted in interface HttpFilter
Returns:
true if permitted, false otherwise.

setRoamingClientsPermitted

public void setRoamingClientsPermitted(boolean flag)
Description copied from interface: HttpFilter
Sets whether roaming clients are permitted.

Roaming clients may change their IP address without losing their session as long as the session id remains valid.

Specified by:
setRoamingClientsPermitted in interface HttpFilter
Parameters:
flag - true if permitted, false otherwise.

isReverseProxyAccepted

public boolean isReverseProxyAccepted()
Description copied from interface: HttpFilter
Checks whether a reverse proxy is accepted.

Specified by:
isReverseProxyAccepted in interface HttpFilter
Returns:
true if accepted, false otherwise.

setReverseProxyAccepted

public void setReverseProxyAccepted(boolean flag)
Description copied from interface: HttpFilter
Sets whether a reverse proxy is accepted.

A reverse proxy may encrypt TLS request and pass them unsecured to the back-end server.

Specified by:
setReverseProxyAccepted in interface HttpFilter
Parameters:
flag - true if accepted, false otherwise.

isPathInfoParsed

public boolean isPathInfoParsed()
Description copied from interface: HttpFilter
Gets the path info to be parsed as parameters option.

Specified by:
isPathInfoParsed in interface HttpFilter
Returns:
the path info parsed option.

setPathInfoParsed

public void setPathInfoParsed(boolean flag)
Description copied from interface: HttpFilter
Sets the path info to be parsed as parameters option.

Specified by:
setPathInfoParsed in interface HttpFilter
Parameters:
flag - the path info parsed option.

isFormDataParsed

public boolean isFormDataParsed()
Description copied from interface: HttpFilter
Gets the form data to be parsed as parameters option.

Specified by:
isFormDataParsed in interface HttpFilter
Returns:
the form data parsed option.

setFormDataParsed

public void setFormDataParsed(boolean flag)
Description copied from interface: HttpFilter
Sets the form data to be parsed as parameters option.

Specified by:
setFormDataParsed in interface HttpFilter
Parameters:
flag - the form data parsed option.

getMaxRequestLength

public int getMaxRequestLength()
Description copied from interface: HttpFilter
Gets the maximum allowed length of the first line of the request.

Specified by:
getMaxRequestLength in interface HttpFilter
Returns:
the maximum length of the request.

setMaxRequestLength

public void setMaxRequestLength(int length)
Description copied from interface: HttpFilter
Sets the maximum allowed length of the first line of the request. -1 is unlimited.

Specified by:
setMaxRequestLength in interface HttpFilter
Parameters:
length - the maximum length of the request.

getResponseBufferSize

public int getResponseBufferSize()
Description copied from interface: HttpFilter
Gets the response buffer size.

Specified by:
getResponseBufferSize in interface HttpFilter
Returns:
the buffer size in bytes.

setResponseBufferSize

public void setResponseBufferSize(int size)
Description copied from interface: HttpFilter
Sets the response buffer size. -1 uses the default.

Specified by:
setResponseBufferSize in interface HttpFilter
Parameters:
size - the response buffer size.

getLoginCheck

public String getLoginCheck()
Description copied from interface: HttpFilter
Gets the check part of the path info of the login URL to apply.

Specified by:
getLoginCheck in interface HttpFilter
Returns:
the login check or an empty string.

setLoginCheck

public void setLoginCheck(String check)
Description copied from interface: HttpFilter
Sets the check part of the path info of the login URL to apply.

Specified by:
setLoginCheck in interface HttpFilter
Parameters:
check - the login check.

getSessionIdPolicy

public HttpFilter.SessionIdPolicy getSessionIdPolicy()
Description copied from interface: HttpFilter
Gets the session id policy.

Specified by:
getSessionIdPolicy in interface HttpFilter
Returns:
the policy.

setSessionIdPolicy

public void setSessionIdPolicy(HttpFilter.SessionIdPolicy policy)
Description copied from interface: HttpFilter
Sets the session id policy.

Specified by:
setSessionIdPolicy in interface HttpFilter
Parameters:
policy - the policy.

getCharacterEncoding

public String getCharacterEncoding()
Description copied from interface: HttpFilter
Gets the default character encoding for requests and responses if not explicitly specified.

Specified by:
getCharacterEncoding in interface HttpFilter
Returns:
the default character encoding or null.

setCharacterEncoding

public void setCharacterEncoding(String encoding)
                          throws UnsupportedEncodingException
Description copied from interface: HttpFilter
Sets the default character encoding for requests and responses if not explicitly specified.

Specified by:
setCharacterEncoding in interface HttpFilter
Parameters:
encoding - the default character encoding.
Throws:
UnsupportedEncodingException - if not supported.

getCharacterEncoding

public String getCharacterEncoding(Locale locale,
                                   ServletRequest request,
                                   ServletResponse response,
                                   FilterChain chain)
Description copied from interface: HttpFilter
Gets the default character encoding for a specific locale and request if not explicitly specified.

Note that the default character encoding of this filter is returned if defined, otherwise one of the accepted charsets of the request corresponding to the specified locale.

Specified by:
getCharacterEncoding in interface HttpFilter
Parameters:
locale - the locale to apply.
request - the servlet request.
response - the servlet response.
chain - the filter chain.
Returns:
the locale specific character encoding.

doFilter

public void doFilter(ServletRequest request,
                     ServletResponse response,
                     FilterChain chain)
              throws ServletException,
                     IOException
Specified by:
doFilter in interface Filter
Overrides:
doFilter in class DefaultFilter
Throws:
ServletException
IOException


Copyright © 2004 The Norther Organization. All rights reserved.