org.ajax4jsf.webapp
Class BaseFilter

java.lang.Object
  extended by org.ajax4jsf.webapp.BaseFilter
All Implemented Interfaces:
javax.servlet.Filter
Direct Known Subclasses:
ConfigurableFilter, NekkoFilter, TidyFilter

public abstract class BaseFilter
extends java.lang.Object
implements javax.servlet.Filter

Base class for request processing filters, with convert Htmp content to XML for ajax requests, and serve request to application off-page resources

Version:
$Revision: 1.1.2.1 $ $Date: 2007/01/09 18:58:21 $
Author:
shura (latest modification by $Author: alexsmirnov $)

Field Summary
static java.lang.String ABSOLUTE_TAGS_PARAMETER
           
static java.lang.String AJAX_PUSH_KEY_HEADER
           
static java.lang.String AJAX_PUSH_READY
           
static java.lang.String AJAX_PUSH_STATUS_HEADER
           
static java.lang.String CACHEABLE_PREFIX
           
static java.lang.String DATA_PARAMETER
           
static boolean DEBUG
           
static java.lang.String DEFAULT_SERVLET_PATH
           
protected  PollEventsManager eventsManager
           
static java.lang.String FILE_UPLOAD_INDICATOR
          Request parameter name indicated that file was uploaded by RF component
static java.lang.String FILTER_PERFORMED
           
static java.lang.String MULTIPART
          Multipart request start
static java.lang.String PERCENT_BEAN_NAME
          Session bean name where progress bar's percent map will be stored
static java.lang.String RENDERER_PREFIX
           
static java.lang.String REQUESTS_SESSIONS_BEAN_NAME
          Session bean name where multipart requests map will be stored
protected  InternetResourceService resourceService
           
static java.lang.String RESPONSE_WRAPPER_ATTRIBUTE
           
static java.lang.String REWRITEID_PARAMETER
           
static java.lang.String SEND_HTTP_ERROR
          Request parameter that allow to send HTTP error instead of html message
static java.lang.String STYLESHEET_PARAMETER
           
static java.lang.String UPLOAD_FILES_ID
          Request parameter that indicates if multipart request forced by rich file upload component
static java.lang.String UPLOADED_COUNTER
          Session bean name to store max files count allowed to upload
protected  BaseXMLFilter xmlFilter
           
 
Constructor Summary
BaseFilter()
           
 
Method Summary
 void destroy()
          Destroy the filter.
 void doFilter(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.FilterChain chain)
          Execute the filter.
protected  java.lang.String getAttributesNames()
           
protected  java.lang.String getFunction()
           
protected  InternetResourceService getResourceService()
           
protected  void handleRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, javax.servlet.FilterChain chain)
           
 void init(javax.servlet.FilterConfig config)
          Initialize the filter.
protected  boolean isAjaxRequest(javax.servlet.ServletRequest request)
           
protected  boolean isRewriteid()
           
protected  void processUploadsAndHandleRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, javax.servlet.FilterChain chain)
          Method catches upload files request.
protected  void setAttributesNames(java.lang.String attributesNames)
           
protected  void setFunction(java.lang.String function)
           
protected  void setRewriteid(boolean rewriteid)
           
protected  void setupRequestEncoding(javax.servlet.http.HttpServletRequest httpServletRequest)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

AJAX_PUSH_READY

public static final java.lang.String AJAX_PUSH_READY
See Also:
Constant Field Values

AJAX_PUSH_STATUS_HEADER

public static final java.lang.String AJAX_PUSH_STATUS_HEADER
See Also:
Constant Field Values

AJAX_PUSH_KEY_HEADER

public static final java.lang.String AJAX_PUSH_KEY_HEADER
See Also:
Constant Field Values

DEBUG

public static final boolean DEBUG
See Also:
Constant Field Values

REWRITEID_PARAMETER

public static final java.lang.String REWRITEID_PARAMETER
See Also:
Constant Field Values

STYLESHEET_PARAMETER

public static final java.lang.String STYLESHEET_PARAMETER
See Also:
Constant Field Values

ABSOLUTE_TAGS_PARAMETER

public static final java.lang.String ABSOLUTE_TAGS_PARAMETER
See Also:
Constant Field Values

DATA_PARAMETER

public static final java.lang.String DATA_PARAMETER
See Also:
Constant Field Values

DEFAULT_SERVLET_PATH

public static final java.lang.String DEFAULT_SERVLET_PATH
See Also:
Constant Field Values

RENDERER_PREFIX

public static final java.lang.String RENDERER_PREFIX
See Also:
Constant Field Values

CACHEABLE_PREFIX

public static final java.lang.String CACHEABLE_PREFIX
See Also:
Constant Field Values

