org.w3c.jigsaw.frames
Class HTTPFrame

java.lang.Object
  |
  +--org.w3c.tools.resources.AttributeHolder
        |
        +--org.w3c.tools.resources.Resource
              |
              +--org.w3c.tools.resources.FramedResource
                    |
                    +--org.w3c.tools.resources.ResourceFrame
                          |
                          +--org.w3c.tools.resources.ProtocolFrame
                                |
                                +--org.w3c.jigsaw.frames.HTTPFrame
Direct Known Subclasses:
BrokerFrame, CgiFrame, CheckpointFrame, CvsFileFrame, CvsFileFrame, DirectoryListerFrame, FancyFrame, ForwardFrame, GcStatFrame, HTTPExtFrame, MapFrame, NegotiatedFrame, PageCompileFrame, PostableFrame, RedirecterFrame, RelocateFrame, ServletDirectoryFrame, ServletMapperFrame, ServletWrapperFrame, StatisticsFrame, ThreadStatFrame, VirtualHostFrame, ZipFrame

public class HTTPFrame
extends org.w3c.tools.resources.ProtocolFrame

Default class to handle the HTTP protocol, manage FileResource and DirectoryResource.


Field Summary
protected static HttpTokenList _allowed
          Methods allowed by that class in general:
protected  boolean acceptRanges
          Does this resource support byte ranges.
protected  HttpTokenList allowed
          Methods allowed by instances of that class in particular:
protected static int ATTR_ALLOW_DEL
          Attribute index - delete allowed for the associated resource ?
protected static int ATTR_BROWSABLE
          Attribute index - Allow the GNN browse method.
protected static int ATTR_CONTENT_ENCODING
          Attribute index - The index for the content encodings attribute.
protected static int ATTR_CONTENT_LANGUAGE
          Attribute index - The index for the content languages attribute.
protected static int ATTR_CONTENT_LENGTH
          Attribute index - The index for the content length attribute.
protected static int ATTR_CONTENT_TYPE
          Attribute index - The index for the content type attribute.
protected static int ATTR_ICON
          Attribute index - The icon (if any) associated to the resource.
protected static int ATTR_ICONDIR
          Attribute index - The icon directory to use in dir listing.
protected static int ATTR_INDEX
          Attribute index - our index resource name.
protected static int ATTR_MAXAGE
          Attribute index - Max age: the maximum drift allowed from reality.
protected static int ATTR_MD5
          Attribute index - Send MD5 Digest: the md5 digest of the resource sent
protected static int ATTR_PUTABLE
          Attribute index - Do we allow PUT method on this file.
protected static int ATTR_QUALITY
          Attributes index - The index for the quality attribute.
protected static int ATTR_RELOCATE
          Attribute index - The index for our relocate attribute.
protected static int ATTR_STYLE_LINK
          Attribute index - Style sheet for directory listing
protected static int ATTR_TITLE
          Attribute index - The index for the title attribute.
protected static MimeType browsetype
          The Browse Mime type.
static int COND_FAILED
          Condition check return code - Condition existed but failed.
static int COND_OK
          Condition check return code - Condition existed and succeeded.
protected  org.w3c.tools.resources.DirectoryResource dresource
          The associated DirectoryResource (if any)
protected  org.w3c.tools.resources.FileResource fresource
          The associated FileResource (if any)
protected  HtmlGenerator listing
          Our current (cached) directory listing.
protected  long listing_stamp
          The time at which we generated the directory index.
static java.lang.String STATE_CONTENT_LOCATION
           
 
Fields inherited from class org.w3c.tools.resources.ResourceFrame
filterClass, frameListener, resource
 
Fields inherited from class org.w3c.tools.resources.FramedResource
ATTR_OID, attrListener, debugEvent, event_disabled, framesRef, structListener
 
Fields inherited from class org.w3c.tools.resources.Resource
ATTR_CONTEXT, ATTR_HELP_URL, ATTR_IDENTIFIER, ATTR_LAST_MODIFIED, ATTR_PARENT, ATTR_RESOURCE_FRAMES, ATTR_STORE_ENTRY, ATTR_URL
 
Fields inherited from class org.w3c.tools.resources.AttributeHolder
attributes, slowpickle, values
 
