Top Description Inners Fields Constructors Methods
org.glassfish.grizzly.http

public abstract Class HttpRequestPacket

extends HttpHeader
Class Inheritance
Known Direct Subclasses
org.glassfish.grizzly.http.HttpRequestPacketImpl, org.glassfish.grizzly.http.HttpServerFilter.ServerHttpRequestImpl
Imports
java.net.InetAddress, .InetSocketAddress, java.util.Collections, .HashMap, .HashSet, .Map, .Set, org.glassfish.grizzly.Connection, org.glassfish.grizzly.attributes.AttributeBuilder, .AttributeHolder, .DefaultAttributeBuilder, org.glassfish.grizzly.http.util.DataChunk, .Header, .HttpCodecUtils, .MimeHeaders, .RequestURIRef

The HttpHeader object, which represents HTTP request message.
Author
Alexey Stashok
See Also
HttpHeader, HttpResponsePacket

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
HttpRequestPacket.Builder

HttpRequestPacket message builder.

Field Summary

Modifier and TypeField and Description
private static final AttributeBuilder
protected final Map<String, Object>
attributes

Hides org.glassfish.grizzly.http.HttpHeader.attributes.

The attributes associated with this Request, keyed by attribute name.
private final DataChunk
authTypeC

Authentication type.

private Connection<L>
private boolean
protected final DataChunk
private String
protected final DataChunk
protected int
private final DataChunk
private final transient AttributeHolder
notesHolder

Internal notes associated with this request by Catalina components and event listeners.

protected Method
private final DataChunk
public static final String
READ_ONLY_ATTR_PREFIX

Prefix for all service/read-only attributes, that once added could not be removed.

protected final DataChunk
protected final DataChunk
protected int
private final DataChunk
private final RequestURIRef
private boolean
private HttpResponsePacket
private final DataChunk
private int
protected DataChunk
Inherited from org.glassfish.grizzly.http.HttpHeader:
contentLengthcontentTypeheaderBufferheadersisChunkedisCommittedisContentBrokenisExpectContentisSkipRemainderparsedProtocolprotocolCsecureupgrade

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public DataChunk
authType()

Returns: the authentication type used for this Request.

public static HttpRequestPacket.Builder

Returns:

Builder.
builder
()

Returns HttpRequestPacket builder.

public static <
the Note type.
E
>
Note<E>

Returns:

the Note.
createNote
(final String
the Note name.
name
)

Create a named Note associated with this Request.

protected void
public Object
getAttribute(final String
Name of the request attribute to return
name
)

Returns: the specified request attribute if it exists; otherwise, return null.

public Set<String>
getAttributeNames()

Returns: read-only Set of the names of all request attributes, or an empty Set if there are none.

public Connection<L>
getConnection()

Returns: underlying connection used by the request

public String
getLocalAddress()

Returns: a String representing the Internet Protocol (IP) address of the interface on which the request was received.

public String
getLocalHost()

Returns: the host name of the server servicing this request.

public String
getLocalName()

Returns: a String representing the host name of the Internet Protocol (IP) interface on which the request was received.

public int
getLocalPort()

Returns: the Internet Protocol (IP) port number of the interface on which the request was received.

public Method

Returns:

the HTTP request method.
getMethod
()

Get the HTTP request method.

public DataChunk

Returns:

the HTTP request method as DataChunk (avoiding creation of a String object). The result format is "GET|POST...".
getMethodDC
()

Get the HTTP request method as DataChunk (avoiding creation of a String object).

public <
the Note type.
E
>
E

Returns:

the Note value associated with this Request, or null if no such binding exists
getNote
(final Note<E>
Note value to be returned
note
)

Return the Note value associated with this Request, or null if no such binding exists.

public Set<String>

Returns:

a Set containing the String names of all note bindings that exist for this request.
getNoteNames
()

Return a Set containing the String names of all note bindings that exist for this request.

public String
getProtocolRequestId()

Returns: an empty string by default.

public String

Returns:

the query string that is contained in the request URL after the path. This method returns null if the URL does not have a query string.
getQueryString
()

Returns the query string that is contained in the request URL after the path.

public DataChunk

Returns:

the query string that is contained in the request URL after the path. This method returns null if the URL does not have a query string. The result is represented as DataChunk (avoiding creation of a String object).
getQueryStringDC
()

Returns the query string that is contained in the request URL after the path.

public String
getRemoteAddress()

Returns: the Internet Protocol (IP) address of the client or last proxy that sent the request.

public String
getRemoteHost()

Returns: a String representing the fully qualified name of the client or the last proxy that sent the request.

public int
getRemotePort()

Returns: the Internet Protocol (IP) source port of the client or last proxy that sent the request.

public String

Returns:

the request URL.
getRequestURI
()

Returns the request URL.

public RequestURIRef

Returns:

the request URL of the HTTP request as RequestURIRef (avoiding creation of a String object).
getRequestURIRef
()

Returns the request URL of the HTTP request as RequestURIRef (avoiding creation of a String object).

public HttpResponsePacket
public int
getServerPort()

Returns: Returns the integer value of the Internet Protocol (IP) port as specified in the Host request header.

public boolean

Returns:

true if this request is a HEAD request, otherwise returns false.
isHeadRequest
()

Returns true if this request is a HEAD request, otherwise returns false.

public final boolean
isRequest()

Implements abstract org.glassfish.grizzly.http.HttpHeader.isRequest.

Returns true, if the current HttpHeader represent HTTP request message, or false otherwise.

public DataChunk
localAddr()

Returns: a DataChunk representing the Internet Protocol (IP) address of the interface on which the request was received.

public DataChunk
localName()

Returns: a DataChunk representing the host name of the Internet Protocol (IP) interface on which the request was received.

private void
public DataChunk
remoteAddr()

Returns: the DataChunk representing the Internet Protocol (IP) address of the client or last proxy that sent the request.

public DataChunk
remoteHost()

Returns: a DataChunk representing the fully qualified name of the client or the last proxy that sent the request.

public DataChunk
remoteUser()

Returns: the name of the remote user that has been authenticated for this Request.

public void
removeAttribute(final String
Name of the request attribute to remove
name
)

Remove the specified request attribute if it exists.

public <
the Note type.
E
>
E

Returns:

the old value associated with the Note, that was removed
removeNote
(final Note<E>
Note value to be removed
note
)

Remove the Note value associated with this request.

protected void
requiresAcknowledgement(boolean
true if expectation processing is required.
requiresAcknowledgement
)

Allows consumers of this request to be notified if the user-agent requires acknowledgment of an expectation (i.e., the Expect header).

public boolean
requiresAcknowledgement()

Returns: true if this request requires acknowledgement.

protected void
reset()

Overrides org.glassfish.grizzly.http.HttpHeader.reset.

Reset the internal state.

public DataChunk

Returns:

the buffer holding the server name, if any
serverName
()

Return the buffer holding the server name, if any.

protected DataChunk

Returns:

the buffer holding the server name
serverNameRaw
()

Return the buffer holding the server name, if any.

public void
setAttribute(final String
Name of the request attribute to set
name
,
final Object
The associated value
value
)

Set the specified request attribute to the specified value.

public void
setConnection(Connection<L> connection)

Sets the underlying connection used by the request.

public void
setLocalHost(String
the host name of the server servicing this request.
host
)

Set the host name of the server servicing this request.

public void
setLocalPort(int
the port on which the request was received
port
)

Sets the Internet Protocol (IP) port number of the interface on which the request was received.

public void
setMethod(final String
the HTTP request method. Format is "GET|POST...".
method
)

Set the HTTP request method.

public void
setMethod(final Method
the HTTP request method. Format is "GET|POST...".
method
)

Set the HTTP request method.

public <
the Note type.
E
>
void
setNote(final Note<E>
Note to which the object should be bound
note
,
final E
the Note value be bound to the specified Note.
value
)

Bind the Note value to this Request, replacing any existing binding for this name.

