Package org.apache.shiro.web.servlet
Class NameableFilter
- java.lang.Object
-
- org.apache.shiro.web.servlet.ServletContextSupport
-
- org.apache.shiro.web.servlet.AbstractFilter
-
- org.apache.shiro.web.servlet.NameableFilter
-
- Direct Known Subclasses:
OncePerRequestFilter
public abstract class NameableFilter extends AbstractFilter implements Nameable
Allows a filter to be named via JavaBeans-compatiblegetName()
/setName(String)
methods. If no name is specified, the name of the filter will default to the name given to it inweb.xml
(theFilterConfig
'sfilterName
).- Since:
- 1.0
-
-
Field Summary
-
Fields inherited from class org.apache.shiro.web.servlet.AbstractFilter
filterConfig
-
-
Constructor Summary
Constructors Constructor Description NameableFilter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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 thename
, or if the name isnull
, just thesuper.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
-
-
-
-
Constructor Detail
-
NameableFilter
public NameableFilter()
-
-
Method Detail
-
getName
protected String getName()
Returns the filter's name. Unless overridden by calling thesetName(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()
;
-
toStringBuilder
protected StringBuilder toStringBuilder()
Returns a StringBuilder instance with thename
, or if the name isnull
, just thesuper.toStringBuilder()
instance.- Overrides:
toStringBuilder
in classServletContextSupport
- Returns:
- a StringBuilder instance to use for appending String data that will eventually be returned from a
toString()
invocation.
-
-