Constructor Summary
HTTPFrame()
           
 
Method Summary
 void addStyleSheet(HtmlGenerator g)
          Add our own Style Sheet to the HtmlGenerator.
 void attributeChanged(AttributeChangedEvent evt)
          Listen its resource.
 org.w3c.jigsaw.http.Reply browse(org.w3c.jigsaw.http.Request request)
          A present to GNNPress users ! This method implements the BROWSE method that AOL press (or GNN press, or whatever its last name is) expects.
 int checkIfMatch(org.w3c.jigsaw.http.Request request)
          Check the If-Match condition of that request.
 int checkIfModifiedSince(org.w3c.jigsaw.http.Request request)
          Check the If-Modified-Since condition of that request.
 int checkIfNoneMatch(org.w3c.jigsaw.http.Request request)
          Check the If-None-Match condition of that request.
 int checkIfUnmodifiedSince(org.w3c.jigsaw.http.Request request)
          Check the If-Unmodified-Since condition of that request.
 boolean checkRequest(org.w3c.tools.resources.RequestInterface request)
          Check the request.
protected  java.io.File computeTrashDir(java.io.File dir)
           
protected  java.io.File computeTrashFile(java.io.File file)
           
 org.w3c.jigsaw.http.Reply createDefaultReply(org.w3c.jigsaw.http.Request request, int status)
          Create a reply to answer to request on this file.
protected  org.w3c.jigsaw.http.Reply createFileReply(org.w3c.jigsaw.http.Request request)
          Create the reply relative to the given file.
 org.w3c.jigsaw.http.Reply delete(org.w3c.jigsaw.http.Request request)
          The default DELETE method, actually the resource (file, directory) is moved into the trash directory which is not accessible via HTTP.
protected  org.w3c.jigsaw.http.Reply deleteDirectoryResource(org.w3c.jigsaw.http.Request request)
          Perform a DELETE for the associated DirectoryResource.
protected  org.w3c.jigsaw.http.Reply deleteFileResource(org.w3c.jigsaw.http.Request request)
          Perform a DELETE for the associated FileResource.
protected  org.w3c.jigsaw.http.Reply deleteOtherResource(org.w3c.jigsaw.http.Request request)
          Perform a DELETE for the associated resource.
 org.w3c.jigsaw.http.Reply extended(org.w3c.jigsaw.http.Request request)
           
 org.w3c.jigsaw.http.Reply get(org.w3c.jigsaw.http.Request request)
          The default GET method.
 boolean getAllowDeleteFlag()
          delete allowed for the associated resource ?
 boolean getBrowsableFlag()
          Get this class browsable flag.
protected  MimeType getBrowseType()
          Get the Browse Mime type.
 java.lang.String getContentEncoding()
          Get this resource content encoding.
 java.lang.String getContentLanguage()
          Get this resource content language.
 int getContentLength()
          Get this resource content length.
 MimeType getContentType()
          Get this resource content type.
 org.w3c.jigsaw.http.Reply getDirectoryListing(org.w3c.jigsaw.http.Request request)
          Reply with an HTML doc listing the resources of this directory.
 org.w3c.tools.resources.DirectoryResource getDirectoryResource()
          Get the associated DirectoryResource (if any)
protected  org.w3c.jigsaw.http.Reply getDirectoryResource(org.w3c.jigsaw.http.Request request)
          Perform a GET for the associated DirectoryResource.
 HttpEntityTag getETag()
          Get this resource Etag
 org.w3c.tools.resources.FileResource getFileResource()
          Get the associated FileResource (if any)
protected  org.w3c.jigsaw.http.Reply getFileResource(org.w3c.jigsaw.http.Request request)
          Get for FileResource
 java.lang.String getHelpURL()
          Get this resource's help url.
 java.lang.String getHelpURL(java.lang.String topic)
          Get the help URL for that resource's attribute.
 java.lang.String getIcon()
          Get this resource's icon.
 java.lang.String getIconDirectory()
          Get the optional icon directory.
 java.lang.String getIndex()
          Get the optinal index name for this directory listing.
 long getMaxAge()
          Get this resource's max age.
 boolean getMD5Flag()
          Do we send the MD5 digest?
protected  org.w3c.jigsaw.http.Reply getOtherResource(org.w3c.jigsaw.http.Request request)
          The default GET method for other king of associated resource
 boolean getPutableFlag()
          Get the PUT'able flag (are we allow to PUT to the resource ?)
 double getQuality()
          Get this resource quality.
 boolean getRelocateFlag()
          Should we relocate invalid requests to this directory.
 java.lang.String getStyleSheetURL()
          Get this frame style sheet link
 java.lang.String getTitle()
          Get this resource title.
 java.net.URL getURL(org.w3c.jigsaw.http.Request request)
          Get the full URL for that resource.
 org.w3c.jigsaw.http.Reply handleRangeRequest(org.w3c.jigsaw.http.Request request, HttpRange r)
          handles a Range Request
 org.w3c.jigsaw.http.Reply head(org.w3c.jigsaw.http.Request request)
          The default HEAD method replies does a GET and removes entity.