public void
setQueryString(String
the query String
query
)

Set the query portion of the request URI.

public void
setRemotePort(int
the source port of the client
port
)

Sets the Internet Protocol (IP) source port of the client or last proxy that sent the request.

public void
setRequestURI(String
the request URL.
requestURI
)

Set the request URL.

protected void
public void
setServerPort(int
the port as specified in the Host request header
serverPort
)

Sets the Internet Protocol (IP) port specified in the Host request header.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from org.glassfish.grizzly.http.HttpHeader:
addContentEncodingaddHeaderaddHeaderaddHeaderaddHeadercontainsHeadercontainsHeaderextractContentEncodingflushSpecialHeadersgetAttributesgetCharacterEncodinggetContentEncodingsgetContentEncodingsgetContentLengthgetContentTypegetContentTypeHoldergetHeadergetHeadergetHeadersgetHttpHeadergetParsingStategetProcessingStategetProtocolgetProtocolDCgetProtocolStringgetTempHeaderEncodingBuffergetTransferEncodinggetUpgradegetUpgradeDChttpContentBuilderhttpTrailerBuilderisChunkedisChunkingAllowedisCommittedisContentBrokenisContentEncodingsSelectedisContentTypeSetisExpectContentisHeaderisIgnoreContentModifiersisSecureisSkipRemainderisUpgrademakeContentLengthHeadermakeTransferEncodingHeadermakeUpgradeHeaderrecyclesetCharacterEncodingsetChunkedsetChunkingAllowedsetCommittedsetContentBrokensetContentEncodingsSelectedsetContentLengthsetContentLengthLongsetContentTypesetContentTypesetExpectContentsetHeadersetHeadersetHeadersetHeadersetHeaderBuffersetIgnoreContentModifierssetProtocolsetSecuresetSkipRemaindersetTransferEncodingsetUpgrade

Field Detail

ATTR_BUILDERback to summary
private static final AttributeBuilder ATTR_BUILDER
attributesback to summary
protected final Map<String, Object> attributes

Hides org.glassfish.grizzly.http.HttpHeader.attributes.

The attributes associated with this Request, keyed by attribute name.

authTypeCback to summary
private final DataChunk authTypeC

Authentication type.

connectionback to summary
private Connection<L> connection
hostHeaderParsedback to summary
private boolean hostHeaderParsed
localAddressCback to summary
protected final DataChunk localAddressC
localHostback to summary
private String localHost
localNameCback to summary
protected final DataChunk localNameC
localPortback to summary
protected int localPort
methodCback to summary
private final DataChunk methodC
notesHolderback to summary
private final transient AttributeHolder notesHolder

Internal notes associated with this request by Catalina components and event listeners.

parsedMethodback to summary
protected Method parsedMethod
queryCback to summary
private final DataChunk queryC
READ_ONLY_ATTR_PREFIXback to summary
public static final String READ_ONLY_ATTR_PREFIX

Prefix for all service/read-only attributes, that once added could not be removed. The attributes with this prefix will not be listed in the getAttributeNames() result. The prefix was introduced with the intention to avoid collisions with normal user attributes and fail fast when we compare read-only and normal user attributes.

remoteAddressCback to summary
protected final DataChunk remoteAddressC
remoteHostCback to summary
protected final DataChunk remoteHostC
remotePortback to summary
protected int remotePort
remoteUserCback to summary
private final DataChunk remoteUserC
requestURIRefback to summary
private final RequestURIRef requestURIRef
requiresAcknowledgementback to summary
private boolean requiresAcknowledgement
responseback to summary
private HttpResponsePacket response
serverNameCback to summary
private final DataChunk serverNameC
serverPortback to summary
private int serverPort
unparsedHostCback to summary
protected DataChunk unparsedHostC

Constructor Detail

HttpRequestPacketback to summary
protected HttpRequestPacket()

Method Detail

authTypeback to summary
public DataChunk authType()
Returns:DataChunk

the authentication type used for this Request.

builderback to summary
public static HttpRequestPacket.Builder builder()

Returns HttpRequestPacket builder.

Returns:HttpRequestPacket.Builder

Builder.

createNoteback to summary
public static <E> Note<E> createNote(final String name)

Create a named Note associated with this Request.

Parameters
<E>
the Note type.
name:String

the Note name.

Returns:Note<E>

the Note.

Annotations
@SuppressWarnings:unchecked
doParseHostHeaderback to summary
protected void doParseHostHeader()
getAttributeback to summary
public Object getAttribute(final String name)
Parameters
name:String

Name of the request attribute to return

Returns:Object

the specified request attribute if it exists; otherwise, return null.

getAttributeNamesback to summary
public Set<String> getAttributeNames()
Returns:Set<String>

read-only Set of the names of all request attributes, or an empty Set if there are none.

getConnectionback to summary
public Connection<L> getConnection()
Returns:Connection<L>

underlying connection used by the request

getLocalAddressback to summary
public String getLocalAddress()
Returns:String

a String representing the Internet Protocol (IP) address of the interface on which the request was received.

getLocalHostback to summary
public String getLocalHost()
Returns:String

the host name of the server servicing this request.

getLocalNameback to summary
public String getLocalName()
Returns:String

a String representing the host name of the Internet Protocol (IP) interface on which the request was received.

getLocalPortback to summary
public int getLocalPort()
Returns:int

the Internet Protocol (IP) port number of the interface on which the request was received.

getMethodback to summary
public Method getMethod()

Get the HTTP request method.

Returns:Method

the HTTP request method.

getMethodDCback to summary
public DataChunk getMethodDC()

Get the HTTP request method as DataChunk (avoiding creation of a String object). The result format is "GET|POST...".

Returns:DataChunk

the HTTP request method as DataChunk (avoiding creation of a String object). The result format is "GET|POST...".

getNoteback to summary
public <E> E getNote(final Note<E> note)

Return the Note value associated with this Request, or null if no such binding exists. Use createNote(java.lang.String) to create a new Note.

Parameters
<E>
the Note type.
note:Note<E>

Note value to be returned

Returns:E

the Note value associated with this Request, or null if no such binding exists

getNoteNamesback to summary
public Set<String> getNoteNames()

Return a Set containing the String names of all note bindings that exist for this request. Use createNote(java.lang.String) to create a new Note.

Returns:Set<String>

a Set containing the String names of all note bindings that exist for this request.

getProtocolRequestIdback to summary
public String getProtocolRequestId()
Returns:String

an empty string by default.

getQueryStringback to summary
public String getQueryString()

Returns the query string that is contained in the request URL after the path. This method returns null if the URL does not have a query string.

Returns:String

the query string that is contained in the request URL after the path. This method returns null if the URL does not have a query string.

getQueryStringDCback to summary
public DataChunk getQueryStringDC()

Returns the query string that is contained in the request URL after the path. This method returns null if the URL does not have a query string. The result is represented as DataChunk (avoiding creation of a String object).

Returns:DataChunk

the query string that is contained in the request URL after the path. This method returns null if the URL does not have a query string. The result is represented as DataChunk (avoiding creation of a String object).

getRemoteAddressback to summary
public String getRemoteAddress()
Returns:String

the Internet Protocol (IP) address of the client or last proxy that sent the request.

getRemoteHostback to summary
public String getRemoteHost()
Returns:String

a 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.

getRemotePortback to summary
public int getRemotePort()
Returns:int

the Internet Protocol (IP) source port of the client or last proxy that sent the request.

getRequestURIback to summary
public String getRequestURI()

Returns the request URL.

Returns:String

the request URL.

getRequestURIRefback to summary
public RequestURIRef getRequestURIRef()

Returns the request URL of the HTTP request as RequestURIRef (avoiding creation of a String object).

Returns:RequestURIRef

the request URL of the HTTP request as RequestURIRef (avoiding creation of a String object).

getResponseback to summary
public HttpResponsePacket getResponse()
getServerPortback to summary
public int getServerPort()
Returns:int

Returns the integer value of the Internet Protocol (IP) port as specified in the Host request header.

isHeadRequestback to summary
public boolean isHeadRequest()

Returns true if this request is a HEAD request, otherwise returns false.

Returns:boolean

true if this request is a HEAD request, otherwise returns false.

isRequestback to summary
public final boolean isRequest()

Implements abstract org.glassfish.grizzly.http.HttpHeader.isRequest.

Doc from org.glassfish.grizzly.http.HttpHeader.isRequest.

Returns true, if the current HttpHeader represent HTTP request message, or false otherwise.

Annotations
@Override
localAddrback to summary
public DataChunk localAddr()
Returns:DataChunk

a DataChunk representing the Internet Protocol (IP) address of the interface on which the request was received.

localNameback to summary
public DataChunk localName()
Returns:DataChunk

a DataChunk representing the host name of the Internet Protocol (IP) interface on which the request was received.

parseHostHeaderback to summary
private void parseHostHeader()
remoteAddrback to summary
public DataChunk remoteAddr()
Returns:DataChunk

the DataChunk representing the Internet Protocol (IP) address of the client or last proxy that sent the request.

remoteHostback to summary
public DataChunk remoteHost()
Returns:DataChunk

a 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.

remoteUserback to summary
public DataChunk remoteUser()
Returns:DataChunk

the name of the remote user that has been authenticated for this Request.

removeAttributeback to summary
public void removeAttribute(final String name)

Remove the specified request attribute if it exists.

Parameters
name:String

Name of the request attribute to remove

removeNoteback to summary
public <E> E removeNote(final Note<E> note)

Remove the Note value associated with this request. Use createNote(java.lang.String) to create a new Note.

Parameters
<E>
the Note type.
note:Note<E>

Note value to be removed

Returns:E

the old value associated with the Note, that was removed

requiresAcknowledgementback to summary
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).

Parameters
requiresAcknowledgement:boolean

true if expectation processing is required.

requiresAcknowledgementback to summary
public boolean requiresAcknowledgement()
Returns:boolean

true if this request requires acknowledgement.

resetback to summary
protected void reset()

Overrides org.glassfish.grizzly.http.HttpHeader.reset.

Doc from org.glassfish.grizzly.http.HttpHeader.reset.

Reset the internal state.

Annotations
@Override
serverNameback to summary
public DataChunk serverName()

Return the buffer holding the server name, if any. Use isNull() to check if there is no value set. This is the "virtual host", derived from the Host: header.

Returns:DataChunk

the buffer holding the server name, if any

serverNameRawback to summary
protected DataChunk serverNameRaw()

Return the buffer holding the server name, if any. Use isNull() to check if there is no value set. This is the "virtual host", derived from the Host: header.

Returns:DataChunk

the buffer holding the server name

setAttributeback to summary
public void setAttribute(final String name, final Object value)

Set the specified request attribute to the specified value.

Parameters
name:String

Name of the request attribute to set

value:Object

The associated value

setConnectionback to summary
public void setConnection(Connection<L> connection)

Sets the underlying connection used by the request.

setLocalHostback to summary
public void setLocalHost(String host)

Set the host name of the server servicing this request.

Parameters
host:String

the host name of the server servicing this request.

setLocalPortback to summary
public void setLocalPort(int port)

Sets the Internet Protocol (IP) port number of the interface on which the request was received.

Parameters
port:int

the port on which the request was received

setMethodback to summary
public void setMethod(final String method)

Set the HTTP request method.

Parameters
method:String

the HTTP request method. Format is "GET|POST...".

setMethodback to summary
public void setMethod(final Method method)

Set the HTTP request method.

Parameters
method:Method

the HTTP request method. Format is "GET|POST...".

setNoteback to summary
public <E> void setNote(final Note<E> note, final E value)

Bind the Note value to this Request, replacing any existing binding for this name. Use createNote(java.lang.String) to create a new Note.

Parameters
<E>
the Note type.
note:Note<E>

Note to which the object should be bound

value:E

the Note value be bound to the specified Note.

setQueryStringback to summary
public void setQueryString(String query)

Set the query portion of the request URI.

Parameters
query:String

the query String

setRemotePortback to summary
public void setRemotePort(int port)

Sets the Internet Protocol (IP) source port of the client or last proxy that sent the request.

Parameters
port:int

the source port of the client

setRequestURIback to summary
public void setRequestURI(String requestURI)

Set the request URL.

Parameters
requestURI:String

the request URL.

setResponseback to summary
protected void setResponse(HttpResponsePacket response)
setServerPortback to summary
public void setServerPort(int serverPort)

Sets the Internet Protocol (IP) port specified in the Host request header.

Parameters
serverPort:int

the port as specified in the Host request header

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Annotations
@Override
org.glassfish.grizzly.http back to summary

public Class HttpRequestPacket.Builder

extends HttpHeader.Builder<HttpRequestPacket.Builder>
Class Inheritance

HttpRequestPacket message builder.

Field Summary

Modifier and TypeField and Description
protected String
protected Method
protected String
protected String
protected String
Inherited from org.glassfish.grizzly.http.HttpHeader.Builder:
chunkedcontentLengthcontentTypemimeHeadersprotocolprotocolStringupgrade

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public final HttpRequestPacket

Returns:

HttpRequestPacket
build
()

Overrides org.glassfish.grizzly.http.HttpHeader.Builder.build.

Build the HttpRequestPacket message.

protected HttpHeader
public HttpRequestPacket.Builder

Returns:

this.
host
(final String
the value for the Host header.
host
)

Set the value for the Host header.

public HttpRequestPacket.Builder
method(final Method
the HTTP request method..
method
)

Set the HTTP request method.

public HttpRequestPacket.Builder
method(final String
the HTTP request method. Format is "GET|POST...".
method
)

Set the HTTP request method.

public HttpRequestPacket.Builder

Returns:

the current Builder
query
(final String
the query String
queryString
)

Set the query portion of the request URI.

public void
public HttpRequestPacket.Builder
uri(final String
the request URI.
uri
)

Set the request URI.

Inherited from org.glassfish.grizzly.http.HttpHeader.Builder:
chunkedcontentLengthcontentTypeheaderheadermaxNumHeadersprotocolprotocolremoveHeaderremoveHeaderupgrade

Field Detail

hostback to summary
protected String host
methodback to summary
protected Method method
methodStringback to summary
protected String methodString
queryStringback to summary
protected String queryString
uriback to summary
protected String uri

Constructor Detail

Builderback to summary
public Builder()

Method Detail

buildback to summary
public final HttpRequestPacket build()

Overrides org.glassfish.grizzly.http.HttpHeader.Builder.build.

Build the HttpRequestPacket message.

Returns:HttpRequestPacket

HttpRequestPacket

Annotations
@Override
createback to summary
protected HttpHeader create()

Implements abstract org.glassfish.grizzly.http.HttpHeader.Builder.create.

Annotations
@Override
hostback to summary
public HttpRequestPacket.Builder host(final String host)

Set the value for the Host header.

Parameters
host:String

the value for the Host header.

Returns:HttpRequestPacket.Builder

this.

methodback to summary
public HttpRequestPacket.Builder method(final Method method)

Set the HTTP request method.

Parameters
method:Method

the HTTP request method..

methodback to summary
public HttpRequestPacket.Builder method(final String method)

Set the HTTP request method.

Parameters
method:String

the HTTP request method. Format is "GET|POST...".

queryback to summary
public HttpRequestPacket.Builder query(final String queryString)

Set the query portion of the request URI.

Parameters
queryString:String

the query String

Returns:HttpRequestPacket.Builder

the current Builder

resetback to summary
public void reset()

Overrides org.glassfish.grizzly.http.HttpHeader.Builder.reset.

Annotations
@Override
uriback to summary
public HttpRequestPacket.Builder uri(final String uri)

Set the request URI.

Parameters
uri:String

the request URI.