public abstract class HttpRequestPacket extends HttpHeader
HttpHeader
object, which represents HTTP request message.HttpHeader
,
HttpResponsePacket
Modifier and Type | Class and Description |
---|---|
static class |
HttpRequestPacket.Builder
HttpRequestPacket message builder.
|
Modifier and Type | Field and Description |
---|---|
protected Map<String,Object> |
attributes
The attributes associated with this Request, keyed by attribute name.
|
protected DataChunk |
localAddressC |
protected DataChunk |
localNameC |
protected int |
localPort |
protected Method |
parsedMethod |
protected DataChunk |
remoteAddressC |
protected DataChunk |
remoteHostC |
protected int |
remotePort |
protected DataChunk |
unparsedHostC |
contentLength, contentType, headers, isChunked, isCommitted, isContentBroken, isExpectContent, isSkipRemainder, parsedProtocol, protocolC, secure, upgrade
Modifier | Constructor and Description |
---|---|
protected |
HttpRequestPacket() |
Modifier and Type | Method and Description |
---|---|
DataChunk |
authType()
Return the authentication type used for this Request.
|
static HttpRequestPacket.Builder |
builder()
Returns
HttpRequestPacket builder. |
static <E> Note<E> |
createNote(String name)
Create a named
Note associated with this Request. |
protected void |
doParseHostHeader() |
Object |
getAttribute(String name)
Return the specified request attribute if it exists; otherwise, return
null . |
Set<String> |
getAttributeNames()
Return the names of all request attributes for this Request, or an
empty
Set if there are none. |
Connection |
getConnection() |
String |
getLocalAddress() |
String |
getLocalHost() |
String |
getLocalName() |
int |
getLocalPort() |
Method |
getMethod()
Get the HTTP request method.
|
DataChunk |
getMethodDC()
Get the HTTP request method as
DataChunk
(avoiding creation of a String object). |
<E> E |
getNote(Note<E> note)
Return the
Note value associated with this Request,
or null if no such binding exists. |
Set<String> |
getNoteNames()
Return a
Set containing the String names of all note bindings
that exist for this request. |
String |
getQueryString()
Returns the query string that is contained in the request URL after the
path.
|
DataChunk |
getQueryStringDC()
Returns the query string that is contained in the request URL after the
path.
|
String |
getRemoteAddress() |
String |
getRemoteHost() |
int |
getRemotePort() |
String |
getRequestURI()
Returns the request URL.
|
RequestURIRef |
getRequestURIRef()
Returns the request URL of the HTTP request as
RequestURIRef
(avoiding creation of a String object). |
HttpResponsePacket |
getResponse() |
int |
getServerPort() |
boolean |
isHeadRequest()
Returns
true if this request is a HEAD
request, otherwise returns false . |
boolean |
isRequest()
Returns true, if the current HttpHeader represent
HTTP request message, or false otherwise.
|
DataChunk |
localAddr() |
DataChunk |
localName() |
DataChunk |
remoteAddr() |
DataChunk |
remoteHost() |
DataChunk |
remoteUser()
Return the name of the remote user that has been authenticated
for this Request.
|
void |
removeAttribute(String name)
Remove the specified request attribute if it exists.
|
<E> E |
removeNote(Note<E> note)
Remove the
Note value associated with this request. |
boolean |
requiresAcknowledgement() |
protected void |
requiresAcknowledgement(boolean requiresAcknowledgement)
Allows consumers of this request to be notified if the user-agent
requires acknowledgment of an expectation (i.e., the Expect header).
|
protected void |
reset()
Reset the internal state.
|
DataChunk |
serverName()
Return the buffer holding the server name, if
any.
|
protected DataChunk |
serverNameRaw()
Return the buffer holding the server name, if
any.
|
void |
setAttribute(String name,
Object value)
Set the specified request attribute to the specified value.
|
void |
setConnection(Connection connection) |
void |
setLocalHost(String host)
Set the host name of the server servicing this request.
|
void |
setLocalPort(int port)
Sets the Internet Protocol (IP) port number of the interface on which
the request was received.
|
void |
setMethod(Method method)
Set the HTTP request method.
|
void |
setMethod(String method)
Set the HTTP request method.
|
<E> void |
setNote(Note<E> note,
E value)
Bind the
Note value to this Request,
replacing any existing binding for this name. |
void |
setQueryString(String query)
Set the
query portion of the request URI. |
void |
setRemotePort(int port)
Sets the Internet Protocol (IP) source port of the client or last
proxy that sent the request.
|
void |
setRequestURI(String requestURI)
Set the request URL.
|
protected void |
setResponse(HttpResponsePacket response) |
void |
setServerPort(int serverPort)
Sets the Internet Protocol (IP) port specified in the
Host request header. |
String |
toString() |
addContentEncoding, addHeader, addHeader, addHeader, addHeader, containsHeader, containsHeader, extractContentEncoding, flushSpecialHeaders, getAttributes, getCharacterEncoding, getContentEncodings, getContentEncodings, getContentLength, getContentType, getContentTypeHolder, getHeader, getHeader, getHeaders, getHttpHeader, getProcessingState, getProtocol, getProtocolDC, getProtocolString, getTempHeaderEncodingBuffer, getTransferEncoding, getUpgrade, getUpgradeDC, handleGetSpecialHeader, handleGetSpecialHeader, handleSetSpecialHeaders, handleSetSpecialHeaders, handleSetSpecialHeaders, handleSetSpecialHeaders, httpContentBuilder, httpTrailerBuilder, isChunked, isChunkingAllowed, isCommitted, isContentBroken, isContentEncodingsSelected, isContentTypeSet, isExpectContent, isHeader, isIgnoreContentModifiers, isSecure, isSkipRemainder, isSpecialHeader, makeContentLengthHeader, makeTransferEncodingHeader, makeUpgradeHeader, recycle, setCharacterEncoding, setChunked, setChunkingAllowed, setCommitted, setContentBroken, setContentEncodingsSelected, setContentLength, setContentLengthLong, setContentType, setContentType, setExpectContent, setHeader, setHeader, setHeader, setHeader, setIgnoreContentModifiers, setProtocol, setSecure, setSkipRemainder, setTransferEncoding, setUpgrade
isHttp
protected int remotePort
protected int localPort
protected Method parsedMethod
protected final DataChunk remoteAddressC
protected final DataChunk remoteHostC
protected final DataChunk localNameC
protected final DataChunk localAddressC
protected DataChunk unparsedHostC
public static HttpRequestPacket.Builder builder()
HttpRequestPacket
builder.HttpRequestPacket.Builder
.public void setConnection(Connection connection)
public Connection getConnection()
public HttpResponsePacket getResponse()
public DataChunk getMethodDC()
DataChunk
(avoiding creation of a String object). The result format is "GET|POST...".DataChunk
(avoiding creation of a String object). The result format is "GET|POST...".public Method getMethod()
public void setMethod(String method)
method
- the HTTP request method. Format is "GET|POST...".public void setMethod(Method method)
method
- the HTTP request method. Format is "GET|POST...".public RequestURIRef getRequestURIRef()
RequestURIRef
(avoiding creation of a String object).RequestURIRef
(avoiding creation of a String object).public String getRequestURI()
public void setRequestURI(String requestURI)
requestURI
- the request URL.public DataChunk getQueryStringDC()
DataChunk
(avoiding creation of a
String object).DataChunk
(avoiding creation of a
String object).public String getQueryString()
public void setQueryString(String query)
query
portion of the request URI.query
- the query Stringprotected DataChunk serverNameRaw()
public DataChunk serverName()
public int getServerPort()
Host
request header.public void setServerPort(int serverPort)
Host
request header.serverPort
- the port as specified in the Host
request headerpublic DataChunk remoteAddr()
DataChunk
representing the Internet Protocol (IP)
address of the client or last proxy that sent the request.public String getRemoteAddress()
public DataChunk remoteHost()
DataChunk
representing the fully qualified
name of the client or the last proxy that sent the request. If the
engine cannot or chooses not to resolve the host name (to improve
performance), this method returns the the IP address.public String getRemoteHost()
String
representing the fully qualified name of
the client or the last proxy that sent the request. If the engine cannot
or chooses not to resolve the hostname (to improve performance), this
method returns the the IP address.protected void requiresAcknowledgement(boolean requiresAcknowledgement)
requiresAcknowledgement
- true
if expectation
processing is required.public boolean requiresAcknowledgement()
true
if this request requires acknowledgement.public DataChunk localName()
DataChunk
representing the host name of the
Internet Protocol (IP) interface on which the request was received.public String getLocalName()
String
representing the host name of the
Internet Protocol (IP) interface on which the request was received.public DataChunk localAddr()
DataChunk
representing the Internet Protocol (IP)
address of the interface on which the request was received.public String getLocalAddress()
String
representing the Internet Protocol (IP)
address of the interface on which the request was received.public int getRemotePort()
public void setRemotePort(int port)
port
- the source port of the clientpublic int getLocalPort()
public void setLocalPort(int port)
port
- the port on which the request was receivedpublic String getLocalHost()
public void setLocalHost(String host)
host
- the host name of the server servicing this request.public DataChunk authType()
public DataChunk remoteUser()
public static <E> Note<E> createNote(String name)
Note
associated with this Request.public <E> E getNote(Note<E> note)
Note
value associated with this Request,
or null
if no such binding exists.
Use createNote(java.lang.String)
to create a new Note
.note
- Note
value to be returnedpublic Set<String> getNoteNames()
Set
containing the String names of all note bindings
that exist for this request.
Use createNote(java.lang.String)
to create a new Note
.Set
containing the String names of all note bindings
that exist for this request.public <E> E removeNote(Note<E> note)
Note
value associated with this request.
Use createNote(java.lang.String)
to create a new Note
.note
- Note
value to be removedpublic <E> void setNote(Note<E> note, E value)
Note
value to this Request,
replacing any existing binding for this name.
Use createNote(java.lang.String)
to create a new Note
.public Object getAttribute(String name)
null
.name
- Name of the request attribute to returnpublic Set<String> getAttributeNames()
Set
if there are none.public void setAttribute(String name, Object value)
name
- Name of the request attribute to setvalue
- The associated valuepublic void removeAttribute(String name)
name
- Name of the request attribute to removepublic boolean isHeadRequest()
true
if this request is a HEAD
request, otherwise returns false
.true
if this request is a HEAD
request, otherwise returns false
.protected void reset()
reset
in class HttpHeader
public final boolean isRequest()
isRequest
in class HttpHeader
protected void setResponse(HttpResponsePacket response)
protected void doParseHostHeader()
Copyright © 2015 Oracle Corporation. All rights reserved.