Class NameableFilter

  • All Implemented Interfaces:
    javax.servlet.Filter, org.apache.shiro.util.Nameable
    Direct Known Subclasses:
    OncePerRequestFilter

    public abstract class NameableFilter
    extends AbstractFilter
    implements org.apache.shiro.util.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
    • 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 org.apache.shiro.util.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.