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

Variable Index

 o chunkable
Should this reply be chunked ?

Constructor Index

 o Reply(Client)
Create a new Reply instance for the given client.
 o Reply(Client, String, Integer)
Create a new reply for the given client.

Method Index

 o addHeader(String, String)
Add an extension header in the reply.
 o canChunkTransfer()
 o emit()
Emit this reply headers.
 o getContentLength()
Get this reply content length.
 o getContentType()
Get this reply content-type.
 o getInputFileDescriptor()
Try to get the rpely file descriptyor, if available.
 o getStatus()
Get this reply current status.
 o hasConnection()
Does this request has a connection header value defined ?
 o hasContentLength()
Does the reply caries content length information ?
 o hasHeader(String)
Check for an extension header.
 o isProxy()
Is this reply a proxy reply.
 o keepConnection()
 o keepProxyConnection()
 o openStream()
Open this reply body stream.
 o setConnection(String)
Set this reply connection header.
 o setContent(String)
Set this reply content.
 o setContentEncoding(String)
Set this reply content encoding.
 o setContentLanguage(String)
Set this reply's content language.
 o setContentLength(int)
Set this reply content length.
 o setContentType(MIMEType)
Set this reply content type.
 o setContentType(String)
Set the reply content type.
 o setExpires(Date)
Set the reply body expiration date.
 o setKeepAlive(String)
Set this reply keep alive header field value.
 o setKeepConnection(boolean)
Set the status of this connection.
 o setLastModified(long)
Set the reply last-modified header.
 o setLocation(String)
Set the reply localtion header field.
 o setProxy()
Mark this reply as being a proxy reply.
 o setProxyConnection(String)
Set this proxy'ed connection header.
 o setProxyKeepConnection(boolean)
Set the status of this proxy'ed connection.
 o setStatus(int)
Sets the reply HTTP status.
 o setStatus(Integer)
Sets the reply HTTP status.
 o setStream(HtmlGenerator)
Sets the reply stream to the given HtmlGenerator stream.
 o setStream(InputStream)
Sets the stream containing the replied entity.
 o setURIHeader(String)
Set this reply URI header field.
 o setURIHeader(String, String)
Set this reply URI field, with varying dimensions.
 o setWWWAuthenticate(String, String)
Set this reply authenticate header value.
 o unsetContentLength()
Unset the reply content length.
 o unsetLastModified()
Unset any previously set last-modification date.

Variables

 o chunkable
  protected Boolean chunkable
Should this reply be chunked ?

Constructors

 o Reply
  public Reply(Client client)
Create a new Reply instance for the given client.
Parameters:
client - The client to who this reply is directed.
 o 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.

Methods

 o isProxy
  public boolean isProxy()
Is this reply a proxy reply.
 o setProxy
  public void setProxy()
Mark this reply as being a proxy reply.
 o 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.
 o 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.
 o 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.
 o keepConnection
  public boolean keepConnection()
 o setProxyKeepConnection
  public void setProxyKeepConnection(boolean onoff)
Set the status of this proxy'ed connection.
Parameters:
onoff - Turn the toggle on or off.
 o keepProxyConnection
  public boolean keepProxyConnection()
 o 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.
 o 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.

 o getStatus
  public Integer getStatus()
Get this reply current status.
 o setContentEncoding
  public void setContentEncoding(String content_encoding)
Set this reply content encoding.
Parameters:
content_encoding - The String describing the content encoding.
 o hasContentLength
  public boolean hasContentLength()
Does the reply caries content length information ?
Returns:
true if content length is available.
 o setContentLength
  public void setContentLength(int len)
Set this reply content length.
Parameters:
len - The content length.
 o unsetContentLength
  public void unsetContentLength()
Unset the reply content length. Usefull if you change on the fly the reply content.
 o setContentLanguage
  public void setContentLanguage(String lang)
Set this reply's content language.
Parameters:
lang - The language tag(s)
 o getContentLength
  public int getContentLength()
Get this reply content length.
 o setContentType
  public void setContentType(MIMEType type)
Set this reply content type.
Parameters:
type - The reply content MIME type
See Also:
MIMEType
 o setContentType
  public void setContentType(String type)
Set the reply content type.
Parameters:
type - The content type, given as a String.
 o getContentType
  public String getContentType()
Get this reply content-type.
Returns:
A string describing the content type.
 o setLastModified
  public void setLastModified(long ld)
Set the reply last-modified header.
Parameters:
ld - The date of the content last modification.
 o unsetLastModified
  public void unsetLastModified()
Unset any previously set last-modification date.
 o setExpires
  public void setExpires(Date d)
Set the reply body expiration date.
Parameters:
d - The date of expiration.
 o setLocation
  public void setLocation(String location)
Set the reply localtion header field.
 o setURIHeader
  public void setURIHeader(String uri)
Set this reply URI header field.
Parameters:
uri - The value of the URI header field.
 o 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.
 o 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.
 o setConnection
  public void setConnection(String value)
Set this reply connection header.
Parameters:
value - The value of the connection header.
 o setProxyConnection
  public void setProxyConnection(String value)
Set this proxy'ed connection header.
Parameters:
value - The value of the proxy-connection header.
 o setKeepAlive
  public void setKeepAlive(String value)
Set this reply keep alive header field value.
Parameters:
value - The value of the keep alive header field.
 o hasConnection
  public boolean hasConnection()
Does this request has a connection header value defined ?
Returns:
true if a value is defined.
 o 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.
 o 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.
 o 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.
 o getInputFileDescriptor
  public FileDescriptor getInputFileDescriptor() throws IOException
Try to get the rpely file descriptyor, if available.
Returns:
An FileDescriptor, of null if not available.
 o canChunkTransfer
  public boolean canChunkTransfer()
 o 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.
 o 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