FILTER_PERFORMED

public static final java.lang.String FILTER_PERFORMED
See Also:
Constant Field Values

RESPONSE_WRAPPER_ATTRIBUTE

public static final java.lang.String RESPONSE_WRAPPER_ATTRIBUTE
See Also:
Constant Field Values

xmlFilter

protected BaseXMLFilter xmlFilter

resourceService

protected InternetResourceService resourceService

eventsManager

protected PollEventsManager eventsManager

MULTIPART

public static final java.lang.String MULTIPART
Multipart request start

See Also:
Constant Field Values

REQUESTS_SESSIONS_BEAN_NAME

public static final java.lang.String REQUESTS_SESSIONS_BEAN_NAME
Session bean name where multipart requests map will be stored

See Also:
Constant Field Values

PERCENT_BEAN_NAME

public static final java.lang.String PERCENT_BEAN_NAME
Session bean name where progress bar's percent map will be stored

See Also:
Constant Field Values

UPLOAD_FILES_ID

public static final java.lang.String UPLOAD_FILES_ID
Request parameter that indicates if multipart request forced by rich file upload component

See Also:
Constant Field Values

UPLOADED_COUNTER

public static final java.lang.String UPLOADED_COUNTER
Session bean name to store max files count allowed to upload

See Also:
Constant Field Values

FILE_UPLOAD_INDICATOR

public static final java.lang.String FILE_UPLOAD_INDICATOR
Request parameter name indicated that file was uploaded by RF component

See Also:
Constant Field Values

SEND_HTTP_ERROR

public static final java.lang.String SEND_HTTP_ERROR
Request parameter that allow to send HTTP error instead of html message

See Also:
Constant Field Values
Constructor Detail

BaseFilter

public BaseFilter()
Method Detail

init

public void init(javax.servlet.FilterConfig config)
          throws javax.servlet.ServletException
Initialize the filter.

Specified by:
init in interface javax.servlet.Filter
Throws:
javax.servlet.ServletException

handleRequest

protected void handleRequest(javax.servlet.http.HttpServletRequest request,
                             javax.servlet.http.HttpServletResponse response,
                             javax.servlet.FilterChain chain)
                      throws java.io.IOException,
                             javax.servlet.ServletException
Throws:
java.io.IOException
javax.servlet.ServletException

processUploadsAndHandleRequest

protected void processUploadsAndHandleRequest(javax.servlet.http.HttpServletRequest request,
                                              javax.servlet.http.HttpServletResponse response,
                                              javax.servlet.FilterChain chain)
                                       throws java.io.IOException,
                                              javax.servlet.ServletException
Method catches upload files request. Request parameter org.ajax4jsf.Filter.UPLOAD_FILES_ID indicates if request generated by rich-upload component. If it was detected custom parsing request should be done. Processing information about percent of completion and file size will be put into session scope.

Parameters:
request -
response -
Throws:
java.io.IOException
javax.servlet.ServletException

setupRequestEncoding

protected void setupRequestEncoding(javax.servlet.http.HttpServletRequest httpServletRequest)
                             throws java.io.UnsupportedEncodingException
Parameters:
httpServletRequest -
Throws:
java.io.UnsupportedEncodingException

doFilter

public void doFilter(javax.servlet.ServletRequest request,
                     javax.servlet.ServletResponse response,
                     javax.servlet.FilterChain chain)
              throws java.io.IOException,
                     javax.servlet.ServletException
Execute the filter.

Specified by:
doFilter in interface javax.servlet.Filter
Throws:
java.io.IOException
javax.servlet.ServletException

isAjaxRequest

protected boolean isAjaxRequest(javax.servlet.ServletRequest request)
Parameters:
request -
Returns:

destroy

public void destroy()
Destroy the filter.

Specified by:
destroy in interface javax.servlet.Filter

getResourceService

protected InternetResourceService getResourceService()
                                              throws javax.servlet.ServletException
Returns:
the resourceService
Throws:
javax.servlet.ServletException

setFunction

protected void setFunction(java.lang.String function)
Parameters:
function - The function to set.

getFunction

protected java.lang.String getFunction()
Returns:
Returns the function.

setRewriteid

protected void setRewriteid(boolean rewriteid)
Parameters:
rewriteid - The rewriteid to set.

isRewriteid

protected boolean isRewriteid()
Returns:
Returns the rewriteid.

setAttributesNames

protected void setAttributesNames(java.lang.String attributesNames)
Parameters:
attributesNames - The attributesNames to set.

getAttributesNames

protected java.lang.String getAttributesNames()
Returns:
Returns the attributesNames.


Copyright © 2009. All Rights Reserved.