protected  org.w3c.jigsaw.http.Reply headDirectoryResource(org.w3c.jigsaw.http.Request request)
          Perform a HEAD request for the associated DirectoryResource.
protected  org.w3c.jigsaw.http.Reply headFileResource(org.w3c.jigsaw.http.Request request)
          Perform a HEAD request for the associated FileResource.
protected  org.w3c.jigsaw.http.Reply headOtherResource(org.w3c.jigsaw.http.Request request)
          Perform a HEAD request for the associated resource.
 org.w3c.jigsaw.http.Reply link(org.w3c.jigsaw.http.Request request)
          The default LINK method replies with a not implemented.
 boolean lookup(org.w3c.tools.resources.LookupState ls, org.w3c.tools.resources.LookupResult lr)
          Lookup the target resource.
protected  boolean lookupDirectory(org.w3c.tools.resources.LookupState ls, org.w3c.tools.resources.LookupResult lr)
          Lookup the target resource when associated with a DirectoryResource.
protected  boolean lookupFile(org.w3c.tools.resources.LookupState ls, org.w3c.tools.resources.LookupResult lr)
          Lookup the target resource when associated with a FileResource.
protected  boolean lookupOther(org.w3c.tools.resources.LookupState ls, org.w3c.tools.resources.LookupResult lr)
          Lookup the target resource when associated with an unknown resource.
protected  boolean lookupResource(org.w3c.tools.resources.LookupState ls, org.w3c.tools.resources.LookupResult lr)
          Lookup the target resource (dispath to more specific lookup methods).
 org.w3c.jigsaw.http.Reply options(org.w3c.jigsaw.http.Request request)
          The default OPTIONS method replies with a not implemented.
 org.w3c.tools.resources.ReplyInterface perform(org.w3c.tools.resources.RequestInterface req)
          Perform the request
protected  org.w3c.tools.resources.ReplyInterface performFrames(org.w3c.tools.resources.RequestInterface request)
          Perform the request on all the frames of that resource.
 org.w3c.jigsaw.http.Reply post(org.w3c.jigsaw.http.Request request)
          The default POST method replies with a not implemented.
 org.w3c.jigsaw.http.Reply put(org.w3c.jigsaw.http.Request request)
          The default PUT method.
protected  org.w3c.jigsaw.http.Reply putFileResource(org.w3c.jigsaw.http.Request request)
          Change the content of the associated FileResource.
protected  org.w3c.jigsaw.http.Reply putOtherResource(org.w3c.jigsaw.http.Request request)
          Always throw a ProtocolException.
 void registerOtherResource(org.w3c.tools.resources.FramedResource resource)
          use this one instead of registerResource if the resource type doesn't matter or if this is not a file or a directory resource.
 void registerResource(org.w3c.tools.resources.FramedResource resource)
          Register this frame to the given resource.
 void setValue(int idx, java.lang.Object value)
          Catch setValue, to maintain cached header values correctness.
 org.w3c.jigsaw.http.Reply trace(org.w3c.jigsaw.http.Request request)
          The default TRACE method replies with a not implemented
 org.w3c.jigsaw.http.Reply unlink(org.w3c.jigsaw.http.Request request)
          The default UNLINK method replies with a not implemented.
protected  void updateCachedHeaders()
          Update the cached headers value.
 
Methods inherited from class org.w3c.tools.resources.ResourceFrame
addFrameEventListener, eventDisabled, fireFrameEvent, frameModified, getFilters, getFilters, getFrameReference, getResource, getResourceReference, getSpaceEntry, getURLPath, lookupFilters, lookupFrames, postFrameEvent, processEvent, removeFrameEventListener, unregisterResource, updateDefaultChildAttributes
 
Methods inherited from class org.w3c.tools.resources.FramedResource
addAttributeChangedListener, addStructureChangedListener, collectFramesReference, delete, disableEvent, displayEvent, enableEvent, fireAttributeChangeEvent, fireStructureChangedEvent, fireStructureChangedEvent, frameAdded, frameRemoved, getClone, getFrame, getFrame, getFrameReference, getFrameReference, getFramesReference, getOid, initialize, markModified, notifyUnload, postAttributeChangeEvent, postEvent, postStructureChangedEvent, postStructureChangedEvent, registerFrame, registerFrameIfNone, removeAttributeChangedListener, removeStructureChangedListener, unregisterFrame
 
