|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.xlightweb.Header
org.xlightweb.HttpResponseHeader
public class HttpResponseHeader
http response header
Field Summary |
---|
Fields inherited from interface org.xlightweb.IHttpMessageHeader |
---|
DEFAULT_ENCODING |
Constructor Summary | |
---|---|
HttpResponseHeader(int statusCode)
constructor |
|
HttpResponseHeader(int statusCode,
String contentType)
constructor |
|
HttpResponseHeader(int statusCode,
String contentType,
String reason)
constructor |
|
HttpResponseHeader(String contentType)
constructor. |
Method Summary | |
---|---|
protected Object |
clone()
|
boolean |
containsHeader(String headername)
Returns a boolean indicating whether the named header has already been set. |
IHttpResponseHeader |
copy()
creates a copy of this header |
void |
copyHeaderFrom(HttpResponseHeader otherHeader,
String... upperExcludenames)
|
void |
copyHeaderFrom(IHttpMessageHeader otherHeader,
String... upperExcludenames)
copy the headers |
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 |
String |
getHeader(String headername)
Returns the value of the specified header as a String . |
List<String> |
getHeaderList(String headername)
Returns all the values of the specified header as an List of String objects. |
Set<String> |
getHeaderNameSet()
Returns an set of all the header names. |
String |
getProtocol()
Returns the name and version of the protocol the message uses in the form protocol/majorVersion.minorVersion, for example, HTTP/1.1. |
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 |
String |
getServer()
gets the Server header parameter |
int |
getStatus()
returns the status |
protected boolean |
onHeaderAdded(String headername,
String headervalue)
|
protected boolean |
onHeaderRemoved(String headername)
|
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 contentLength)
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.Header |
---|
addHeader, addHeaderLine, addHeaderlines, getAccept, getCharacterEncoding, getContentType, getDisposition, getDispositionParam, getDispositionType, getHeaderNames, getHeaders, getTransferEncoding, removeHeader, setContentType, setHeader, setTransferEncoding |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.xlightweb.IHttpResponseHeader |
---|
getProtocol |
Methods inherited from interface org.xlightweb.IHttpMessageHeader |
---|
copyHeaderFrom, getAttribute, getAttributeNames, getAttributeNameSet, getContentLength, getProtocolVersion, removeHopByHopHeaders, setAttribute, setContentLength |
Methods inherited from interface org.xlightweb.IHeader |
---|
addHeader, addHeaderLine, addHeaderlines, getCharacterEncoding, getContentType, getDisposition, getDispositionParam, getDispositionType, getHeaderNames, getHeaders, getTransferEncoding, removeHeader, setContentType, setHeader, setTransferEncoding |
Constructor Detail |
---|
public HttpResponseHeader(int statusCode)
statusCode
- the status codepublic HttpResponseHeader(String contentType)
contentType
- the content typepublic HttpResponseHeader(int statusCode, String contentType)
statusCode
- the status codecontentType
- the content typepublic HttpResponseHeader(int statusCode, String contentType, String reason)
statusCode
- the status codecontentType
- the content typereason
- the reasonMethod Detail |
---|
public final void copyHeaderFrom(HttpResponseHeader otherHeader, String... upperExcludenames)
public final int getStatus()
getStatus
in interface IHttpResponseHeader
public final void setStatus(int status)
setStatus
in interface IHttpResponseHeader
status
- the statuspublic final String getReason()
getReason
in interface IHttpResponseHeader
public final void setReason(String reason)
setReason
in interface IHttpResponseHeader
reason
- the reasonpublic final void setExpireHeaders(int expireSec)
expireSec
- the expire time or 0 to set no-cache headerspublic final void setLastModifiedHeader(long timeMillis)
timeMillis
- the last modified time in millispublic final void setDate(long timeMillis)
timeMillis
- the last modified time in millispublic final void setProtocol(String protocol)
setProtocol
in interface IHttpResponseHeader
protocol
- the protocolpublic final String getDate()
null
if the header is not set
getDate
in interface IHttpResponseHeader
null
if the header is not setpublic final void setDate(String date)
setDate
in interface IHttpResponseHeader
date
- the Date header parameterpublic final void setServer(String server)
setServer
in interface IHttpResponseHeader
server
- the Server header parameterpublic final String getServer()
getServer
in interface IHttpResponseHeader
protected final boolean onHeaderAdded(String headername, String headervalue)
protected final boolean onHeaderRemoved(String headername)
public final Set<String> getHeaderNameSet()
getHeaderNameSet
in interface IHeader
public final List<String> getHeaderList(String headername)
List
of String
objects.
Some headers, such as Accept-Language
can be set
by part producer as several headers each with a different value rather than
sending the header as a comma separated list.
getHeaderList
in interface IHeader
headername
- a String
specifying the header name
List
containing the values of the requested header.
If the part does not have any headers of that name return an empty enumeration.public final String getHeader(String headername)
String
.
If the part did not include a header of the specified name,
this method returns null
.
If there are multiple headers with the same name, this method
returns the first head in the part.
getHeader
in interface IHeader
headername
- a String
specifying the header name
String
containing the value of the
requested header, or null
if the part
does not have a header of that namepublic final boolean containsHeader(String headername)
containsHeader
in interface IHeader
true
if the named header has already been set; false
otherwiseprotected final Object clone() throws CloneNotSupportedException
CloneNotSupportedException
public final IHttpResponseHeader copy()
copy
in interface IHttpMessageHeader
copy
in interface IHttpResponseHeader
public String toString()
toString
in class Header
public String getProtocolVersion()
getProtocolVersion
in interface IHttpMessageHeader
public String getProtocol()
getProtocol
in interface IHttpMessageHeader
public final void setAttribute(String name, Object o)
setAttribute
in interface IHttpMessageHeader
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 IHttpMessageHeader
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 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 IHttpMessageHeader
Set
of strings
containing the names of the message's attributespublic 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 IHttpMessageHeader
Enumeration
of strings containing the names
of the message's attributespublic final int getContentLength()
getContentLength
in interface IHttpMessageHeader
public final void setContentLength(int contentLength)
setContentLength
in interface IHttpMessageHeader
contentLength
- the content length in bytespublic final void copyHeaderFrom(IHttpMessageHeader otherHeader, String... upperExcludenames)
copyHeaderFrom
in interface IHttpMessageHeader
otherHeader
- the other headerupperExcludenames
- the header names to excludepublic final void removeHopByHopHeaders()
removeHopByHopHeaders
in interface IHttpMessageHeader
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |