| org.w3c.tools.resources.ProtocolFrame org.w3c.jigsaw.frames.HTTPFrame
All known Subclasses: org.w3c.jigsaw.frames.NegotiatedFrame, org.w3c.jigsaw.proxy.ForwardFrame, org.w3c.jigsaw.status.StatisticsFrame, org.w3c.jigedit.frames.CvsFileFrame, org.w3c.jigsaw.frames.JpegComFrame, org.w3c.jigsaw.tutorials.FancyFrame, org.w3c.jigsaw.frames.HTTPExtFrame, org.w3c.jigsaw.servlet.ServletDirectoryFrame, org.w3c.jigsaw.frames.RedirecterFrame, org.w3c.jigsaw.admin.BrokerFrame, org.w3c.jigsaw.frames.VirtualHostFrame, org.w3c.jigsaw.servlet.ServletWrapperFrame, org.w3c.jigsaw.pagecompile.PageCompileFrame, org.w3c.jigsaw.resources.CheckpointFrame, org.w3c.jigsaw.status.ThreadStatFrame, org.w3c.jigsaw.frames.JpegXMPFrame, org.w3c.jigsaw.frames.LatestChildRedirectFrame, org.w3c.jigsaw.frames.PostableFrame, org.w3c.jigsaw.frames.AsIsFrame, org.w3c.jigsaw.frames.RelocateFrame, org.w3c.jigsaw.resources.DirectoryListerFrame, org.w3c.jigsaw.servlet.ServletMapperFrame, org.w3c.jigsaw.ssi.SSIFrame, org.w3c.jigsaw.zip.ZipFrame, org.w3c.jigsaw.proxy.Stats,
HTTPFrame | public class HTTPFrame extends ProtocolFrame (Code) | | Default class to handle the HTTP protocol, manage FileResource and
DirectoryResource.
|
Method Summary | |
public void | addStyleSheet(HtmlGenerator g) Add our own Style Sheet to the HtmlGenerator. | public void | attributeChanged(AttributeChangedEvent evt) Listen its resource. | public Reply | browse(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.
Parameters: request - The request to process. exception: ProtocolException - If some error occurs. | public boolean | checkExpect(Request request) Check the Expect condition of that request
Parameters: request - The request to check. | public int | checkIfMatch(Request request) Check the If-Match condition of that request.
Parameters: request - The request to check. | public int | checkIfModifiedSince(Request request) Check the If-Modified-Since condition of that request.
Parameters: request - The request to check. | public int | checkIfNoneMatch(Request request) Check the If-None-Match condition of that request.
Parameters: request - The request to check. | public int | checkIfUnmodifiedSince(Request request) Check the If-Unmodified-Since condition of that request.
Parameters: request - The request to check. | public boolean | checkRequest(RequestInterface request) Check the request.
Parameters: request - the incomming request. | public int | checkValidators(Request request) | public boolean | computeContainerListing(boolean refresh) | public String | computeETag() | protected File | computeTrashDir(File dir) | protected File | computeTrashFile(File file) | 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. | protected Reply | createFileReply(Request request) Create the reply relative to the given file.
Parameters: request - the incomming request. | public Reply | delete(Request request) The default DELETE method, actually the resource (file, directory)
is moved into the trash directory which is not accessible via HTTP. | protected Reply | deleteDirectoryResource(Request request) Perform a DELETE for the associated DirectoryResource.
Parameters: request - the incomming request. | protected Reply | deleteFileResource(Request request) Perform a DELETE for the associated FileResource.
Parameters: request - the incomming request. | protected Reply | deleteMe(Request request) | protected Reply | deleteOtherResource(Request request) Perform a DELETE for the associated resource.
Parameters: request - the incomming request. | public Reply | extended(Request request) | public Reply | get(Request request) The default GET method. | protected HttpTokenList | getAllow() | public boolean | getAllowDeleteFlag() | public boolean | getBrowsableFlag() Get this class browsable flag. | protected synchronized MimeType | getBrowseType() Get the Browse Mime type. | public String | getCharset() Get this resource charset. | public String | getContentEncoding() Get this resource content encoding. | public String | getContentLanguage() Get this resource content language. | public int | getContentLength() Get this resource content length. | public MimeType | getContentType() Get this resource content type. | public Reply | getDirectoryListing(Request request) Reply with an HTML doc listing the resources of this container.
This function takes special care not to regenerate a listing
when one is available. | public DirectoryResource | getDirectoryResource() | protected Reply | getDirectoryResource(Request request) Perform a GET for the associated DirectoryResource.
Parameters: request - the incomming request. | public HttpEntityTag | getETag() | public FileResource | getFileResource() | protected Reply | getFileResource(Request request) Get for FileResource
Parameters: request - the incomming request. | public String | getHelpURL() Get this resource's help url. | 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). | public String | getIcon() Get this resource's icon. | public String | getIconDirectory() Get the optional icon directory. | public String | getIndex() Get the optional main index name for this directory listing. | public String[] | getIndexes() Get the optional index name array for this directory listing. | public boolean | getMD5Flag() | public long | getMaxAge() Get this resource's max age. | protected Reply | getOtherResource(Request request) | public boolean | getPutableFlag() | public double | getQuality() Get this resource quality. | public boolean | getRelocateFlag() Should we relocate invalid requests to this directory. | public String | getStyleSheetURL() | public String | getTitle() Get this resource title. | public URL | getURL(Request request) Get the full URL for that resource. | public Reply | handleRangeRequest(Request request, HttpRange r) | public Reply | head(Request request) The default HEAD method replies does a GET and removes entity. | protected Reply | headDirectoryResource(Request request) Perform a HEAD request for the associated DirectoryResource.
Parameters: request - the incomming request. | protected Reply | headFileResource(Request request) Perform a HEAD request for the associated FileResource.
Parameters: request - the incomming request. | protected Reply | headOtherResource(Request request) Perform a HEAD request for the associated resource.
Parameters: request - the incomming request. | public void | initialize(Hashtable defs) Initialization method for attribute holders. | public Reply | link(Request request) The default LINK method replies with a not implemented. | public boolean | lookup(LookupState ls, LookupResult lr) Lookup the target resource. | protected boolean | lookupDirectory(LookupState ls, LookupResult lr) Lookup the target resource when associated with a DirectoryResource. | protected boolean | lookupFile(LookupState ls, LookupResult lr) Lookup the target resource when associated with a FileResource. | protected boolean | lookupOther(LookupState ls, LookupResult lr) Lookup the target resource when associated with an unknown resource. | protected boolean | lookupResource(LookupState ls, LookupResult lr) Lookup the target resource (dispath to more specific lookup methods). | public Reply | options(Request request) The default OPTIONS method replies with a not implemented. | public ReplyInterface | perform(RequestInterface req) | protected ReplyInterface | performFrames(RequestInterface request) Perform the request on all the frames of that resource. | public void | pickleValues(Hashtable defs) Set the values. | public Reply | post(Request request) The default POST method replies with a not implemented. | public Reply | put(Request request) The default PUT method. | protected Reply | putFileResource(Request request) Change the content of the associated FileResource. | protected Reply | putOtherResource(Request request) Always throw a ProtocolException.
Parameters: request - The incmming request. | public void | registerOtherResource(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. | public void | registerResource(FramedResource resource) Register this frame to the given resource. | public synchronized void | setValue(int idx, Object value) Catch setValue, to maintain cached header values correctness. | public Reply | trace(Request request) | public Reply | unlink(Request request) The default UNLINK method replies with a not implemented. | public double | unsafeGetQuality() Get this resource quality. | protected void | updateCachedHeaders() Update the cached headers value. |
ATTR_ALLOW_DEL | protected static int ATTR_ALLOW_DEL(Code) | | Attribute index - delete allowed for the associated resource ?
|
ATTR_BROWSABLE | protected static int ATTR_BROWSABLE(Code) | | Attribute index - Allow the GNN browse method.
|
ATTR_CHARSET | protected static int ATTR_CHARSET(Code) | | Attribute index - The index for the charset attribute.
|
ATTR_CONTENT_ENCODING | protected static int ATTR_CONTENT_ENCODING(Code) | | Attribute index - The index for the content encodings attribute.
|
ATTR_CONTENT_LANGUAGE | protected static int ATTR_CONTENT_LANGUAGE(Code) | | Attribute index - The index for the content languages attribute.
|
ATTR_CONTENT_LENGTH | protected static int ATTR_CONTENT_LENGTH(Code) | | Attribute index - The index for the content length attribute.
|
ATTR_CONTENT_TYPE | protected static int ATTR_CONTENT_TYPE(Code) | | Attribute index - The index for the content type attribute.
|
ATTR_ICON | protected static int ATTR_ICON(Code) | | Attribute index - The icon (if any) associated to the resource.
|
ATTR_ICONDIR | protected static int ATTR_ICONDIR(Code) | | Attribute index - The icon directory to use in dir listing.
|
ATTR_INDEX | protected static int ATTR_INDEX(Code) | | Attribute index - our index resource name.
|
ATTR_INDEXES | protected static int ATTR_INDEXES(Code) | | Attribute index - our indexes resource name.
|
ATTR_MAXAGE | protected static int ATTR_MAXAGE(Code) | | Attribute index - Max age: the maximum drift allowed from reality.
|
ATTR_MD5 | protected static int ATTR_MD5(Code) | | Attribute index - Send MD5 Digest: the md5 digest of the resource sent
|
ATTR_PUTABLE | protected static int ATTR_PUTABLE(Code) | | Attribute index - Do we allow PUT method on this file.
|
ATTR_QUALITY | protected static int ATTR_QUALITY(Code) | | Attributes index - The index for the quality attribute.
|
ATTR_RELOCATE | protected static int ATTR_RELOCATE(Code) | | Attribute index - The index for our relocate attribute.
|
ATTR_STYLE_LINK | protected static int ATTR_STYLE_LINK(Code) | | Attribute index - Style sheet for directory listing
|
ATTR_TITLE | protected static int ATTR_TITLE(Code) | | Attribute index - The index for the title attribute.
|
COND_FAILED | final public static int COND_FAILED(Code) | | Condition check return code - Condition existed but failed.
|
COND_OK | final public static int COND_OK(Code) | | Condition check return code - Condition existed and succeeded.
|
COND_WEAK | final public static int COND_WEAK(Code) | | Condition check return code - Condition existed and succeeded
but is a weak validation.
|
STATE_CONTENT_LOCATION | final public static String STATE_CONTENT_LOCATION(Code) | | |
acceptRanges | protected boolean acceptRanges(Code) | | Does this resource support byte ranges.
|
allowed | protected HttpTokenList allowed(Code) | | Methods allowed by instances of that class in particular:
|
browsetype | protected static MimeType browsetype(Code) | | The Browse Mime type.
|
listing_stamp | protected long listing_stamp(Code) | | The time at which we generated the directory index.
|
addStyleSheet | public void addStyleSheet(HtmlGenerator g)(Code) | | Add our own Style Sheet to the HtmlGenerator.
Parameters: g - The HtmlGenerator. |
browse | public Reply browse(Request request) throws ProtocolException(Code) | | 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. exception: ProtocolException - If some error occurs. A Reply instance. |
checkExpect | public boolean checkExpect(Request request)(Code) | | Check the Expect condition of that request
Parameters: request - The request to check. A boolean true if the requirement is known |
checkIfMatch | public int checkIfMatch(Request request)(Code) | | Check the If-Match condition of that request.
Parameters: request - The request to check. An integer, either COND_FAILED if conditionwas checked, but failed, COND_OK if condition was checkedand succeeded, or 0 if the condition was not checkedat all (eg because the resource or the request didn't support it). |
checkIfModifiedSince | public int checkIfModifiedSince(Request request)(Code) | | Check the If-Modified-Since condition of that request.
Parameters: request - The request to check. An integer, either COND_FAILED if conditionwas checked, but failed, COND_OK if condition was checkedand succeeded, or 0 if the condition was not checkedat all (eg because the resource or the request didn't support it). |
checkIfNoneMatch | public int checkIfNoneMatch(Request request)(Code) | | Check the If-None-Match condition of that request.
Parameters: request - The request to check. An integer, either COND_FAILED if conditionwas checked, but failed, COND_OK if condition was checkedand succeeded, or 0 if the condition was not checkedat all (eg because the resource or the request didn't support it). |
checkIfUnmodifiedSince | public int checkIfUnmodifiedSince(Request request)(Code) | | Check the If-Unmodified-Since condition of that request.
Parameters: request - The request to check. An integer, either COND_FAILED if conditionwas checked, but failed, COND_OK if condition was checkedand succeeded, or 0 if the condition was not checkedat all (eg because the resource or the request didn't support it). |
checkRequest | public boolean checkRequest(RequestInterface request)(Code) | | Check the request.
Parameters: request - the incomming request. true if the request is an HTTP Request. |
checkValidators | public int checkValidators(Request request)(Code) | | check the validators namely LMT/Etags according to rfc2616 rules
An integer, either COND_FAILED if conditionwas checked, but failed, COND_OK if condition was checkedand succeeded, or 0 if the condition was not checkedat all (eg because the resource or the request didn't support it). |
computeContainerListing | public boolean computeContainerListing(boolean refresh)(Code) | | Get ContainerResource listing
Parameters: refresh - should we refresh the listing? a boolean (true if refreshed) |
computeETag | public String computeETag()(Code) | | Compute the ETag string
a string or null if not applicable |
createDefaultReply | public Reply createDefaultReply(Request request, int status)(Code) | | 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. An instance of Reply, suited to answer this request. |
getAllow | protected HttpTokenList getAllow()(Code) | | get the Allowed methods for this resource
an HttpTokenList |
getAllowDeleteFlag | public boolean getAllowDeleteFlag()(Code) | | delete allowed for the associated resource ?
|
getBrowsableFlag | public boolean getBrowsableFlag()(Code) | | Get this class browsable flag.
|
getBrowseType | protected synchronized MimeType getBrowseType()(Code) | | Get the Browse Mime type.
|
getCharset | public String getCharset()(Code) | | Get this resource charset.
A String, or null if notdefined. |
getContentEncoding | public String getContentEncoding()(Code) | | 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).
A string of comma separated encoding tokens, ornull if not defined. |
getContentLanguage | public String getContentLanguage()(Code) | | Get this resource content language.
Language are stored as a comma separated String of tokens.
A comma separated string of language tokens, ornull if undefined. |
getContentLength | public int getContentLength()(Code) | | Get this resource content length.
The resource content length, or -1 if notdefined. |
getContentType | public MimeType getContentType()(Code) | | Get this resource content type.
An instance of MIMEType, or null if notdefined. |
getDirectoryListing | public Reply getDirectoryListing(Request request) throws ProtocolException, ResourceException(Code) | | Reply with an HTML doc listing the resources of this container.
This function takes special care not to regenerate a listing
when one is available. It also caches the date of the
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. exception: ProtocolException - If processsing the request failed. exception: ResourceException - If the resource got a fatal error. |
getDirectoryResource | public DirectoryResource getDirectoryResource()(Code) | | Get the associated DirectoryResource (if any)
a DirectoryResource instance or nullif no DirectoryResource is associated with this frame. |
getETag | public HttpEntityTag getETag()(Code) | | Get this resource Etag
an instance of HttpEntityTag, or null if notdefined. |
getFileResource | public FileResource getFileResource()(Code) | | Get the associated FileResource (if any)
a FileResource instance or nullif no FileResource is associated with this frame. |
getHelpURL | public String getHelpURL()(Code) | | Get this resource's help url.
An URL, encoded as a String, or null if notavailable. |
getHelpURL | public String getHelpURL(String topic)(Code) | | Get the help URL for that resource's attribute.
Parameters: topic - The topic (can be an attribute name, or a property, etc). A String encoded URL, or null. |
getIcon | public String getIcon()(Code) | | Get this resource's icon.
|
getIconDirectory | public String getIconDirectory()(Code) | | Get the optional icon directory.
|
getIndex | public String getIndex()(Code) | | Get the optional main index name for this directory listing.
The name of the resource responsible to list that container. |
getIndexes | public String[] getIndexes()(Code) | | Get the optional index name array for this directory listing.
The index name array (including the main index) See Also: HTTPFrame.getIndex |
getMD5Flag | public boolean getMD5Flag()(Code) | | Do we send the MD5 digest?
|
getMaxAge | public long getMaxAge()(Code) | | 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()(Code) | | Get the PUT'able flag (are we allow to PUT to the resource ?)
|
getQuality | public double getQuality()(Code) | | Get this resource quality.
The resource quality, or some negative value if not defined. |
getRelocateFlag | public boolean getRelocateFlag()(Code) | | Should we relocate invalid requests to this directory.
A boolean true if we should relocate. |
getStyleSheetURL | public String getStyleSheetURL()(Code) | | Get this frame style sheet link
|
getTitle | public String getTitle()(Code) | | Get this resource title.
This resource's title, or null if not defined. |
getURL | public URL getURL(Request request)(Code) | | Get the full URL for that resource.
An URL instance. |
handleRangeRequest | public Reply handleRangeRequest(Request request, HttpRange r) throws ProtocolException(Code) | | handles a Range Request
request, the request r, the HttpRange a Reply if range is valid, or null if there is a change in theresource, or if the HttpRange is not valid ( 4-2, for example). exception: ProtocolException - If processsing the request failed. |
initialize | public void initialize(Hashtable defs)(Code) | | Initialization method for attribute holders.
This method allows to initialize an attribute holder by providing
its attributes values through a Hashtable mapping attribute names
to attribute values.
Parameters: defs - The Hashtable containing the default values. |
lookupDirectory | protected boolean lookupDirectory(LookupState ls, LookupResult lr) throws ProtocolException(Code) | | Lookup the target resource when associated with a DirectoryResource.
Parameters: ls - The current lookup state Parameters: lr - The result true if lookup is done. exception: ProtocolException - If an error relative to the protocoloccurs |
lookupFile | protected boolean lookupFile(LookupState ls, LookupResult lr) throws ProtocolException(Code) | | Lookup the target resource when associated with a FileResource.
Parameters: ls - The current lookup state Parameters: lr - The result true if lookup is done. exception: ProtocolException - If an error relative to the protocol occurs |
lookupOther | protected boolean lookupOther(LookupState ls, LookupResult lr) throws ProtocolException(Code) | | Lookup the target resource when associated with an unknown resource.
Parameters: ls - The current lookup state Parameters: lr - The result true if lookup is done. exception: ProtocolException - If an error relative to the protocol occurs |
pickleValues | public void pickleValues(Hashtable defs)(Code) | | Set the values. (MUST be called before initialize).
Parameters: defs - The Hashtable containing the values. |
registerOtherResource | public void registerOtherResource(FramedResource resource)(Code) | | 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. |
registerResource | public void registerResource(FramedResource resource)(Code) | | Register this frame to the given resource.
Parameters: resource - The resource associated with this frame. |
setValue | public synchronized void setValue(int idx, Object value)(Code) | | Catch setValue, to maintain cached header values correctness.
Parameters: idx - The index of the attribute to be set. Parameters: value - The new value for the attribute. |
unsafeGetQuality | public double unsafeGetQuality()(Code) | | Get this resource quality.
The resource quality, or some negative value if not defined. |
updateCachedHeaders | protected void updateCachedHeaders()(Code) | | 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.
|
|
|