All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class w3c.jigsaw.resources.HTTPResource

java.lang.Object
   |
   +----w3c.tools.store.AttributeHolder
           |
           +----w3c.tools.store.Resource
                   |
                   +----w3c.jigsaw.resources.HTTPResource

public class HTTPResource
extends Resource
The basic HTTP resource. Defines a bunch of attributes for all HTTP resources, and all the HTTP method that provides access to them.


Variable Index

 o _allowed
 o allowed
 o ATTR_CONTENT_ENCODING
Attribute index - The index for the content encodings attribute.
 o ATTR_CONTENT_LANGUAGE
Attribute index - The index for the content languages attribute.
 o ATTR_CONTENT_LENGTH
Attribute index - The index for the content length attribute.
 o ATTR_CONTENT_TYPE
Attribute index - The index for the content type attribute.
 o ATTR_CONTEXT
Attribute index - The hierarchical context of the resource.
 o ATTR_ICON
Attribute index - The icon (if any) associated to the resource.
 o ATTR_LAST_MODIFIED
Attribute index - The index for the last-modified attribute.
 o ATTR_MAXAGE
Attribute index - Max age: the maximum drift allowed from reality.
 o ATTR_OID
Attribute index - The object identifier.
 o ATTR_PARENT
Attribute index - The index for our parent attribute.
 o ATTR_QUALITY
Attributes index - The index for the quality attribute.
 o ATTR_TITLE
Attribute index - The index for the title attribute.
 o ATTR_URL
Attribute index - The index for our URL attribute.
 o COND_FAILED
Condition check return code - Condition existed but failed.
 o COND_OK
Condition check return code - Condition existed and succeeded.

Constructor Index

 o HTTPResource()

Method Index

 o checkIfMatch(Request)
Check the If-Match condition of that request.
 o checkIfModifiedSince(Request)
Check the If-Modified-Since condition of that request.
 o checkIfNoneMatch(Request)
Check the If-None-Match condition of that request.
 o checkIfUnmodifiedSince(Request)
Check the If-Unmodified-Since condition of that request.
 o createDefaultReply(Request, int)
Create a reply to answer to request on this file.
 o delete()
Delete this resource and notifies its container.
 o delete(Request)
The default DELETE method replies with a not implemented.
 o extended(Request)
The handler for unknown method replies with a not implemented.
 o get(Request)
The default GET method replies with a not implemented.
 o getContentEncoding()
Get this resource content encoding.
 o getContentLanguage()
Get this resource content language.
 o getContentLength()
Get this resource content length.
 o getContentType()
Get this resource content type.
 o getContext()
Get the hierarchical context for that resource.
 o getHelpURL()
Get this resource's help url.
 o getHelpURL(String)
Get the help URL for that resource's attribute.
 o getIcon()
Get this resource's icon.
 o getLastModified()
Get this resource last modification time.
 o getMaxAge()
Get this resource's max age.
 o getOid()
Get this resource's object identifier.
 o getParent()
Get this resource parent resource.
 o getQuality()
Get this resource quality.
 o getServer()
Get the server this resource is served by.
 o getTitle()
Get this resource title.
 o getURL(Request)
Get the full URL for that resource.
 o getURLPath()
Get the file part of the URL this resource is attached to.
 o head(Request)
The default HEAD method replies does a GET and removes entity.
 o link(Request)
The default LINK method replies with a not implemented.
 o lookup(LookupState, LookupResult)
 o markModified()
Set an HTTPResource attribute.
 o options(Request)
The default OPTIONS method replies with a not implemented.
 o perform(Request)
Dispatch the given request to the appropriate method.
 o post(Request)
The default POST method replies with a not implemented.
 o put(Request)
The default PUT method replies with a not implemented.
 o setValue(int, Object)
Catch setValue, to maintain cached header values correctness.
 o unlink(Request)
The default UNLINK method replies with a not implemented.
 o updateCachedHeaders()
Update the cached headers value.
 o verify()
Verify that resource.

Variables

 o COND_FAILED
 public static final int COND_FAILED
Condition check return code - Condition existed but failed.

 o COND_OK
 public static final int COND_OK
Condition check return code - Condition existed and succeeded.

 o _allowed
 protected static HttpTokenList _allowed
 o allowed
 protected HttpTokenList allowed
 o ATTR_PARENT
 protected static int ATTR_PARENT
Attribute index - The index for our parent attribute.

 o ATTR_URL
 protected static int ATTR_URL
Attribute index - The index for our URL attribute.

 o ATTR_QUALITY
 protected static int ATTR_QUALITY
Attributes index - The index for the quality attribute.

 o ATTR_TITLE
 protected static int ATTR_TITLE
Attribute index - The index for the title attribute.

 o ATTR_CONTENT_LANGUAGE
 protected static int ATTR_CONTENT_LANGUAGE
Attribute index - The index for the content languages attribute.

 o ATTR_CONTENT_ENCODING
 protected static int ATTR_CONTENT_ENCODING
Attribute index - The index for the content encodings attribute.

 o ATTR_CONTENT_TYPE
 protected static int ATTR_CONTENT_TYPE
Attribute index - The index for the content type attribute.

 o ATTR_CONTENT_LENGTH
 protected static int ATTR_CONTENT_LENGTH
Attribute index - The index for the content length attribute.

 o ATTR_LAST_MODIFIED
 protected static int ATTR_LAST_MODIFIED
Attribute index - The index for the last-modified attribute.

 o ATTR_ICON
 protected static int ATTR_ICON
Attribute index - The icon (if any) associated to the resource.

 o ATTR_MAXAGE
 protected static int ATTR_MAXAGE
Attribute index - Max age: the maximum drift allowed from reality.

 o ATTR_OID
 protected static int ATTR_OID
Attribute index - The object identifier.

 o ATTR_CONTEXT
 protected static int ATTR_CONTEXT
Attribute index - The hierarchical context of the resource.

Constructors

 o HTTPResource
 public HTTPResource()

Methods

 o getHelpURL
 public String getHelpURL()
Get this resource's help url.

Returns:
An URL, encoded as a String, or null if not available.
Overrides:
getHelpURL in class Resource
 o getHelpURL
 public String getHelpURL(String topic)
Get the help URL for that resource's attribute.

Parameters:
topic - The topic (can be an attribute name, or a property, etc).
Returns:
A String encoded URL, or null.
Overrides:
getHelpURL in class Resource
 o setValue
 public synchronized void setValue(int idx,
                                   Object value)
Catch setValue, to maintain cached header values correctness.

Parameters:
idx - The index of the attribute to be set.
value - The new value for the attribute.
Overrides:
setValue in class Resource
 o markModified
 public void markModified()
Set an HTTPResource attribute. Mark modified should also update our last-modification time.

Parameters:
idx - The index of the value to be set.
value - Its new value.
Overrides:
markModified in class Resource
 o lookup
 public boolean lookup(LookupState ls,
                       LookupResult lr) throws HTTPException
 o getParent
 public HTTPResource getParent()
Get this resource parent resource. The parent of a resource can be either null if it is the server root resource, or any HTTPResource.

Returns:
An instance of HTTPResource, or null
 o getURLPath
 public String getURLPath()
Get the file part of the URL this resource is attached to.

Returns:
An URL object specifying the location in the information space of this resource.
 o getURL
 public URL getURL(Request request)
Get the full URL for that resource.

Returns:
An URL instance.
 o getContext
 public ResourceContext getContext()
Get the hierarchical context for that resource.

Returns:
A ResourceContext instance, guaranteed not to be null
 o getServer
 public httpd getServer()
Get the server this resource is served by.

Returns:
The first instance of Jigsaw this resource was attached to.
 o getQuality
 public double getQuality()
Get this resource quality.

Returns:
The resource quality, or some negative value if not defined.
 o getTitle
 public String getTitle()
Get this resource title.

Returns:
This resource's title, or null if not defined.
 o getContentLanguage
 public String getContentLanguage()
Get this resource content language. Language are stored as a comma separated String of tokens.

Returns:
A comma separated string of language tokens, or null if undefined.
 o getContentEncoding
 public String getContentEncoding()
Get this resource content encoding. The content encoding of a resource is stored as a comma separated list of tokens (as decribed in the Content_encoding header of the HTTP specification, and in the order they should appear in the header).

Returns:
A string of comma separated encoding tokens, or null if not defined.
 o getContentType
 public MimeType getContentType()
Get this resource content type.

Returns:
An instance of MIMEType, or null if not defined.
 o getContentLength
 public int getContentLength()
Get this resource content length.

Returns:
The resource content length, or -1 if not defined.
 o getLastModified
 public long getLastModified()
Get this resource last modification time.

Returns:
A long giving the date of the last modification time, or -1 if undefined.
 o getIcon
 public String getIcon()
Get this resource's icon.

 o getOid
 public int getOid()
Get this resource's object identifier. An object identifier is to be used specifically in etags. It's purpose is to uniquify the etag of a resource. It's computed as a random number , on demand only.

Returns:
A uniq object identifier for that resource, as an inteeger.
 o getMaxAge
 public long getMaxAge()
Get this resource's max age. The max age of a resource indicates how much drift is allowed between the physicall version of the resource, and any in-memory cached version of it.

The max age attribute is a long number giving the number of milliseconds of allowed drift.

 o updateCachedHeaders
 protected void updateCachedHeaders()
Update the cached headers value. Each resource maintains a set of cached values for headers, this allows for a nice sped-up in headers marshalling, which - as the complexity of the protocol increases - becomes a bottleneck.

 o createDefaultReply
 public Reply createDefaultReply(Request request,
                                 int status)
Create a reply to answer to request on this file. This method will create a suitable reply (matching the given request) and will set all its default header values to the appropriate values.

Parameters:
request - The request to make a reply for.
Returns:
An instance of Reply, suited to answer this request.
 o checkIfMatch
 public int checkIfMatch(Request request)
Check the If-Match condition of that request.

Parameters:
request - The request to check.
Returns:
An integer, either COND_FAILED if condition was checked, but failed, COND_OK if condition was checked and succeeded, or 0 if the condition was not checked at all (eg because the resource or the request didn't support it).
 o checkIfNoneMatch
 public int checkIfNoneMatch(Request request)
Check the If-None-Match condition of that request.

Parameters:
request - The request to check.
Returns:
An integer, either COND_FAILED if condition was checked, but failed, COND_OK if condition was checked and succeeded, or 0 if the condition was not checked at all (eg because the resource or the request didn't support it).
 o checkIfModifiedSince
 public int checkIfModifiedSince(Request request)
Check the If-Modified-Since condition of that request.

Parameters:
request - The request to check.
Returns:
An integer, either COND_FAILED if condition was checked, but failed, COND_OK if condition was checked and succeeded, or 0 if the condition was not checked at all (eg because the resource or the request didn't support it).
 o checkIfUnmodifiedSince
 public int checkIfUnmodifiedSince(Request request)
Check the If-Unmodified-Since condition of that request.

Parameters:
request - The request to check.
Returns:
An integer, either COND_FAILED if condition was checked, but failed, COND_OK if condition was checked and succeeded, or 0 if the condition was not checked at all (eg because the resource or the request didn't support it).
 o get
 public Reply get(Request request) throws HTTPException, ClientException
The default GET method replies with a not implemented.

Parameters:
request - The request to handle.
Throws: HTTPException
Always thrown, to return a NOT_IMPLEMENTED error.
Throws: ClientException
If the client instance controling the request processing got a fatal error.
 o head
 public Reply head(Request request) throws HTTPException, ClientException
The default HEAD method replies does a GET and removes entity.

Parameters:
request - The request to handle.
Throws: HTTPException
Always thrown, to return a NOT_IMPLEMENTED error.
Throws: ClientException
If the client instance controling the request processing got a fatal error.
 o post
 public Reply post(Request request) throws HTTPException, ClientException
The default POST method replies with a not implemented.

Parameters:
request - The request to handle.
Throws: HTTPException
Always thrown, to return a NOT_IMPLEMENTED error.
Throws: ClientException
If the client instance controling the request processing got a fatal error.
 o put
 public Reply put(Request request) throws HTTPException, ClientException
The default PUT method replies with a not implemented.

Parameters:
request - The request to handle.
Throws: HTTPException
Always thrown, to return a NOT_IMPLEMENTED error.
Throws: ClientException
If the client instance controling the request processing got a fatal error.
 o options
 public Reply options(Request request) throws HTTPException, ClientException
The default OPTIONS method replies with a not implemented.

Parameters:
request - The request to handle.
Throws: HTTPException
In case of errors.
Throws: ClientException
If the client instance controling the request processing got a fatal error.
 o delete
 public Reply delete(Request request) throws HTTPException, ClientException
The default DELETE method replies with a not implemented.

Parameters:
request - The request to handle.
Throws: HTTPException
Always thrown, to return a NOT_IMPLEMENTED error.
Throws: ClientException
If the client instance controling the request processing got a fatal error.
 o delete
 public synchronized void delete()
Delete this resource and notifies its container.

Overrides:
delete in class Resource
 o verify
 public boolean verify()
Verify that resource. This method is triggered through some administration interface and should check if the resource is still valid or not. It may delete the resource if needed.

 o link
 public Reply link(Request request) throws HTTPException, ClientException
The default LINK method replies with a not implemented.

Parameters:
request - The request to handle.
Throws: HTTPException
Always thrown, to return a NOT_IMPLEMENTED error.
Throws: ClientException
If the client instance controling the request processing got a fatal error.
 o unlink
 public Reply unlink(Request request) throws HTTPException, ClientException
The default UNLINK method replies with a not implemented.

Parameters:
request - The request to handle.
Throws: HTTPException
Always thrown, to return a NOT_IMPLEMENTED error.
Throws: ClientException
If the client instance controling the request processing got a fatal error.
 o extended
 public Reply extended(Request request) throws HTTPException, ClientException
The handler for unknown method replies with a not implemented.

Parameters:
request - The request to handle.
Throws: HTTPException
Always thrown, to return a NOT_IMPLEMENTED error.
Throws: ClientException
If the client instance controling the request processing got a fatal error.
 o perform
 public Reply perform(Request request) throws HTTPException, ClientException
Dispatch the given request to the appropriate method.

Parameters:
request - The request to dispatch and process.
Returns:
A Repky instance.
Throws: HTTPException
If processing failed.
Throws: ClientException
If the client that is responsible for this request should be terminated.

All Packages  Class Hierarchy  This Package  Previous  Next  Index