Methods inherited from class org.w3c.tools.resources.Resource
acceptUnload, checkMultipleLock, collectFrames, getContext, getFrame, getFrames, getIdentifier, getLastModified, getParent, getServer, getSpace, getStoreEntry, getValue, getValue, isInitialized, setContext, setContext, setValue, updateAttributes
 
Methods inherited from class org.w3c.tools.resources.AttributeHolder
definesAttribute, definesAttribute, getAttributes, getBoolean, getChar, getClone, getClone, getDouble, getFloat, getInt, getLong, getString, getValue, initialize, lookupAttribute, pickle, print, setBoolean, setChar, setDouble, setFloat, setInt, setLong, setString, setValue, unpickle, unpickle, unpickle, unpickleInstance, unpickleInstance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STATE_CONTENT_LOCATION

public static final java.lang.String STATE_CONTENT_LOCATION

COND_FAILED

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

COND_OK

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

_allowed

protected static HttpTokenList _allowed
Methods allowed by that class in general:

allowed

protected HttpTokenList allowed
Methods allowed by instances of that class in particular:

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_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_MD5

protected static int ATTR_MD5
Attribute index - Send MD5 Digest: the md5 digest of the resource sent

ATTR_ALLOW_DEL

protected static int ATTR_ALLOW_DEL
Attribute index - delete allowed for the associated resource ?

ATTR_PUTABLE

protected static int ATTR_PUTABLE
Attribute index - Do we allow PUT method on this file.

ATTR_RELOCATE

protected static int ATTR_RELOCATE
Attribute index - The index for our relocate attribute.

ATTR_INDEX

protected static int ATTR_INDEX
Attribute index - our index resource name.

ATTR_ICONDIR

protected static int ATTR_ICONDIR
Attribute index - The icon directory to use in dir listing.

ATTR_BROWSABLE

protected static int ATTR_BROWSABLE
Attribute index - Allow the GNN browse method.

ATTR_STYLE_LINK

protected static int ATTR_STYLE_LINK
Attribute index - Style sheet for directory listing

dresource

protected org.w3c.tools.resources.DirectoryResource dresource
The associated DirectoryResource (if any)

fresource

protected org.w3c.tools.resources.FileResource fresource
The associated FileResource (if any)

acceptRanges

protected boolean acceptRanges
Does this resource support byte ranges.

listing

protected HtmlGenerator listing
Our current (cached) directory listing.

listing_stamp

protected long listing_stamp
The time at which we generated the directory index.

browsetype

protected static MimeType browsetype
The Browse Mime type.
Constructor Detail

HTTPFrame

public HTTPFrame()
Method Detail

registerResource

public void registerResource(org.w3c.tools.resources.FramedResource resource)
Register this frame to the given resource.
Parameters:
resource - The resource associated with this frame.
Overrides:
registerResource in class org.w3c.tools.resources.ResourceFrame

getFileResource

public org.w3c.tools.resources.FileResource getFileResource()
Get the associated FileResource (if any)
Returns:
a FileResource instance or null if no FileResource is associated with this frame.

getDirectoryResource

public org.w3c.tools.resources.DirectoryResource getDirectoryResource()
Get the associated DirectoryResource (if any)
Returns:
a DirectoryResource instance or null if no DirectoryResource is associated with this frame.

registerOtherResource

public void registerOtherResource(org.w3c.tools.resources.FramedResource resource)
use this one instead of registerResource if the resource type doesn't matter or if this is not a file or a directory resource. In subclasses you should have to do that:
  public void registerResource(FramedResource resource) {
   super.registerOtherResource(resource);
  }
 
Parameters:
the - resource to register.

getHelpURL

public java.lang.String getHelpURL()
Get this resource's help url.
Returns:
An URL, encoded as a String, or null if not available.
Overrides:
getHelpURL in class org.w3c.tools.resources.Resource

getHelpURL

