FileDocCategorySizeDatePackage
ServletFilterMappingDescriptor.javaAPI DocGlassfish v2 API7128Fri May 04 22:31:24 BST 2007com.sun.enterprise.deployment

ServletFilterMappingDescriptor

public final class ServletFilterMappingDescriptor extends Descriptor implements com.sun.enterprise.deployment.web.ServletFilterMapping
Deployment object representing the servlet filter mapping spec
author
Martin D. Flynn

Fields Summary
public static final String
TARGET_TYPE_URLPATTERN
public static final String
TARGET_TYPE_SERVLET
public static final String
INCLUDE
public static final String
REQUEST
public static final String
FORWARD
private static Set
allowed_dispatchers
private String
targetType
target type ("URLPattern", "Servlet")
private String
target
the target URL or Servlet name
private Set
dispatchers
private List
servletNames
private List
urlPatterns
Constructors Summary
public ServletFilterMappingDescriptor()
generic constructor


       
      
	super(""/*name*/, ""/*description*/);
    
public ServletFilterMappingDescriptor(ServletFilterMappingDescriptor other)
copy constructor

        super(other);
        targetType = other.targetType;
        target = other.target;
        dispatchers = (other.dispatchers != null)? new HashSet(other.dispatchers) : null;
    
public ServletFilterMappingDescriptor(String dispName, String targetType, String target)
constructor specifying the name & target

        super(dispName, ""/*description*/);
        this.setTargetType(targetType);
        this.setTarget(target);
    
Methods Summary
public voidaddDispatcher(java.lang.String dispatcher)

        if (dispatchers == null) {
            dispatchers = new HashSet();
        }
        dispatchers.add(dispatcher);
    
public voidaddServletName(java.lang.String servletName)

        getServletNames().add(servletName);
    
public voidaddURLPattern(java.lang.String urlPattern)

        getURLPatterns().add(urlPattern);
    
public booleanequals(java.lang.Object obj)
compare equals

        if (obj instanceof ServletFilterMapping) {
            ServletFilterMapping o = (ServletFilterMapping) obj;
            if ( this.getName().equals(o.getName())
                    && this.getServletNames().equals(o.getServletNames())
                    && this.getURLPatterns().equals(o.getURLPatterns()) ) {
                return true;
            }
        }

        return false;
    
public static java.util.SetgetAllowedDispatchers()

        if (allowed_dispatchers == null) {
            allowed_dispatchers = new HashSet();
            allowed_dispatchers.add(INCLUDE);
            allowed_dispatchers.add(REQUEST);
            allowed_dispatchers.add(FORWARD);
        }
        return allowed_dispatchers;
    
public java.util.SetgetDispatchers()

        if (dispatchers == null) {
            dispatchers = new HashSet();
        }
        return dispatchers;
    
public java.util.ListgetServletNames()

        if (servletNames == null) {
            servletNames = new LinkedList<String>();
        }
        return servletNames;
    
public java.lang.StringgetTarget()
get the target name

        if (! getServletNames().isEmpty()) {
            Iterator i = servletNames.iterator();
            return (String) i.next();
        } else {
            Iterator i = urlPatterns.iterator();
            return (String) i.next();
        }
    
public java.lang.StringgetTargetType()
get the target type

        if (! getServletNames().isEmpty()) {
            return TARGET_TYPE_SERVLET;
        } else {
            return TARGET_TYPE_URLPATTERN;
        }
    
public java.util.ListgetURLPatterns()

        if (urlPatterns == null) {
            urlPatterns = new LinkedList<String>();
        }
        return urlPatterns;
    
public inthashCode()

        int result = 17;
        result = 37*result + getName().hashCode();
        result = 37*result + getServletNames().hashCode();
        result = 37*result + getURLPatterns().hashCode();
        return result;
    
public booleanisServletNameTarget()
'true' if Servlet target type

        return TARGET_TYPE_SERVLET.equals(getTargetType());
    
public booleanisURLPatternTarget()
'true' if URL-Pattern target type

        return TARGET_TYPE_URLPATTERN.equals(getTargetType());
    
public voidremoveDispatcher(java.lang.String dispatcher)

        if (dispatchers == null) {
            return;
        }
        dispatchers.remove(dispatcher);
    
public voidsetTarget(java.lang.String target)
set the target name

        this.target = target;
    
public voidsetTargetType(java.lang.String type)
set the target type

        if (TARGET_TYPE_SERVLET.equals(type)) {
            this.targetType = TARGET_TYPE_SERVLET;
        } else {
            this.targetType = TARGET_TYPE_URLPATTERN;
        }