org.w3c.www.protocol.http
Class Reply

java.lang.Object
  extended by org.w3c.www.http.HttpMessage
      extended by org.w3c.www.http.HttpEntityMessage
          extended by org.w3c.www.http.HttpReplyMessage
              extended by org.w3c.www.protocol.http.Reply
All Implemented Interfaces:
java.lang.Cloneable, HTTP, MimeHeaderHolder
Direct Known Subclasses:
DAVReply, PushReply

public class Reply
extends HttpReplyMessage


Field Summary
protected static HttpMimeType DEFAULT_TYPE
           
protected  boolean definesInput
           
protected  java.io.InputStream input
           
 
Fields inherited from class org.w3c.www.http.HttpReplyMessage
H_ACCEPT_RANGES, H_AGE, H_AUTHENTICATION_INFO, H_LOCATION, H_PROXY_AUTHENTICATE, H_PUBLIC, H_RETRY_AFTER, H_SERVER, H_VARY, H_WARNING, H_WWW_AUTHENTICATE, reason, status
 
Fields inherited from class org.w3c.www.http.HttpEntityMessage
H_ALLOW, H_CONTENT_BASE, H_CONTENT_ENCODING, H_CONTENT_LANGUAGE, H_CONTENT_LENGTH, H_CONTENT_LOCATION, H_CONTENT_MD5, H_CONTENT_RANGE, H_CONTENT_TYPE, H_ETAG, H_EXPIRES, H_LAST_MODIFIED
 
Fields inherited from class org.w3c.www.http.HttpMessage
descriptors, EMIT_ALL, EMIT_BODY, EMIT_FOOTERS, EMIT_HEADERS, emitdate, factory, H_CACHE_CONTROL, H_CMAN_EXT, H_CONNECTION, H_COOKIE, H_COPT_EXT, H_DATE, H_MAN_EXT, H_OPT_EXT, H_PRAGMA, H_PROTOCOL, H_PROTOCOL_INFO, H_PROTOCOL_QUERY, H_PROTOCOL_REQUEST, H_PROXY_CONNECTION, H_SET_COOKIE, H_TRAILER, H_TRANSFER_ENCODING, H_UPGRADE, H_VIA, headers, major, MAX_HEADERS, minor, state, values
 
Fields inherited from interface org.w3c.www.http.HTTP
ACCEPTED, BAD_GATEWAY, BAD_REQUEST, byteArrayVersion, CONFLICT, CONNECT, CONTINUE, CREATED, DELETE, DONE, EXPECTATION_FAILED, FORBIDDEN, FOUND, GATEWAY_TIMEOUT, GET, GONE, HEAD, HTTP_100_CONTINUE, HTTP_VERSION_NOT_SUPPORTED, INTERNAL_SERVER_ERROR, LENGTH_REQUIRED, major_number, minor_number, MOVED_PERMANENTLY, msg_100, msg_200, msg_300, msg_400, msg_500, MULTIPLE_CHOICE, NO_CONTENT, NOHEADER, NON_AUTHORITATIVE_INFORMATION, NOT_ACCEPTABLE, NOT_ALLOWED, NOT_EXTENDED, NOT_FOUND, NOT_IMPLEMENTED, NOT_MODIFIED, OK, OPTIONS, PARTIAL_CONTENT, PAYMENT_REQUIRED, POST, PRECONDITION_FAILED, PROXY_AUTH_REQUIRED, PUT, REQUEST_ENTITY_TOO_LARGE, REQUEST_TIMEOUT, REQUEST_URI_TOO_LONG, REQUESTED_RANGE_NOT_SATISFIABLE, RESET_CONTENT, SEE_OTHER, SERVICE_UNAVAILABLE, SWITCHING, TEMPORARY_REDIRECT, TRACE, UNAUTHORIZED, UNSUPPORTED_MEDIA_TYPE, USE_PROXY
 
Constructor Summary
protected Reply(MimeParser parser)
           
protected Reply(short major, short minor, int status)
           
 
Method Summary
 java.io.InputStream getInputStream()
          Get this reply entity body.
 boolean hasInputStream()
          Does this reply has an associated entity stream ?
 boolean keepsAlive()
           
protected  void matchesRequest(Request request)
          Notify this reply that is has been built to answer given request.
 void setContent(java.lang.String msg)
          Set this reply content.
 void setStream(java.io.InputStream input)
          Set this reply's input stream.
protected  void setStreamObserver(HttpStreamObserver observer)
          Set an stream observer on the reply entity stream.
 
