net.anotheria.maf
Class MAFFilter

java.lang.Object
  extended by net.anotheria.maf.MAFFilter
All Implemented Interfaces:
javax.servlet.Filter, net.anotheria.moskito.core.producers.IStatsProducer

public class MAFFilter
extends Object
implements javax.servlet.Filter, net.anotheria.moskito.core.producers.IStatsProducer

MAFFilter is the dispatcher filter of the MAF. We are using a Filter instead of Servlet to be able to inject MAF parts in huge we-map-everything-through-one-servlet systems (aka spring). In particular it is useful to inject moskito-webui which is maf-based into an existing spring application.

Author:
lrosenberg

Field Summary
 
Fields inherited from interface net.anotheria.moskito.core.producers.IStatsProducer
SUBSYSTEM_BUILTIN
 
Constructor Summary
MAFFilter()
           
 
Method Summary
 void destroy()
           
 void doFilter(javax.servlet.ServletRequest sreq, javax.servlet.ServletResponse sres, javax.servlet.FilterChain chain)
           
protected  ActionFactory getActionFactory()
           
 String getCategory()
           
protected  List<ActionMappingsConfigurator> getConfigurators()
          Overwrite this method and return configurators for your project.
protected  String getDefaultActionName()
          if not null an empty path is replaced by this default action name, for example 'index'.
protected  net.anotheria.moskito.core.stats.Interval[] getMonitoringIntervals()
          Override this method to setup custom monitoring intervals.
 String getProducerId()
           
 List<net.anotheria.moskito.core.producers.IStats> getStats()
           
 String getSubsystem()
           
 void init(javax.servlet.FilterConfig config)
           
protected  boolean isPathExcluded(String servletPath)
          Decides whether the servlet path is excluded from execution by this filter.
protected  boolean operationAllowed(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
          Override this operation to perform access control to moskitoUI.
protected  void setActionFactory(ActionFactory actionFactory)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MAFFilter

public MAFFilter()
Method Detail

destroy

public void destroy()
Specified by:
destroy in interface javax.servlet.Filter

init

public void init(javax.servlet.FilterConfig config)
          throws javax.servlet.ServletException
Specified by:
init in interface javax.servlet.Filter
Throws:
javax.servlet.ServletException

doFilter

public void doFilter(javax.servlet.ServletRequest sreq,
                     javax.servlet.ServletResponse sres,
                     javax.servlet.FilterChain chain)
              throws IOException,
                     javax.servlet.ServletException
Specified by:
doFilter in interface javax.servlet.Filter
Throws:
IOException
javax.servlet.ServletException

isPathExcluded

protected boolean isPathExcluded(String servletPath)
Decides whether the servlet path is excluded from execution by this filter. Derived class can customize filter chain traversal procedure by overriding this method.

Parameters:
servletPath - path to the servlet.
Returns:
true if can not be performed by this filter, false otherwise.

getStats

public List<net.anotheria.moskito.core.producers.IStats> getStats()
Specified by:
getStats in interface net.anotheria.moskito.core.producers.IStatsProducer

getMonitoringIntervals

protected net.anotheria.moskito.core.stats.Interval[] getMonitoringIntervals()
Override this method to setup custom monitoring intervals.

Returns:

operationAllowed

protected boolean operationAllowed(javax.servlet.http.HttpServletRequest req,
                                   javax.servlet.http.HttpServletResponse res)
Override this operation to perform access control to moskitoUI. Default is yes (true).

Parameters:
req - the HttpServletRequest
res - the HttpServletResponse
Returns:
true if the operation is allowed (post or get).

getProducerId

public String getProducerId()
Specified by:
getProducerId in interface net.anotheria.moskito.core.producers.IStatsProducer

getSubsystem

public String getSubsystem()
Specified by:
getSubsystem in interface net.anotheria.moskito.core.producers.IStatsProducer

getCategory

public String getCategory()
Specified by:
getCategory in interface net.anotheria.moskito.core.producers.IStatsProducer

getConfigurators

protected List<ActionMappingsConfigurator> getConfigurators()
Overwrite this method and return configurators for your project.

Returns:

getDefaultActionName

protected String getDefaultActionName()
if not null an empty path is replaced by this default action name, for example 'index'.

Returns:

getActionFactory

protected ActionFactory getActionFactory()

setActionFactory

protected void setActionFactory(ActionFactory actionFactory)


Copyright © 2010-2013 anotheria.net. All Rights Reserved.