org.apache.shiro.web.servlet
Class NameableFilter

java.lang.Object
  extended by org.apache.shiro.web.servlet.ServletContextSupport
      extended by org.apache.shiro.web.servlet.AbstractFilter
          extended by org.apache.shiro.web.servlet.NameableFilter
All Implemented Interfaces:
Filter, Nameable
Direct Known Subclasses:
OncePerRequestFilter

public abstract class NameableFilter
extends AbstractFilter
implements Nameable

Allows a filter to be named via JavaBeans-compatible getName()/setName(String) methods. If no name is specified, the name of the filter will default to the name given to it in web.xml (the FilterConfig's filterName).

Since:
1.0

Field Summary
 
Fields inherited from class org.apache.shiro.web.servlet.AbstractFilter
filterConfig
 
Constructor Summary
NameableFilter()
           
 
Method Summary
protected  String getName()
          Returns the filter's name.
 void setName(String name)
          Sets the filter's name.
protected  StringBuilder toStringBuilder()
          Returns a StringBuilder instance with the name, or if the name is null, just the super.toStringBuilder() instance.
 
Methods inherited from class org.apache.shiro.web.servlet.AbstractFilter
destroy, getFilterConfig, getInitParam, init, onFilterConfigSet, setFilterConfig
 
Methods inherited from class org.apache.shiro.web.servlet.ServletContextSupport
getContextAttribute, getContextInitParam, getServletContext, removeContextAttribute, setContextAttribute, setServletContext, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface javax.servlet.Filter
doFilter
 

Constructor Detail

NameableFilter

public NameableFilter()
Method Detail

getName

protected String getName()
Returns the filter's name.

Unless overridden by calling the setName(String) method, this value defaults to the filter name as specified by the servlet container at start-up:

 this.name = getFilterConfig().getName();

Returns:
the filter name, or null if none available
See Also:
GenericServlet.getServletName(), FilterConfig.getFilterName()

setName

public void setName(String name)
Sets the filter's name.

Unless overridden by calling this method, this value defaults to the filter name as specified by the servlet container at start-up:

 this.name = getFilterConfig().getName();

Specified by:
setName in interface Nameable
Parameters:
name - the name of the filter.

toStringBuilder

protected StringBuilder toStringBuilder()
Returns a StringBuilder instance with the name, or if the name is null, just the super.toStringBuilder() instance.

Overrides:
toStringBuilder in class ServletContextSupport
Returns:
a StringBuilder instance to use for appending String data that will eventually be returned from a toString() invocation.


Copyright © 2004-2016 The Apache Software Foundation. All Rights Reserved.