Methods inherited from class org.w3c.www.http.HttpReplyMessage
addAuthenticationInfo, addWarning, checkMustRevalidate, checkProxyRevalidate, checkPublic, dump, getAcceptRanges, getAge, getAuthenticationInfo, getLocation, getPrivate, getProxyAuthenticate, getPublic, getReason, getServer, getStandardReason, getStatus, getVary, getWarning, getWWWAuthenticate, notifyBeginParsing, setAcceptRanges, setAge, setAuthenticationInfo, setLocation, setLocation, setMustRevalidate, setProxyAuthenticate, setProxyRevalidate, setPublic, setPublic, setReason, setRetryAfter, setRetryAfter, setServer, setStatus, setVary, setWarning, setWWWAuthenticate, startEmit
 
Methods inherited from class org.w3c.www.http.HttpEntityMessage
addContentEncoding, getAllow, getContentBase, getContentEncoding, getContentLanguage, getContentLength, getContentLocation, getContentMD5, getContentRange, getContentType, getETag, getExpires, getLastModified, hasContentRange, setAllow, setContentBase, setContentEncoding, setContentLanguage, setContentLength, setContentLocation, setContentMD5, setContentType, setETag, setExpires, setLastModified
 
Methods inherited from class org.w3c.www.http.HttpMessage
addConnection, addNoCache, addPragma, addProxyConnection, addTransferEncoding, addVia, checkNoStore, checkOnlyIfCached, delState, emit, emit, emitHeaders, endEmit, enumerateHeaderDescriptions, enumerateHeaderDescriptions, generateExtNamespace, getCacheControl, getClone, getCManExtHeader, getConnection, getCookie, getCOptExtHeader, getDate, getDeeperClone, getEmitDate, getExtensionHeaders, getExtHeader, getExtList, getHeaderValue, getHeaderValue, getHeaderValue, getHeaderValue, getHttpCManExtDecl, getHttpCOptExtDecl, getHttpManExtDecl, getHttpOptExtDecl, getMajorVersion, getManExtHeader, getMaxAge, getMinorVersion, getNoCache, getOptExtHeader, getPragma, getProtocol, getProtocolInfo, getProtocolQuery, getProtocolRequest, getProxyConnection, getSetCookie, getSMaxAge, getState, getStateNames, getTrailer, getTransferEncoding, getUpgrade, getValue, getValue, getVersion, getVia, hasConnection, hasHeader, hasHeader, hasPragma, hasProxyConnection, hasState, hasTransferEncoding, notifyEndParsing, notifyHeader, registerExtHeader, registerHeader, registerHeader, removeHeader, removeHeader, setCacheControl, setConnection, setCookie, setDate, setEnd2EndExtensionAcknowledgmentHeader, setExtensionHeader, setHeaderValue, setHeaderValue, setHeaderValue, setHopByHopExtensionAcknowledgmentHeader, setHttpCManExtDecl, setHttpCOptExtDecl, setHttpExtDecl, setHttpManExtDecl, setHttpOptExtDecl, setMaxAge, setNamespaces, setNoCache, setNoCache, setNoStore, setOnlyIfCached, setPragma, setProtocol, setProtocolInfo, setProtocolQuery, setProtocolRequest, setProxyConnection, setSetCookie, setSMaxAge, setState, setTrailer, setTransferEncoding, setUpgrade, setValue, setVia
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_TYPE

protected static HttpMimeType DEFAULT_TYPE

input

protected java.io.InputStream input

definesInput

protected boolean definesInput
Constructor Detail

Reply

protected Reply(short major,
                short minor,
                int status)

Reply

protected Reply(MimeParser parser)
Method Detail

keepsAlive

public boolean keepsAlive()

setStreamObserver

protected void setStreamObserver(HttpStreamObserver observer)
Set an stream observer on the reply entity stream. This method should be called before any caller gets a chance to execute getInputStream. It is needed for HttpServer instances to be notified when the stream becomes available for the next request.


matchesRequest

protected void matchesRequest(Request request)
Notify this reply that is has been built to answer given request. Perform has many ugly hack HTTP/1.1 requires.

Parameters:
request - The request that is answered by this reply.

setStream

public void setStream(java.io.InputStream input)
Set this reply's input stream.

Parameters:
input - The stream to read the reply's entity from.

getInputStream

public java.io.InputStream getInputStream()
                                   throws java.io.IOException
Get this reply entity body. The reply entity body is returned as an InputStream, that the caller has to read to actually get the bytes of the content.

Returns:
An InputStream instance. If the reply has no body, the returned input stream will just return -1 on first read.
Throws:
java.io.IOException

hasInputStream

public boolean hasInputStream()
                       throws java.io.IOException
Does this reply has an associated entity stream ?

Returns:
A boolean, true if the reply has an entity stream, false otherwise.
Throws:
java.io.IOException

setContent

public void setContent(java.lang.String msg)
Set this reply content. This method allows to set the reply content to a simple String instance.

Parameters:
msg - The reply content.