All Packages Class Hierarchy This Package Previous Next Index
Interface sun.server.util.URLContents
- public interface URLContents
This represents the interface to one disk cache entry in the
DiskCache object. A list of such entries form the disk cache.
-
available()
- Check if the contents in this URLContents is ready for
reading or is in the process of being fetched.
-
cacheable()
- Are these contents cacheable?
-
cacheHit()
- This indicates that the URLContents is being accessed.
-
getContentLength()
- The content length of the data on the input stream.
-
getContents()
- This is the input stream from which the contents of the
URL to be stored or the URL being retrieved is read.
-
getContentType()
- The mime type of the contents that is referred to by the URL.
-
getHeaders()
- return all the HTTP headers in a hash table format.
-
getLastModifiedDate()
- The last modified date on the URL.
-
getResponseCode()
- The status code returned from reading the URL.
-
getResponseMessage()
- The status message returned from reading the URL.
-
getURL()
- The URL that identifies these contents.
-
lastAccessTime()
- This is the time of last access on this URL.
-
numHits()
- when the URL is being read from the cache, this represents the
number of times the URL has been read since being stored in the
cache.
-
setCacheable(boolean)
- set whether the contents can be cached.
-
setHeaders(Hashtable)
- Set the header table.
-
setResponseCode(int)
- set the response status.
-
setResponseMessage(String)
- set the response message.
getURL
public abstract URL getURL()
- The URL that identifies these contents.
getContents
public abstract InputStream getContents() throws IOException
- This is the input stream from which the contents of the
URL to be stored or the URL being retrieved is read.
- Returns:
- the input stream from which contents of the URL is read
getContentLength
public abstract int getContentLength()
- The content length of the data on the input stream. If a
-1 is returned, the length is until EOF is read on the input
stream.
getContentType
public abstract String getContentType()
- The mime type of the contents that is referred to by the URL.
getLastModifiedDate
public abstract long getLastModifiedDate()
- The last modified date on the URL. The date is represented as
the number of miliseconds since Jan 1, 1970.
setResponseCode
public abstract void setResponseCode(int status)
- set the response status.
setResponseMessage
public abstract void setResponseMessage(String msg)
- set the response message.
getResponseCode
public abstract int getResponseCode()
- The status code returned from reading the URL.
Returns 200 - which is HTTP succcess by default.
getResponseMessage
public abstract String getResponseMessage()
- The status message returned from reading the URL.
Returns "OK" - which is HTTP succcess by default.
cacheable
public abstract boolean cacheable()
- Are these contents cacheable?
setCacheable
public abstract void setCacheable(boolean b)
- set whether the contents can be cached.
setHeaders
public abstract void setHeaders(Hashtable h)
- Set the header table.
The key is the header name, the value is the header value.
Stored under a special key "Status:" is the status line.
getHeaders
public abstract Hashtable getHeaders()
- return all the HTTP headers in a hash table format.
The key is the header name, the value is the header value.
Stored under a special key "Status:" is the status line.
numHits
public abstract int numHits()
- when the URL is being read from the cache, this represents the
number of times the URL has been read since being stored in the
cache.
lastAccessTime
public abstract long lastAccessTime()
- This is the time of last access on this URL. It is represented
in seconds since Jan 1, 1970.
cacheHit
public abstract void cacheHit()
- This indicates that the URLContents is being accessed.
When the URLContents object is cached, whenever the object is
referred to from the application, this method must be called, so
that the last accessed time and the number of hits can be updated.
available
public abstract boolean available()
- Check if the contents in this URLContents is ready for
reading or is in the process of being fetched.
- Returns:
- true if the data is ready for reading
false if the date is not ready for reading
All Packages Class Hierarchy This Package Previous Next Index