Class w3c.jigsaw.http.Reply
All Packages Class Hierarchy This Package Previous Next Index
Class w3c.jigsaw.http.Reply
java.lang.Object
|
+----w3c.jigsaw.http.Reply
- public class Reply
- extends Object
-
chunkable
- Should this reply be chunked ?
-
Reply(Client)
- Create a new Reply instance for the given client.
-
Reply(Client, String, Integer)
- Create a new reply for the given client.
-
addHeader(String, String)
- Add an extension header in the reply.
-
canChunkTransfer()
-
-
emit()
- Emit this reply headers.
-
getContentLength()
- Get this reply content length.
-
getContentType()
- Get this reply content-type.
-
getInputFileDescriptor()
- Try to get the rpely file descriptyor, if available.
-
getStatus()
- Get this reply current status.
-
hasConnection()
- Does this request has a connection header value defined ?
-
hasContentLength()
- Does the reply caries content length information ?
-
hasHeader(String)
- Check for an extension header.
-
isProxy()
- Is this reply a proxy reply.
-
keepConnection()
-
-
keepProxyConnection()
-
-
openStream()
- Open this reply body stream.
-
setConnection(String)
- Set this reply connection header.
-
setContent(String)
- Set this reply content.
-
setContentEncoding(String)
- Set this reply content encoding.
-
setContentLanguage(String)
- Set this reply's content language.
-
setContentLength(int)
- Set this reply content length.
-
setContentType(MIMEType)
- Set this reply content type.
-
setContentType(String)
- Set the reply content type.
-
setExpires(Date)
- Set the reply body expiration date.
-
setKeepAlive(String)
- Set this reply keep alive header field value.
-
setKeepConnection(boolean)
- Set the status of this connection.
-
setLastModified(long)
- Set the reply last-modified header.
-
setLocation(String)
- Set the reply localtion header field.
-
setProxy()
- Mark this reply as being a proxy reply.
-
setProxyConnection(String)
- Set this proxy'ed connection header.
-
setProxyKeepConnection(boolean)
- Set the status of this proxy'ed connection.
-
setStatus(int)
- Sets the reply HTTP status.
-
setStatus(Integer)
- Sets the reply HTTP status.
-
setStream(HtmlGenerator)
- Sets the reply stream to the given HtmlGenerator stream.
-
setStream(InputStream)
- Sets the stream containing the replied entity.
-
setURIHeader(String)
- Set this reply URI header field.
-
setURIHeader(String, String)
- Set this reply URI field, with varying dimensions.
-
setWWWAuthenticate(String, String)
- Set this reply authenticate header value.
-
unsetContentLength()
- Unset the reply content length.
-
unsetLastModified()
- Unset any previously set last-modification date.
chunkable
protected Boolean chunkable
- Should this reply be chunked ?
Reply
public Reply(Client client)
- Create a new Reply instance for the given client.
- Parameters:
- client - The client to who this reply is directed.
Reply
public Reply(Client client,
String version,
Integer status)
- Create a new reply for the given client.
- Parameters:
- client - The client ot who the reply is directed.
isProxy
public boolean isProxy()
- Is this reply a proxy reply.
setProxy
public void setProxy()
- Mark this reply as being a proxy reply.
addHeader
public void addHeader(String name,
String value)
- Add an extension header in the reply.
This mechanism allows for protocol extensions.
- Parameters:
- name - The extended header name.
- value - The extended header value.
hasHeader
public boolean hasHeader(String name)
- Check for an extension header.
- Parameters:
- name - The header name to test.
- Returns:
- true if the named header already has some value
false otherwise.
setKeepConnection
public void setKeepConnection(boolean onoff)
- Set the status of this connection.
Turining this toggle off will make
the server break the connection at the end of request processing.
This defaults to true
- Parameters:
- onoff - Turn the toggle on or off.
keepConnection
public boolean keepConnection()
setProxyKeepConnection
public void setProxyKeepConnection(boolean onoff)
- Set the status of this proxy'ed connection.
- Parameters:
- onoff - Turn the toggle on or off.
keepProxyConnection
public boolean keepProxyConnection()
setStatus
public void setStatus(Integer status)
- Sets the reply HTTP status.
If a default body for the provided status is given at configuration
time, this method will set the Reply stream accordingly. This means
that you should, as a simple rule of thumb always set the Reply status
before the Reply stream
- Parameters:
- status - An Integer object indicating the status, see the publicly
defined status code of this class.
setStatus
public void setStatus(int status)
- Sets the reply HTTP status.
This method takes a true integer instead of an Integer object. Use
it only when required.
getStatus
public Integer getStatus()
- Get this reply current status.
setContentEncoding
public void setContentEncoding(String content_encoding)
- Set this reply content encoding.
- Parameters:
- content_encoding - The String describing the content encoding.
hasContentLength
public boolean hasContentLength()
- Does the reply caries content length information ?
- Returns:
- true if content length is available.
setContentLength
public void setContentLength(int len)
- Set this reply content length.
- Parameters:
- len - The content length.
unsetContentLength
public void unsetContentLength()
- Unset the reply content length.
Usefull if you change on the fly the reply content.
setContentLanguage
public void setContentLanguage(String lang)
- Set this reply's content language.
- Parameters:
- lang - The language tag(s)
getContentLength
public int getContentLength()
- Get this reply content length.
setContentType
public void setContentType(MIMEType type)
- Set this reply content type.
- Parameters:
- type - The reply content MIME type
- See Also:
- MIMEType
setContentType
public void setContentType(String type)
- Set the reply content type.
- Parameters:
- type - The content type, given as a String.
getContentType
public String getContentType()
- Get this reply content-type.
- Returns:
- A string describing the content type.
setLastModified
public void setLastModified(long ld)
- Set the reply last-modified header.
- Parameters:
- ld - The date of the content last modification.
unsetLastModified
public void unsetLastModified()
- Unset any previously set last-modification date.
setExpires
public void setExpires(Date d)
- Set the reply body expiration date.
- Parameters:
- d - The date of expiration.
setLocation
public void setLocation(String location)
- Set the reply localtion header field.
setURIHeader
public void setURIHeader(String uri)
- Set this reply URI header field.
- Parameters:
- uri - The value of the URI header field.
setURIHeader
public void setURIHeader(String uri,
String vary_dim)
- Set this reply URI field, with varying dimensions.
- Parameters:
- uri - The reply URI.
- vary_dim - The varying dimensions.
setWWWAuthenticate
public void setWWWAuthenticate(String scheme,
String info)
- Set this reply authenticate header value.
- Parameters:
- scheme - The authentication scheme used to protecte entity.
- info - Any additional informations, as described in HTTP
specification.
setConnection
public void setConnection(String value)
- Set this reply connection header.
- Parameters:
- value - The value of the connection header.
setProxyConnection
public void setProxyConnection(String value)
- Set this proxy'ed connection header.
- Parameters:
- value - The value of the proxy-connection header.
setKeepAlive
public void setKeepAlive(String value)
- Set this reply keep alive header field value.
- Parameters:
- value - The value of the keep alive header field.
hasConnection
public boolean hasConnection()
- Does this request has a connection header value defined ?
- Returns:
- true if a value is defined.
setStream
public void setStream(InputStream is)
- Sets the stream containing the replied entity.
This method sets up the stream containing the entity body into the
reply. The provided stream should be ready to read, and will be closed
once emitted.
- Parameters:
- is - The stream containing the replied entity body.
setStream
public void setStream(HtmlGenerator g)
- Sets the reply stream to the given HtmlGenerator stream.
- Parameters:
- g - The HtmlGenerator whose output is to be used as the reply body.
openStream
public InputStream openStream()
- Open this reply body stream.
This is used to send the reply body back to the client.
- Returns:
- An InputStream containing the reply body, which is dumped
back to the client.
getInputFileDescriptor
public FileDescriptor getInputFileDescriptor() throws IOException
- Try to get the rpely file descriptyor, if available.
- Returns:
- An FileDescriptor, of null if not available.
canChunkTransfer
public boolean canChunkTransfer()
setContent
public void setContent(String msg)
- Set this reply content.
This method allows to set the reply content to a simple String instance.
- Parameters:
- msg - The reply content.
emit
public void emit() throws IOException
- Emit this reply headers.
- Throws: IOException
- If IO error occurs while sending the reply
headers.
All Packages Class Hierarchy This Package Previous Next Index