public java.lang.String getHelpURL(java.lang.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 org.w3c.tools.resources.Resource

attributeChanged

public void attributeChanged(AttributeChangedEvent evt)
Listen its resource.
Overrides:
attributeChanged in class org.w3c.tools.resources.ResourceFrame

setValue

public void setValue(int idx,
                     java.lang.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 org.w3c.tools.resources.ResourceFrame

getURL

public java.net.URL getURL(org.w3c.jigsaw.http.Request request)
Get the full URL for that resource.
Returns:
An URL instance.

getQuality

public double getQuality()
Get this resource quality.
Returns:
The resource quality, or some negative value if not defined.

getTitle

public java.lang.String getTitle()
Get this resource title.
Returns:
This resource's title, or null if not defined.

getContentLanguage

public java.lang.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 java.lang.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.

getETag

public HttpEntityTag getETag()
Get this resource Etag
Returns:
an instance of HttpEntityTag, or null if not defined.

getContentLength

public int getContentLength()
Get this resource content length.
Returns:
The resource content length, or -1 if not defined.

getIcon

public java.lang.String getIcon()
Get this resource's icon.

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.


getPutableFlag

public boolean getPutableFlag()
Get the PUT'able flag (are we allow to PUT to the resource ?)

getMD5Flag

public boolean getMD5Flag()
Do we send the MD5 digest?

getAllowDeleteFlag

public boolean getAllowDeleteFlag()
delete allowed for the associated resource ?

handleRangeRequest

public org.w3c.jigsaw.http.Reply handleRangeRequest(org.w3c.jigsaw.http.Request request,
                                                    HttpRange r)
                                             throws org.w3c.tools.resources.ProtocolException
handles a Range Request
Parameters:
request, - the request
r, - the HttpRange
Returns:
a Reply if range is valid, or null if there is a change in the resource, or if the HttpRange is not valid ( 4-2, for example).
Throws:
org.w3c.tools.resources.ProtocolException - If processsing the request failed.

getBrowsableFlag

public boolean getBrowsableFlag()
Get this class browsable flag.

getStyleSheetURL

public java.lang.String getStyleSheetURL()
Get this frame style sheet link

getIconDirectory

public java.lang.String getIconDirectory()
Get the optional icon directory.

getRelocateFlag

public boolean getRelocateFlag()
Should we relocate invalid requests to this directory.
Returns:
A boolean true if we should relocate.

getIndex

public java.lang.String getIndex()
Get the optinal index name for this directory listing.
Returns:
The name of the resource responsible to list that container.

addStyleSheet

public void addStyleSheet(HtmlGenerator g)
Add our own Style Sheet to the HtmlGenerator.
Parameters:
g - The HtmlGenerator.

getDirectoryListing

public org.w3c.jigsaw.http.Reply getDirectoryListing(org.w3c.jigsaw.http.Request request)
                                              throws org.w3c.tools.resources.ProtocolException,
                                                     org.w3c.tools.resources.ResourceException
Reply with an HTML doc listing the resources of this directory. This function takes special care not to regenerate a directory listing when one is available. It also caches the date of the directory listing, so that it can win big with NOT_MODIFIED.

Using a modem, I know that each place I can reply with an NOT_MODIFIED, is a big win.

Parameters:
request - The request to handle.
Throws:
org.w3c.tools.resources.ProtocolException - If processsing the request failed.
org.w3c.tools.resources.ResourceException - If the resource got a fatal error.

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 org.w3c.jigsaw.http.Reply createDefaultReply(org.w3c.jigsaw.http.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(org.w3c.jigsaw.http.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(org.w3c.jigsaw.http.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(org.w3c.jigsaw.http.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(org.w3c.jigsaw.http.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).

lookup

public boolean lookup(org.w3c.tools.resources.LookupState ls,
                      org.w3c.tools.resources.LookupResult lr)
               throws org.w3c.tools.resources.ProtocolException
Lookup the target resource. Lookup filters and then resource.
Parameters:
ls - The current lookup state
lr - The result
Returns:
true if lookup is done.
Throws:
org.w3c.tools.resources.ProtocolException - If an error relative to the protocol occurs
Overrides:
lookup in class org.w3c.tools.resources.ResourceFrame
See Also:
ResourceFrame.lookupFilters(org.w3c.tools.resources.LookupState, org.w3c.tools.resources.LookupResult), lookupResource(org.w3c.tools.resources.LookupState, org.w3c.tools.resources.LookupResult)

lookupResource

protected boolean lookupResource(org.w3c.tools.resources.LookupState ls,
                                 org.w3c.tools.resources.LookupResult lr)
                          throws org.w3c.tools.resources.ProtocolException
Lookup the target resource (dispath to more specific lookup methods).
Parameters:
ls - The current lookup state
lr - The result
Returns:
true if lookup is done.
Throws:
org.w3c.tools.resources.ProtocolException - If an error relative to the protocol occurs
See Also:
lookupDirectory(org.w3c.tools.resources.LookupState, org.w3c.tools.resources.LookupResult), lookupFile(org.w3c.tools.resources.LookupState, org.w3c.tools.resources.LookupResult), lookupOther(org.w3c.tools.resources.LookupState, org.w3c.tools.resources.LookupResult)

lookupDirectory

protected boolean lookupDirectory(org.w3c.tools.resources.LookupState ls,
                                  org.w3c.tools.resources.LookupResult lr)
                           throws org.w3c.tools.resources.ProtocolException
Lookup the target resource when associated with a DirectoryResource.
Parameters:
ls - The current lookup state
lr - The result
Returns:
true if lookup is done.
Throws:
org.w3c.tools.resources.ProtocolException - If an error relative to the protocol occurs

lookupFile

protected boolean lookupFile(org.w3c.tools.resources.LookupState ls,
                             org.w3c.tools.resources.LookupResult lr)
                      throws org.w3c.tools.resources.ProtocolException
Lookup the target resource when associated with a FileResource.
Parameters:
ls - The current lookup state
lr - The result
Returns:
true if lookup is done.
Throws:
org.w3c.tools.resources.ProtocolException - If an error relative to the protocol occurs

lookupOther

protected boolean lookupOther(org.w3c.tools.resources.LookupState ls,
                              org.w3c.tools.resources.LookupResult lr)
                       throws org.w3c.tools.resources.ProtocolException
Lookup the target resource when associated with an unknown resource.
Parameters:
ls - The current lookup state
lr - The result
Returns:
true if lookup is done.
Throws:
org.w3c.tools.resources.ProtocolException - If an error relative to the protocol occurs

checkRequest

public boolean checkRequest(org.w3c.tools.resources.RequestInterface request)
Check the request.
Parameters:
request - the incomming request.
Returns:
true if the request is an HTTP Request.
Overrides:
checkRequest in class org.w3c.tools.resources.ResourceFrame

performFrames

protected org.w3c.tools.resources.ReplyInterface performFrames(org.w3c.tools.resources.RequestInterface request)
                                                        throws org.w3c.tools.resources.ProtocolException,
                                                               org.w3c.tools.resources.ResourceException
Perform the request on all the frames of that resource. The Reply returned is the first non-null reply.
Parameters:
request - A RequestInterface instance.
Returns:
A ReplyInterface instance.
Throws:
org.w3c.tools.resources.ProtocolException - If an error relative to the protocol occurs
org.w3c.tools.resources.ResourceException - If an error not relative to the protocol occurs
Overrides:
performFrames in class org.w3c.tools.resources.FramedResource

perform

public org.w3c.tools.resources.ReplyInterface perform(org.w3c.tools.resources.RequestInterface req)
                                               throws org.w3c.tools.resources.ProtocolException,
                                                      org.w3c.tools.resources.ResourceException
Perform the request
Parameters:
req - The request to handle.
Throws:
org.w3c.tools.resources.ProtocolException - If processsing the request failed.
org.w3c.tools.resources.ResourceException - If the resource got a fatal error.
Overrides:
perform in class org.w3c.tools.resources.ResourceFrame

get

public org.w3c.jigsaw.http.Reply get(org.w3c.jigsaw.http.Request request)
                              throws org.w3c.tools.resources.ProtocolException,
                                     org.w3c.tools.resources.ResourceException
The default GET method.
Parameters:
request - The request to handle.
Throws:
org.w3c.tools.resources.ProtocolException - If processsing the request failed.
org.w3c.tools.resources.ResourceException - If the resource got a fatal error.

getOtherResource

protected org.w3c.jigsaw.http.Reply getOtherResource(org.w3c.jigsaw.http.Request request)
                                              throws org.w3c.tools.resources.ProtocolException,
                                                     org.w3c.tools.resources.ResourceException
The default GET method for other king of associated resource
Parameters:
request - The request to handle.
Throws:
org.w3c.tools.resources.ProtocolException - If processsing the request failed.
org.w3c.tools.resources.ResourceException - If the resource got a fatal error.

createFileReply

protected org.w3c.jigsaw.http.Reply createFileReply(org.w3c.jigsaw.http.Request request)
                                             throws org.w3c.tools.resources.ProtocolException,
                                                    org.w3c.tools.resources.ResourceException
Create the reply relative to the given file.
Parameters:
request - the incomming request.
Returns:
A Reply instance
Throws:
org.w3c.tools.resources.ProtocolException - If processsing the request failed.
org.w3c.tools.resources.ResourceException - If the resource got a fatal error.

getFileResource

protected org.w3c.jigsaw.http.Reply getFileResource(org.w3c.jigsaw.http.Request request)
                                             throws org.w3c.tools.resources.ProtocolException,
                                                    org.w3c.tools.resources.ResourceException
Get for FileResource
Parameters:
request - the incomming request.
Returns:
A Reply instance
Throws:
org.w3c.tools.resources.ProtocolException - If processsing the request failed.
org.w3c.tools.resources.ResourceException - If the resource got a fatal error.

getDirectoryResource

protected org.w3c.jigsaw.http.Reply getDirectoryResource(org.w3c.jigsaw.http.Request request)
                                                  throws org.w3c.tools.resources.ProtocolException,
                                                         org.w3c.tools.resources.ResourceException
Perform a GET for the associated DirectoryResource.
Parameters:
request - the incomming request.
Returns:
A Reply instance.
Throws:
org.w3c.tools.resources.ProtocolException - if request processing failed.
org.w3c.tools.resources.ResourceException - If the resource got a fatal error.

head

public org.w3c.jigsaw.http.Reply head(org.w3c.jigsaw.http.Request request)
                               throws org.w3c.tools.resources.ProtocolException,
                                      org.w3c.tools.resources.ResourceException
The default HEAD method replies does a GET and removes entity.
Parameters:
request - The request to handle.
Throws:
org.w3c.tools.resources.ProtocolException - Always thrown, to return a NOT_IMPLEMENTED error.
org.w3c.tools.resources.ResourceException - If the resource got a fatal error.

headOtherResource

protected org.w3c.jigsaw.http.Reply headOtherResource(org.w3c.jigsaw.http.Request request)
                                               throws org.w3c.tools.resources.ProtocolException,
                                                      org.w3c.tools.resources.ResourceException
Perform a HEAD request for the associated resource.
Parameters:
request - the incomming request.
Returns:
A Reply instance
Throws:
org.w3c.tools.resources.ProtocolException - If processsing the request failed.
org.w3c.tools.resources.ResourceException - If the resource got a fatal error.

headDirectoryResource

protected org.w3c.jigsaw.http.Reply headDirectoryResource(org.w3c.jigsaw.http.Request request)
                                                   throws org.w3c.tools.resources.ProtocolException,
                                                          org.w3c.tools.resources.ResourceException
Perform a HEAD request for the associated DirectoryResource.
Parameters:
request - the incomming request.
Returns:
A Reply instance
Throws:
org.w3c.tools.resources.ProtocolException - If processsing the request failed.
org.w3c.tools.resources.ResourceException - If the resource got a fatal error.

headFileResource

protected org.w3c.jigsaw.http.Reply headFileResource(org.w3c.jigsaw.http.Request request)
                                              throws org.w3c.tools.resources.ProtocolException,
                                                     org.w3c.tools.resources.ResourceException
Perform a HEAD request for the associated FileResource.
Parameters:
request - the incomming request.
Returns:
A Reply instance
Throws:
org.w3c.tools.resources.ProtocolException - If processsing the request failed.
org.w3c.tools.resources.ResourceException - If the resource got a fatal error.

post

public org.w3c.jigsaw.http.Reply post(org.w3c.jigsaw.http.Request request)
                               throws org.w3c.tools.resources.ProtocolException,
                                      org.w3c.tools.resources.ResourceException
The default POST method replies with a not implemented.
Parameters:
request - The request to handle.
Throws:
org.w3c.tools.resources.ProtocolException - Always thrown, to return a NOT_IMPLEMENTED error.
org.w3c.tools.resources.ResourceException - If the resource got a fatal error.

put

public org.w3c.jigsaw.http.Reply put(org.w3c.jigsaw.http.Request request)
                              throws org.w3c.tools.resources.ProtocolException,
                                     org.w3c.tools.resources.ResourceException
The default PUT method.
Parameters:
request - The request to handle.
Throws:
org.w3c.tools.resources.ProtocolException - If processsing the request failed.
org.w3c.tools.resources.ResourceException - If the resource got a fatal error.

putOtherResource

protected org.w3c.jigsaw.http.Reply putOtherResource(org.w3c.jigsaw.http.Request request)
                                              throws org.w3c.tools.resources.ProtocolException
Always throw a ProtocolException.
Parameters:
request - The incmming request.
Returns:
a Reply instance.
Throws:
org.w3c.tools.resources.ProtocolException - (Always thrown).

putFileResource

protected org.w3c.jigsaw.http.Reply putFileResource(org.w3c.jigsaw.http.Request request)
                                             throws org.w3c.tools.resources.ProtocolException,
                                                    org.w3c.tools.resources.ResourceException
Change the content of the associated FileResource.
Parameters:
request - The incomming request.
Throws:
org.w3c.tools.resources.ProtocolException - if a protocol error occurs
org.w3c.tools.resources.ResourceException - If the resource got a fatal error.

options

public org.w3c.jigsaw.http.Reply options(org.w3c.jigsaw.http.Request request)
                                  throws org.w3c.tools.resources.ProtocolException,
                                         org.w3c.tools.resources.ResourceException
The default OPTIONS method replies with a not implemented.
Parameters:
request - The request to handle.
Throws:
org.w3c.tools.resources.ProtocolException - In case of errors.
org.w3c.tools.resources.ResourceException - If the resource got a fatal error.

delete

public org.w3c.jigsaw.http.Reply delete(org.w3c.jigsaw.http.Request request)
                                 throws org.w3c.tools.resources.ProtocolException,
                                        org.w3c.tools.resources.ResourceException
The default DELETE method, actually the resource (file, directory) is moved into the trash directory which is not accessible via HTTP.
Parameters:
request - The request to handle.
Throws:
org.w3c.tools.resources.ProtocolException - If processsing the request failed.
org.w3c.tools.resources.ResourceException - If the resource got a fatal error.

computeTrashFile

protected java.io.File computeTrashFile(java.io.File file)

computeTrashDir

protected java.io.File computeTrashDir(java.io.File dir)

deleteDirectoryResource

protected org.w3c.jigsaw.http.Reply deleteDirectoryResource(org.w3c.jigsaw.http.Request request)
                                                     throws org.w3c.tools.resources.ProtocolException,
                                                            org.w3c.tools.resources.ResourceException
Perform a DELETE for the associated DirectoryResource.
Parameters:
request - the incomming request.
Returns:
A Reply instance.
Throws:
org.w3c.tools.resources.ProtocolException - if request processing failed.
org.w3c.tools.resources.ResourceException - If the resource got a fatal error.

deleteFileResource

protected org.w3c.jigsaw.http.Reply deleteFileResource(org.w3c.jigsaw.http.Request request)
                                                throws org.w3c.tools.resources.ProtocolException,
                                                       org.w3c.tools.resources.ResourceException
Perform a DELETE for the associated FileResource.
Parameters:
request - the incomming request.
Returns:
A Reply instance.
Throws:
org.w3c.tools.resources.ProtocolException - if request processing failed.
org.w3c.tools.resources.ResourceException - If the resource got a fatal error.

deleteOtherResource

protected org.w3c.jigsaw.http.Reply deleteOtherResource(org.w3c.jigsaw.http.Request request)
                                                 throws org.w3c.tools.resources.ProtocolException,
                                                        org.w3c.tools.resources.ResourceException
Perform a DELETE for the associated resource.
Parameters:
request - the incomming request.
Returns:
A Reply instance.
Throws:
org.w3c.tools.resources.ProtocolException - if request processing failed.
org.w3c.tools.resources.ResourceException - If the resource got a fatal error.

link

public org.w3c.jigsaw.http.Reply link(org.w3c.jigsaw.http.Request request)
                               throws org.w3c.tools.resources.ProtocolException,
                                      org.w3c.tools.resources.ResourceException
The default LINK method replies with a not implemented.
Parameters:
request - The request to handle.
Throws:
org.w3c.tools.resources.ProtocolException - Always thrown, to return a NOT_IMPLEMENTED error.
org.w3c.tools.resources.ResourceException - If the resource got a fatal error.

unlink

public org.w3c.jigsaw.http.Reply unlink(org.w3c.jigsaw.http.Request request)
                                 throws org.w3c.tools.resources.ProtocolException,
                                        org.w3c.tools.resources.ResourceException
The default UNLINK method replies with a not implemented.
Parameters:
request - The request to handle.
Throws:
org.w3c.tools.resources.ProtocolException - Always thrown, to return a NOT_IMPLEMENTED error.
org.w3c.tools.resources.ResourceException - If the resource got a fatal error.

trace

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

extended

public org.w3c.jigsaw.http.Reply extended(org.w3c.jigsaw.http.Request request)
                                   throws org.w3c.tools.resources.ProtocolException,
                                          org.w3c.tools.resources.ResourceException

getBrowseType

protected MimeType getBrowseType()
Get the Browse Mime type.

browse

public org.w3c.jigsaw.http.Reply browse(org.w3c.jigsaw.http.Request request)
                                 throws org.w3c.tools.resources.ProtocolException
A present to GNNPress users ! This method implements the BROWSE method that AOL press (or GNN press, or whatever its last name is) expects.
Parameters:
request - The request to process.
Returns:
A Reply instance.
Throws:
org.w3c.tools.resources.ProtocolException - If some error occurs.