FileDocCategorySizeDatePackage
CacheMapping.javaAPI DocGlassfish v2 API7645Fri May 04 22:35:28 BST 2007com.sun.appserv.web.cache.mapping

CacheMapping

public class CacheMapping extends Object
CacheMapping represents a cache target specified via servlet-name or a url-pattern, a timeout, allowed methods, a set of key fields to be used to construct the key into the cache, and a set of constraints on the field values.

Fields Summary
private String
helperNameRef
private String
servletName
private String
urlPattern
private int
timeout
private Field
timeoutField
private Field
refreshField
private String[]
methods
private Field[]
keyFields
private ConstraintField[]
constraintFields
Constructors Summary
public CacheMapping()
default cache mapping

 

            
      
    
Methods Summary
public voidaddConstraintField(ConstraintField field)
add a constraint key field

param
field ConstraintField to add

        if (field == null)
            return;

        ConstraintField results[] = 
                new ConstraintField[constraintFields.length + 1];

        for (int i = 0; i < constraintFields.length; i++)
            results[i] = constraintFields[i];
        results[constraintFields.length] = field;

        constraintFields = results;
    
public voidaddKeyField(Field field)
add a key field

param
field key Field to add

        if (field == null)
            return;

        Field results[] = new Field[keyFields.length + 1];
        for (int i = 0; i < keyFields.length; i++)
            results[i] = keyFields[i];
        results[keyFields.length] = field;

        keyFields = results;
    
public voidaddMethod(java.lang.String method)
add an allowable HTTP method

param
method allowable method

        if (method == null)
            return;

        String results[] = new String[methods.length + 1];
        for (int i = 0; i < methods.length; i++)
            results[i] = methods[i];
        results[methods.length] = method;

        methods = results;
    
public booleanfindMethod(java.lang.String method)
Return true if the specified HTTP request method is allowed for caching

param
method Request method to check

        if (methods.length == 0)
            return (true);
        for (int i = 0; i < methods.length; i++) {
             if (methods[i].equals(method))
             return (true);
        }
        return (false);
    
public ConstraintField[]getConstraintFields()
get the constraint fields

return
constraint fields configured

        return constraintFields;
    
public java.lang.StringgetHelperNameRef()
get helper-name-ref associated with this mapping

return
helper name associated

        return helperNameRef;
    
public Field[]getKeyFields()
get the key fields

return
key fields configured

        return keyFields;
    
public FieldgetRefreshField()
get the refresh field

return
Configured refresh field

        return refreshField;
    
public java.lang.StringgetServletName()
get the underlying servlet-name

return
servlet name

        return servletName;
    
public intgetTimeout()
get the timeout

return
timeout value configured

        return timeout;
    
public FieldgetTimeoutField()
get the timeout field

return
timeout field configured

        return timeoutField;
    
public java.lang.StringgetURLPattern()
get the underlying url-pattern this mapping applicable

return
url-pattern string configured

        return urlPattern;
    
public voidsetHelperNameRef(java.lang.String helperNameRef)
set the helper name ref associated with this cache mapping

param
helperNameRef helper name ref for this cache mapping

        this.helperNameRef = helperNameRef;
    
public voidsetMethods(java.lang.String[] methods)
set allowable HTTP methods

param
methods allowable methods

        if (methods == null)
            return;

        this.methods = methods; 
    
public voidsetRefreshField(Field field)
set the refresh field

param
field Boolean field for controlling when a refresh is needed

        this.refreshField = field;
    
public voidsetServletName(java.lang.String servletName)
set the servlet-name this mapping applies

param
servletName name of the servlet

        this.servletName = servletName;
    
public voidsetTimeout(int timeout)
set the timeout

param
timeout specific timeout of the cacheable entries

        this.timeout = timeout;
    
public voidsetTimeoutField(Field field)
set the timeout field

param
field default timeout of the cacheable entries

        this.timeoutField = field;
    
public voidsetURLPattern(java.lang.String urlPattern)
set the url-pattern this mapping applies

param
urlPattern url pattern this mapping applies

        this.urlPattern = urlPattern;