TagLib documentation

org.alweb.doff.core
Class Filter

java.lang.Object
  extended by org.alweb.doff.util.error.ErrorContainer
      extended by org.alweb.doff.core.Service
          extended by org.alweb.doff.core.Filter
All Implemented Interfaces:
ErrorProducer
Direct Known Subclasses:
AbstractHttpAuthenticationFilter

public abstract class Filter
extends Service

Represents the superclass of all of your filters. Filters provides a way to run code before (or after) running controller's actions.

By default, filters are executed for all controllers. You can annotate your own filter thanks to OnlyFor and Exclude annotation in order to restrict or exclude filter execution on specific controllers.

By default, if current URL doesn't map any controller, filter is not executed. If you want to execute it, you must annotate with ExecuteIfNotFound annotation.

You can specify dependencies between your filters thanks to Depends annotation.

You need to call ExecutionChain.next() method in order to run the next Executable item.

You should better override Service.init() method instead of defining a constructor for your filters. But, if you really want to declare your own filters, you must at least provide a default constructor. This constructor can be private, protected or public.

Author:
Alexis Toulotte
See Also:
Controller

Field Summary
 
Fields inherited from class org.alweb.doff.core.Service
FRAGMENTS_EXTENSION, VIEWS_EXTENSION, VIEWS_PATH
 
Constructor Summary
Filter()
           
 
Method Summary
abstract  void execute(ExecutionChain chain)
          Executes this filter with an ExecutionChain as parameter.
 
Methods inherited from class org.alweb.doff.core.Service
addCookie, addCookie, addHeader, addHeader, disableBrowserCache, encodeRedirectURL, encodeRedirectURL, encodeURL, encodeURL, flash, forwardRequest, getAction, getCompleteURL, getCompleteURL, getContextPath, getCookie, getCookies, getErrors, getFileUpload, getHeader, getHeader, getHeaders, getHost, getLocale, getMethod, getOutputStream, getParam, getParamOrSessionAttr, getParamOrSessionAttr, getParams, getParams, getPathInfo, getPathInfoWithQueryString, getPathParam, getPathParam, getPort, getProtocol, getPublicURL, getQueryString, getRemoteAddress, getRequest, getRequestAttribute, getResponse, getResponseLocale, getServiceMapping, getServlet, getSession, getSessionAttribute, getSessionAttributeName, getUploadedFile, getUploadedFile, getUploadedFiles, getURL, getURL, getURL, getURL, getWriter, hasParam, init, isAjaxRequest, isHttpsRequest, isLocalRequest, paginate, paginate, paginate, paginate, print, println, redirect, redirect, redirect, redirect, redirectToPublic, removeCookie, removeCookies, removeSessionAttributes, renderFile, renderFile, renderFile, renderFile, renderFragment, renderFragment, renderFragment, renderFragment, renderStream, renderStream, renderView, renderView, renderView, renderView, responseContainsHeader, responseContainsHeader, sendError, sendError, sendError, sendNotFound, sendPermissionDenied, setContentType, setExpires, setHeader, setHeader, setLastModified, setLocale, setOutputFilename, setOutputFilename, setRequestAttribute, toString
 
Methods inherited from class org.alweb.doff.util.error.ErrorContainer
addError, addError, addErrors, addErrors, addErrors, clearErrors, isInErrorState
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Filter

public Filter()
Method Detail

execute

public abstract void execute(ExecutionChain chain)
Executes this filter with an ExecutionChain as parameter. Don't forget to call ExecutionChain.next() method in order to continue execution of the chain. If you want to stop execution of filters or action, you just need to don't call ExecutionChain.next().


TagLib documentation