|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||

java.lang.Objectorg.xlightweb.Header
org.xlightweb.HttpRequestHeader
public class HttpRequestHeader
http request header
| Field Summary |
|---|
| Fields inherited from interface org.xlightweb.IHttpMessageHeader |
|---|
DEFAULT_ENCODING |
| Constructor Summary | |
|---|---|
HttpRequestHeader(String method,
String url)
constructor |
|
HttpRequestHeader(String method,
String url,
String contentType)
constructor |
|
| Method Summary | |
|---|---|
void |
addMatrixParameter(String parameterName,
String parameterValue)
adds a matrix parameter |
void |
addParameter(String parameterName,
String parameterValue)
adds a parameter |
protected Object |
clone()
|
boolean |
containsHeader(String headername)
Returns a boolean indicating whether the named header has already been set. |
IHttpRequestHeader |
copy()
creates a copy of this header |
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. |
Boolean |
getBooleanParameter(String name)
Get an Boolean parameter, or null if not present. |
boolean |
getBooleanParameter(String name,
boolean defaultVal)
Get an boolean parameter, with a fallback value. |
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 |
getContextPath()
Returns the portion of the request URI that indicates the context of the request. |
Double |
getDoubleParameter(String name)
Get an Double parameter, or null if not present. |
double |
getDoubleParameter(String name,
double defaultVal)
Get an double parameter, with a fallback value. |
Float |
getFloatParameter(String name)
Get an Float parameter, or null if not present. |
float |
getFloatParameter(String name,
float defaultVal)
Get an float parameter, with a fallback value. |
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 |
getHost()
returns the Host header parameter or null if the header is not set |
Integer |
getIntParameter(String name)
Get an Integer parameter, or null if not present. |
int |
getIntParameter(String name,
int defaultVal)
Get an int parameter, with a fallback value. |
Long |
getLongParameter(String name)
Get an Long parameter, or null if not present. |
long |
getLongParameter(String name,
long defaultVal)
Get an long parameter, with a fallback value. |
String |
getMatrixParameter(String name)
Returns the value of a request matrix parameter as a String, or null if the parameter does not exist. |
Set<String> |
getMatrixParameterNameSet()
returns the matrix parameter name set |
String[] |
getMatrixParameterValues(String name)
Returns an array of String objects containing all of the values the given request matrix parameter has, or null if the parameter does not exist. |
String |
getMethod()
Returns the name of the HTTP method with which this request was made, for example, GET, POST, or PUT. |
String |
getParameter(String name)
Returns the value of a request parameter as a String, or null if the parameter does not exist. |
String |
getParameter(String name,
String defaultVal)
Get an String parameter, with a fallback value. |
Enumeration |
getParameterNames()
Returns an Enumeration of String objects containing the names of the parameters contained in this request. |
Set<String> |
getParameterNameSet()
returns the parameter name set |
String[] |
getParameterValues(String name)
Returns an array of String objects containing all of the values the given request parameter has, or null if the parameter does not exist. |
String |
getPathInfo()
Returns any extra path information associated with the URL. |
String |
getPathInfo(boolean removeSurroundingSlashs)
Returns any extra path information associated with the URL. |
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 |
getQueryString()
Returns the query string that is contained in the request URL after the path. |
String |
getRemoteAddr()
Returns the Internet Protocol (IP) address of the client or last proxy that sent the request. |
String |
getRemoteHost()
Returns the fully qualified name of the client or the last proxy that sent the request. |
int |
getRemotePort()
Returns the Internet Protocol (IP) source port of the client or last proxy that sent the request. |
String |
getRequestHandlerPath()
returns the request handler path. |
String |
getRequestURI()
Returns the part of this request's URL from the protocol name up to the query string in the first line of the HTTP request. |
URL |
getRequestUrl()
Reconstructs the URL the client used to make the request. |
boolean |
getRequiredBooleanParameter(String name)
Get an boolean parameter or throws an exception if parameter is not present |
double |
getRequiredDoubleParameter(String name)
Get an double parameter or throws an exception if parameter is not present |
float |
getRequiredFloatParameter(String name)
Get an float parameter or throws an exception if parameter is not present |
int |
getRequiredIntParameter(String name)
Get an int parameter or throws an exception if parameter is not present |
long |
getRequiredLongParameter(String name)
Get an long parameter or throws an exception if parameter is not present |
String |
getRequiredStringParameter(String name)
Get an string parameter or throws an exception if parameter is not present |
String |
getScheme()
Returns the name of the scheme used to make this request, for example, http or https. |
String |
getServerName()
Returns the host name of the server to which the request was sent. |
int |
getServerPort()
Returns the port number to which the request was sent. |
String |
getUserAgent()
returns the User-Agent header parameter or null if the header is not set |
boolean |
isSecure()
Returns a boolean indicating whether this request was made using a secure channel, such as HTTPS. |
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 |
removeMatrixParameter(String parameterName)
removes a matrix parameter |
void |
removeParameter(String parameterName)
remove a parameter |
void |
setAttribute(String name,
Object o)
Stores an attribute in this header. |
void |
setContentLength(int contentLength)
sets the content length in bytes |
void |
setContextPath(String contextPath)
sets the context path. |
void |
setHost(String host)
sets the Host header (e.g. www.gmx.com or www.gmx.com:9900). |
void |
setMatrixParameter(String parameterName,
String parameterValue)
sets a matrix parameter |
void |
setMethod(String method)
Sets the name of the HTTP method |
void |
setParameter(String parameterName,
String parameterValue)
sets a parameter |
void |
setRequestHandlerPath(String requestHandlerPath)
sets the request handler path |
void |
setRequestURI(String requestUri)
set the request uri part of this request's URL from the protocol name up to the query string in the first line of the HTTP request. |
void |
setRequestUrl(URL url)
set the request url |
void |
setUserAgent(String userAgent)
sets the User-Agent header |
String |
toString()
|
| Methods inherited from class org.xlightweb.Header |
|---|
addHeader, addHeaderLine, addHeaderlines, getAccept, getCharacterEncoding, getContentType, getDisposition, getDispositionParam, getDispositionType, getHeader, 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.IHttpRequestHeader |
|---|
getAccept |
| Methods inherited from interface org.xlightweb.IHttpMessageHeader |
|---|
copyHeaderFrom, getAttribute, getAttributeNames, getAttributeNameSet, getContentLength, getProtocol, getProtocolVersion, removeHopByHopHeaders, setAttribute, setContentLength |
| Methods inherited from interface org.xlightweb.IHeader |
|---|
addHeader, addHeaderLine, addHeaderlines, getCharacterEncoding, getContentType, getDisposition, getDispositionParam, getDispositionType, getHeader, getHeaderNames, getHeaders, getTransferEncoding, removeHeader, setContentType, setHeader, setTransferEncoding |
| Constructor Detail |
|---|
public HttpRequestHeader(String method,
String url)
method - the methodurl - the url string
public HttpRequestHeader(String method,
String url,
String contentType)
method - the methodurl - the url stringcontentType - the content type| Method Detail |
|---|
public String getRequestHandlerPath()
getRequestHandlerPath in interface IHttpRequestHeaderpublic void setRequestHandlerPath(String requestHandlerPath)
setRequestHandlerPath in interface IHttpRequestHeaderrequestHandlerPath - the request handler pathpublic String getContextPath()
getContextPath in interface IHttpRequestHeaderIHttpRequest.getRequestHandlerPath()public void setContextPath(String contextPath)
setContextPath in interface IHttpRequestHeadercontextPath - the context path
protected final boolean onHeaderAdded(String headername,
String headervalue)
protected final boolean onHeaderRemoved(String headername)
public final String getHost()
null if the header is not set
getHost in interface IHttpRequestHeadernull if the header is not setpublic final String getPathInfo()
getPathInfo in interface IHttpRequestHeadernull if the URL does not have any extra path informationpublic final String getPathInfo(boolean removeSurroundingSlashs)
getPathInfo in interface IHttpRequestHeaderremoveSurroundingSlashs - true, if surrounding slashs wil lbe removed
null if the URL does not have any extra path informationpublic final void setHost(String host)
setHost in interface IHttpRequestHeaderhost - the Host headerpublic final String getUserAgent()
null if the header is not set
getUserAgent in interface IHttpRequestHeadernull if the header is not setpublic final void setUserAgent(String userAgent)
setUserAgent in interface IHttpRequestHeaderuserAgent - the User-Agent headerpublic final Set<String> getHeaderNameSet()
getHeaderNameSet in interface IHeaderpublic 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 IHeaderheadername - 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 IHeaderheadername - 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 IHeadertrue if the named header has already been set; false otherwisepublic final String getRemoteHost()
getRemoteHost in interface IHttpRequestHeaderpublic final int getRemotePort()
getRemotePort in interface IHttpRequestHeaderpublic final String getRemoteAddr()
getRemoteAddr in interface IHttpRequestHeaderpublic final String getQueryString()
null
if the URL does not have a query string.
getQueryString in interface IHttpRequestHeaderpublic final String getRequestURI()
getRequestURI in interface IHttpRequestHeaderpublic final void setRequestURI(String requestUri)
setRequestURI in interface IHttpRequestHeaderrequestUri - the request uripublic final URL getRequestUrl()
getRequestUrl in interface IHttpRequestHeaderpublic final void setRequestUrl(URL url)
setRequestUrl in interface IHttpRequestHeaderurl - the request urlpublic final boolean isSecure()
isSecure in interface IHttpRequestHeaderpublic final String getScheme()
getScheme in interface IHttpRequestHeaderpublic final String getMethod()
getMethod in interface IHttpRequestHeaderpublic final void setMethod(String method)
setMethod in interface IHttpRequestHeadermethod - a String specifying the name of the methodpublic final String getServerName()
getServerName in interface IHttpRequestHeaderpublic final int getServerPort()
getServerPort in interface IHttpRequestHeaderpublic final void removeParameter(String parameterName)
removeParameter in interface IHttpRequestHeaderparameterName - the parameter name
public final void setParameter(String parameterName,
String parameterValue)
setParameter in interface IHttpRequestHeaderparameterName - the parameter nameparameterValue - the parameter value
public final void addParameter(String parameterName,
String parameterValue)
addParameter in interface IHttpRequestHeaderparameterName - the parameter nameparameterValue - the parameter valuepublic final Enumeration getParameterNames()
getParameterNames in interface IHttpRequestHeaderpublic final Set<String> getParameterNameSet()
getParameterNameSet in interface IHttpRequestHeader
public final String getParameter(String name,
String defaultVal)
getParameter in interface IHttpRequestHeadername - the name of the parameterdefaultVal - the default value to use as fallback
public final String getParameter(String name)
getParameter in interface IHttpRequestHeadername - a String specifying the name of the parameter
public final void setMatrixParameter(String parameterName,
String parameterValue)
setMatrixParameter in interface IHttpRequestHeaderparameterName - the parameter nameparameterValue - the parameter value
public final void addMatrixParameter(String parameterName,
String parameterValue)
addMatrixParameter in interface IHttpRequestHeaderparameterName - the parameter nameparameterValue - the parameter valuepublic final void removeMatrixParameter(String parameterName)
removeMatrixParameter in interface IHttpRequestHeaderparameterName - the parameter namepublic final String[] getMatrixParameterValues(String name)
getMatrixParameterValues in interface IHttpRequestHeadername - a String specifying the name of the matrix parameter
public final Set<String> getMatrixParameterNameSet()
getMatrixParameterNameSet in interface IHttpRequestHeaderpublic final String getMatrixParameter(String name)
getMatrixParameter in interface IHttpRequestHeadername - a String specifying the name of the matrix parameter
public final String[] getParameterValues(String name)
getParameterValues in interface IHttpRequestHeadername - a String specifying the name of the parameter
public final String getRequiredStringParameter(String name)
throws BadMessageException
getRequiredStringParameter in interface IHttpRequestHeadername - the parameter name
BadMessageException - if the parameter is not present
public final Integer getIntParameter(String name)
throws BadMessageException
getIntParameter in interface IHttpRequestHeadername - the name of the parameter
null
BadMessageException - if the parameter value is not a number
public final int getRequiredIntParameter(String name)
throws BadMessageException
getRequiredIntParameter in interface IHttpRequestHeadername - the parameter name
BadMessageException - if the parameter is not present or the parameter is not a number
public final int getIntParameter(String name,
int defaultVal)
getIntParameter in interface IHttpRequestHeadername - the name of the parameterdefaultVal - the default value to use as fallback
public final Long getLongParameter(String name)
throws BadMessageException
getLongParameter in interface IHttpRequestHeadername - the name of the parameter
null
BadMessageException - if the parameter value is not a number
public final long getRequiredLongParameter(String name)
throws BadMessageException
getRequiredLongParameter in interface IHttpRequestHeadername - the parameter name
BadMessageException - if the parameter is not present or the parameter is not a number
public final long getLongParameter(String name,
long defaultVal)
getLongParameter in interface IHttpRequestHeadername - the name of the parameterdefaultVal - the default value to use as fallback
public final Double getDoubleParameter(String name)
throws BadMessageException
getDoubleParameter in interface IHttpRequestHeadername - the name of the parameter
null
BadMessageException - if the parameter is not a number
public final double getRequiredDoubleParameter(String name)
throws BadMessageException
getRequiredDoubleParameter in interface IHttpRequestHeadername - the parameter name
BadMessageException - if the parameter is not present or the parameter value is not a number
public final double getDoubleParameter(String name,
double defaultVal)
getDoubleParameter in interface IHttpRequestHeadername - the name of the parameterdefaultVal - the default value to use as fallback
public final Float getFloatParameter(String name)
throws BadMessageException
getFloatParameter in interface IHttpRequestHeadername - the name of the parameter
null
BadMessageException - if the parameter value is not a number
public final float getRequiredFloatParameter(String name)
throws BadMessageException
getRequiredFloatParameter in interface IHttpRequestHeadername - the parameter name
BadMessageException - if the parameter is not present or the parameter value is not a number
public final float getFloatParameter(String name,
float defaultVal)
getFloatParameter in interface IHttpRequestHeadername - the name of the parameterdefaultVal - the default value to use as fallback
public final Boolean getBooleanParameter(String name)
getBooleanParameter in interface IHttpRequestHeadername - the name of the parameter
null
public final boolean getRequiredBooleanParameter(String name)
throws BadMessageException
getRequiredBooleanParameter in interface IHttpRequestHeadername - the parameter name
BadMessageException - if the parameter is not present
public final boolean getBooleanParameter(String name,
boolean defaultVal)
getBooleanParameter in interface IHttpRequestHeadername - the name of the parameterdefaultVal - the default value to use as fallback
public String toString()
toString in class Headerpublic final IHttpRequestHeader copy()
copy in interface IHttpMessageHeadercopy in interface IHttpRequestHeader
protected Object clone()
throws CloneNotSupportedException
CloneNotSupportedExceptionpublic String getProtocolVersion()
getProtocolVersion in interface IHttpMessageHeaderpublic String getProtocol()
getProtocol in interface IHttpMessageHeader
public final void setAttribute(String name,
Object o)
setAttribute in interface IHttpMessageHeadername - 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 IHttpMessageHeadername - 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 IHttpMessageHeaderSet 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 IHttpMessageHeaderEnumeration of strings containing the names
of the message's attributespublic final int getContentLength()
getContentLength in interface IHttpMessageHeaderpublic final void setContentLength(int contentLength)
setContentLength in interface IHttpMessageHeadercontentLength - the content length in bytes
public final void copyHeaderFrom(IHttpMessageHeader otherHeader,
String... upperExcludenames)
copyHeaderFrom in interface IHttpMessageHeaderotherHeader - 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 | ||||||||