    All Packages  Class Hierarchy  This Package  Previous  Next  Index

# Class w3c.jigsaw.resources.HTTPResource

    java.lang.Object
       |
       +----w3c.jigsaw.resources.AttributeHolder
               |
               +----w3c.jigsaw.resources.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.

##

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

##

HTTPResource()

##

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

##

COND_FAILED

      public final static int COND_FAILED

  Condition check return code - Condition existed but failed.

COND_OK

      public final static int COND_OK

  Condition check return code - Condition existed and succeeded.

_allowed

      protected static HttpTokenList _allowed

allowed

      protected HttpTokenList allowed

ATTR_PARENT

      protected static int ATTR_PARENT

  Attribute index - The index for our parent attribute.

ATTR_URL

      protected static int ATTR_URL

  Attribute index - The index for our URL attribute.

ATTR_SERVER

      protected static int ATTR_SERVER

  Attribute index - The index for our server attribute.

ATTR_QUALITY

      protected static int ATTR_QUALITY

  Attributes index - The index for the quality attribute.

ATTR_TITLE

      protected static int ATTR_TITLE

  Attribute index - The index for the title attribute.

ATTR_CONTENT_LANGUAGE

      protected static int ATTR_CONTENT_LANGUAGE

  Attribute index - The index for the content languages attribute.

ATTR_CONTENT_ENCODING

      protected static int ATTR_CONTENT_ENCODING

  Attribute index - The index for the content encodings attribute.

ATTR_CONTENT_TYPE

      protected static int ATTR_CONTENT_TYPE

  Attribute index - The index for the content type attribute.

ATTR_CONTENT_LENGTH

      protected static int ATTR_CONTENT_LENGTH

  Attribute index - The index for the content length attribute.

ATTR_LAST_MODIFIED

      protected static int ATTR_LAST_MODIFIED

  Attribute index - The index for the last-modified attribute.

ATTR_ICON

      protected static int ATTR_ICON

  Attribute index - The icon (if any) associated to the resource.

ATTR_MAXAGE

      protected static int ATTR_MAXAGE

  Attribute index - Max age: the maximum drift allowed from reality.

ATTR_OID

      protected static int ATTR_OID

  Attribute index - The object identifier.

##

HTTPResource

      public HTTPResource()

##

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

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

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

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

lookup

      public boolean lookup(LookupState ls,
                            LookupResult lr) throws HTTPException

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

getURL

      public String getURL()

  Get the URL this resource is attached to.
  Returns:
    An URL object specifying the location in the information space of this resource.

getServer

      public httpd getServer()

  Get the server this resource is served by.
  Returns:
    The first instance of Jigsaw this resource was attached to.

getQuality

      public double getQuality()

  Get this resource quality.
  Returns:
    The resource quality, or some negative value if not defined.

getTitle

      public String getTitle()

  Get this resource title.
  Returns:
    This resource's title, or null if not defined.

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.

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.

getContentType

      public MimeType getContentType()

  Get this resource content type.
  Returns:
    An instance of MIMEType, or null if not defined.

getContentLength

      public int getContentLength()

  Get this resource content length.
  Returns:
    The resource content length, or -1 if not defined.

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.

getIcon

      public String getIcon()

  Get this resource's icon.

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.

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.

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.

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.

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).`

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).`

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).`

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).`

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.

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.

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.

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.

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.

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.

delete

      public void delete()

  Delete this resource and notifies its container.
  Overrides:
    delete in class Resource

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.

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.

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.

perform

      public Reply perform(Request request,
                           HTTPFilter filters[]) throws HTTPException, ClientException

  Perform the given request on this HTTP resource.
  Parameters:
    request - The request to perform.
  Throws: HTTPException
    If the resource couldn't process this request.
  Throws: ClientException
    If the client instance controling the request processing got a fatal error.

    All Packages  Class Hierarchy  This Package  Previous  Next  Index