|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.xlightweb.Part
org.xlightweb.HttpResponse
public class HttpResponse
http response
Field Summary |
---|
Fields inherited from interface org.xlightweb.IHttpMessage |
---|
CONNECT_METHOD, DEFAULT_ENCODING, DEFAULT_ENCODING_KEY, DELETE_METHOD, GET_METHOD, HEAD_METHOD, OPTIONS_METHOD, POST_METHOD, PUT_METHOD, TRACE_METHOD |
Constructor Summary | |
---|---|
HttpResponse(File file)
constructor. |
|
HttpResponse(IHttpResponseHeader responseHeader)
constructor |
|
HttpResponse(IHttpResponseHeader responseHeader,
byte[] body)
constructor |
|
HttpResponse(IHttpResponseHeader responseHeader,
byte[] body,
boolean compress)
constructor |
|
HttpResponse(IHttpResponseHeader responseHeader,
ByteBuffer[] body)
constructor |
|
HttpResponse(IHttpResponseHeader responseHeader,
ByteBuffer[] body,
boolean compress)
constructor |
|
HttpResponse(IHttpResponseHeader header,
File file)
constructor |
|
HttpResponse(IHttpResponseHeader header,
File file,
String range)
constructor |
|
HttpResponse(IHttpResponseHeader responseHeader,
List<ByteBuffer> body)
constructor |
|
HttpResponse(IHttpResponseHeader responseHeader,
List<ByteBuffer> body,
boolean compress)
constructor |
|
HttpResponse(IHttpResponseHeader responseHeader,
NonBlockingBodyDataSource bodyDataSource)
constructor |
|
HttpResponse(IHttpResponseHeader responseHeader,
String body)
constructor |
|
HttpResponse(IHttpResponseHeader responseHeader,
String body,
boolean compress)
constructor |
|
HttpResponse(int status)
constructor |
|
HttpResponse(int status,
File file)
constructor |
|
HttpResponse(int status,
NameValuePair... nvp)
constructor |
|
HttpResponse(int status,
String body)
constructor |
|
HttpResponse(int status,
String contentType,
BodyDataSource body)
constructor |
|
HttpResponse(int status,
String contentType,
byte[] body)
constructor |
|
HttpResponse(int status,
String contentType,
byte[] body,
boolean compress)
constructor |
|
HttpResponse(int status,
String contentType,
ByteBuffer[] body)
constructor |
|
HttpResponse(int status,
String contentType,
File file)
constructor |
|
HttpResponse(int status,
String contentType,
File file,
String range)
constructor |
|
HttpResponse(int status,
String contentType,
int contentLength,
BodyDataSource body)
constructor |
|
HttpResponse(int status,
String contentType,
int contentLength,
NonBlockingBodyDataSource body)
constructor |
|
HttpResponse(int status,
String contentType,
NonBlockingBodyDataSource body)
constructor |
|
HttpResponse(int status,
String contentType,
String body)
constructor |
|
HttpResponse(int status,
String contentType,
String body,
boolean compress)
constructor |
|
HttpResponse(String body)
constructor. |
|
HttpResponse(String contentType,
BodyDataSource bodyDataSource)
constructor. |
|
HttpResponse(String contentType,
byte[] body)
constructor. |
|
HttpResponse(String contentType,
ByteBuffer[] body)
constructor. |
|
HttpResponse(String contentType,
NonBlockingBodyDataSource bodyDataSource)
constructor |
|
HttpResponse(String contentType,
String body)
constructor. |
Method Summary | |
---|---|
Object |
getAttribute(String name)
Returns the value of the named attribute as an Object ,
or null if no attribute of the given name exists. |
Enumeration |
getAttributeNames()
Returns an Enumeration containing the
names of the attributes available to this message. |
Set<String> |
getAttributeNameSet()
Returns an Set containing the
names of the attributes available to this messaget. |
int |
getContentLength()
Returns the length, in bytes, of the message body and made available by the input stream, or -1 if the length is not known. |
String |
getDate()
returns the Date header parameter or null if the header is not set |
IHttpMessageHeader |
getMessageHeader()
returns the message header |
String |
getProtocol()
returns the protocol |
String |
getProtocolVersion()
Returns the version of the protocol the message uses in the form majorVersion.minorVersion, for example, 1.1. |
String |
getReason()
returns the reason |
IHttpResponseHeader |
getResponseHeader()
returns the response header |
String |
getServer()
gets the Server header parameter |
int |
getStatus()
returns the status |
void |
removeHopByHopHeaders()
removes all hop-by-hop headers without Transfer-Encoding if set to chunked |
void |
setAttribute(String name,
Object o)
Stores an attribute in this header. |
void |
setContentLength(int length)
sets the content length in bytes |
void |
setDate(long timeMillis)
set the date header of the response |
void |
setDate(String date)
sets the Date header parameter |
void |
setExpireHeaders(int expireSec)
set the caching expires headers of a response |
void |
setLastModifiedHeader(long timeMillis)
set a last modified header of the response |
void |
setProtocol(String protocol)
sets the protocol |
void |
setReason(String reason)
sets the reason |
void |
setServer(String server)
sets the Server header parameter |
void |
setStatus(int status)
sets the status |
String |
toString()
|
Methods inherited from class org.xlightweb.Part |
---|
addHeader, addHeaderLine, addHeaderlines, containsHeader, getBlockingBody, getBody, getCharacterEncoding, getContentType, getDisposition, getDispositionParam, getDispositionType, getHeader, getHeaderList, getHeaderNames, getHeaderNameSet, getHeaders, getNonBlockingBody, getPartHeader, getTransferEncoding, hasBody, removeHeader, setContentType, setHeader, setTransferEncoding |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.xlightweb.IHttpMessage |
---|
getAttribute, getAttributeNames, getAttributeNameSet, getCharacterEncoding, getContentLength, getContentType, getMessageHeader, getTransferEncoding, removeHopByHopHeaders, setAttribute, setContentLength, setContentType, setTransferEncoding |
Methods inherited from interface org.xlightweb.IPart |
---|
getBlockingBody, getBody, getNonBlockingBody, getPartHeader, hasBody |
Methods inherited from interface org.xlightweb.IHeader |
---|
addHeader, addHeaderLine, addHeaderlines, containsHeader, getDisposition, getDispositionParam, getDispositionType, getHeader, getHeaderList, getHeaderNames, getHeaderNameSet, getHeaders, removeHeader, setHeader |
Constructor Detail |
---|
public HttpResponse(IHttpResponseHeader responseHeader)
responseHeader
- the response headerpublic HttpResponse(int status)
status
- the statuspublic HttpResponse(IHttpResponseHeader responseHeader, ByteBuffer[] body, boolean compress) throws IOException
responseHeader
- the response headerbodyDataSource
- the response bodycompress
- true, if the data should be compressed
IOException
- if an io exception occurspublic HttpResponse(IHttpResponseHeader responseHeader, NonBlockingBodyDataSource bodyDataSource) throws IOException
responseHeader
- the response headerbodyDataSource
- the response body
IOException
- if an io exception occurspublic HttpResponse(int status, String contentType, int contentLength, BodyDataSource body) throws IOException
status
- the statuscontentType
- the content typecontentLength
- the content lengthbody
- the body
IOException
- if an io exception occurspublic HttpResponse(int status, String contentType, int contentLength, NonBlockingBodyDataSource body) throws IOException
status
- the statuscontentType
- the content typecontentLength
- the content lengthbody
- the body
IOException
- if an io exception occurspublic HttpResponse(String contentType, NonBlockingBodyDataSource bodyDataSource) throws IOException
responseHeader
- the response headerbodyDataSource
- the response body
IOException
- if an io exception occurspublic HttpResponse(String contentType, BodyDataSource bodyDataSource) throws IOException
responseHeader
- the response headerbodyDataSource
- the response body
IOException
- if an io exception occurspublic HttpResponse(String contentType, String body) throws IOException
contentType
- the content typebody
- the body
IOException
- if an io exception occurspublic HttpResponse(String body) throws IOException
body
- the body
IOException
- if an io exception occurspublic HttpResponse(File file) throws IOException
file
- the file
IOException
- if an io exception occurspublic HttpResponse(int status, File file) throws IOException
status
- the statusfile
- the file
IOException
- if an io exception occurspublic HttpResponse(int status, String contentType, File file) throws IOException
status
- the statuscontentType
- the contentTypefile
- the file
IOException
- if an io exception occurspublic HttpResponse(int status, String contentType, File file, String range) throws IOException
status
- the statuscontentType
- the contentTypefile
- the file
IOException
- if an io exception occurspublic HttpResponse(int status, NameValuePair... nvp) throws IOException
status
- the statusnvp
- he name value pairs
IOException
- if an io exception occurspublic HttpResponse(IHttpResponseHeader header, File file) throws IOException
header
- the response headerfile
- the file
IOException
- if an io exception occurspublic HttpResponse(IHttpResponseHeader header, File file, String range) throws IOException
header
- the headerfile
- the filerange
- the range
IOException
- if an exception occurspublic HttpResponse(int status, String contentType, String body) throws IOException
status
- the statuscontentType
- the content typebody
- the body
IOException
- if an io exception occurspublic HttpResponse(int status, String contentType, String body, boolean compress) throws IOException
status
- the statuscontentType
- the content typebody
- the bodycompress
- true, if the data should be compressed
IOException
- if an io exception occurspublic HttpResponse(int status, String body) throws IOException
status
- the statusbody
- the body
IOException
- if an io exception occurspublic HttpResponse(String contentType, byte[] body) throws IOException
contentType
- the content typebody
- the body
IOException
- if an io exception occurspublic HttpResponse(int status, String contentType, NonBlockingBodyDataSource body) throws IOException
status
- the statuscontentType
- the content typebody
- the body
IOException
- if an io exception occurspublic HttpResponse(int status, String contentType, BodyDataSource body) throws IOException
status
- the statuscontentType
- the content typebody
- the body
IOException
- if an io exception occurspublic HttpResponse(int status, String contentType, byte[] body) throws IOException
status
- the statuscontentType
- the content typebody
- the body
IOException
- if an io exception occurspublic HttpResponse(int status, String contentType, byte[] body, boolean compress) throws IOException
status
- the statuscontentType
- the content typebody
- the bodycompress
- true, if the data should be compressed
IOException
- if an io exception occurspublic HttpResponse(String contentType, ByteBuffer[] body) throws IOException
contentType
- the content typebody
- the body
IOException
- if an io exception occurspublic HttpResponse(int status, String contentType, ByteBuffer[] body) throws IOException
status
- the statuscontentType
- the content typebody
- the body
IOException
- if an io exception occurspublic HttpResponse(IHttpResponseHeader responseHeader, String body) throws IOException
responseHeader
- the response headerbody
- the body
IOException
- if an io exception occurspublic HttpResponse(IHttpResponseHeader responseHeader, String body, boolean compress) throws IOException
responseHeader
- the response headerbody
- the bodycompress
- true, if the data whould be compressed
IOException
- if an io exception occurspublic HttpResponse(IHttpResponseHeader responseHeader, byte[] body) throws IOException
responseHeader
- the response headerbody
- the body
IOException
- if an io exception occurspublic HttpResponse(IHttpResponseHeader responseHeader, byte[] body, boolean compress) throws IOException
responseHeader
- the response headerbody
- the bodycompress
- true, if the data should be compressed
IOException
- if an io exception occurspublic HttpResponse(IHttpResponseHeader responseHeader, List<ByteBuffer> body) throws IOException
responseHeader
- the response headerbody
- the body
IOException
- if an io exception occurspublic HttpResponse(IHttpResponseHeader responseHeader, List<ByteBuffer> body, boolean compress) throws IOException
responseHeader
- the response headerbody
- the bodycompress
- true, if the data should be compressed
IOException
- if an io exception occurspublic HttpResponse(IHttpResponseHeader responseHeader, ByteBuffer[] body) throws IOException
responseHeader
- the response headerbody
- the body
IOException
- if an io exception occursMethod Detail |
---|
public final int getStatus()
getStatus
in interface IHttpResponse
public final void setStatus(int status)
setStatus
in interface IHttpResponse
status
- the statuspublic String getServer()
getServer
in interface IHttpResponse
public void setServer(String server)
setServer
in interface IHttpResponse
server
- the Server header parameterpublic void setDate(String date)
setDate
in interface IHttpResponse
date
- the Date header parameterpublic String getDate()
null
if the header is not set
getDate
in interface IHttpResponse
null
if the header is not setpublic final String getReason()
getReason
in interface IHttpResponse
public void setReason(String reason)
setReason
in interface IHttpResponse
reason
- the reasonpublic String getProtocol()
getProtocol
in interface IHttpMessage
getProtocol
in interface IHttpResponse
public String getProtocolVersion()
getProtocolVersion
in interface IHttpMessage
public void setDate(long timeMillis)
timeMillis
- the last modified time in millispublic void setExpireHeaders(int expireSec)
expireSec
- the expire time or 0 to set no-cache headerspublic void setLastModifiedHeader(long timeMillis)
timeMillis
- the last modified time in millispublic final void setProtocol(String protocol)
setProtocol
in interface IHttpResponse
protocol
- the protocolpublic final IHttpResponseHeader getResponseHeader()
getResponseHeader
in interface IHttpResponse
public String toString()
Part
toString
in class Part
public final IHttpMessageHeader getMessageHeader()
getMessageHeader
in interface IHttpMessage
public final void setAttribute(String name, Object o)
setAttribute
in interface IHttpMessage
name
- a String
specifying
the name of the attributeo
- the Object
to be storedpublic final Object getAttribute(String name)
Object
,
or null
if no attribute of the given name exists.
getAttribute
in interface IHttpMessage
name
- a String
specifying the name of the attribute
Object
containing the value of the attribute,
or null
if the attribute does not existpublic final Enumeration getAttributeNames()
Enumeration
containing the
names of the attributes available to this message.
This method returns an empty Enumeration
if the message has no attributes available to it.
getAttributeNames
in interface IHttpMessage
Enumeration
of strings containing the names
of the message's attributespublic final Set<String> getAttributeNameSet()
Set
containing the
names of the attributes available to this messaget.
This method returns an empty Set
if the request has no attributes available to it.
getAttributeNameSet
in interface IHttpMessage
Set
of strings
containing the names of the message's attributespublic final int getContentLength()
getContentLength
in interface IHttpMessage
public final void setContentLength(int length)
setContentLength
in interface IHttpMessage
length
- the content length in bytespublic final void removeHopByHopHeaders()
removeHopByHopHeaders
in interface IHttpMessage
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |