org.glassfish.grizzly.http
Class HttpRequestPacket

java.lang.Object
  extended by org.glassfish.grizzly.http.HttpHeader
      extended by org.glassfish.grizzly.http.HttpRequestPacket
All Implemented Interfaces:
AttributeStorage, Cacheable, HttpPacket, MimeHeadersPacket

public abstract class HttpRequestPacket
extends HttpHeader

The HttpHeader object, which represents HTTP request message.

Author:
Alexey Stashok
See Also:
HttpHeader, HttpResponsePacket

Nested Class Summary
static class HttpRequestPacket.Builder
          HttpRequestPacket message builder.
 
Field Summary
 
Fields inherited from class org.glassfish.grizzly.http.HttpHeader
charEncoding, charEncodingParsed, contentLength, contentType, contentTypeParsed, headers, isChunked, isCommitted, isExpectContent, isSkipRemainder, parsedProtocol, protocolBC, secure, upgrade
 
Constructor Summary
protected HttpRequestPacket()
           
 
Method Summary
static HttpRequestPacket.Builder builder()
          Returns HttpRequestPacket builder.
 Connection getConnection()
           
 String getLocalAddress()
           
 String getLocalHost()
           
 String getLocalName()
           
 int getLocalPort()
           
 String getMethod()
          Get the HTTP request method.
 BufferChunk getMethodBC()
          Get the HTTP request method as BufferChunk (avoiding creation of a String object).
 String getQueryString()
          Returns the query string that is contained in the request URL after the path.
 BufferChunk getQueryStringBC()
          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 isRequest()
          Returns true, if the current HttpHeader represent HTTP request message, or false otherwise.
 BufferChunk localAddr()
           
 BufferChunk localName()
           
 BufferChunk remoteAddr()
           
 BufferChunk remoteHost()
           
 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.
 BufferChunk serverName()
          Return the buffer holding the server name, if any.
 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(String method)
          Set the HTTP request method.
 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.
 void setServerPort(int serverPort)
          Sets the Internet Protocol (IP) port specified in the Host request header.
 String toString()
          
 
Methods inherited from class org.glassfish.grizzly.http.HttpHeader
addContentEncoding, addHeader, containsHeader, extractContentEncoding, extractContentType, getAttributes, getCharacterEncoding, getContentEncodings, getContentEncodings, getContentLength, getContentType, getHeader, getHeaders, getProcessingState, getProtocol, getProtocolBC, getProtocolString, getTransferEncoding, getUpgrade, getUpgradeBC, httpContentBuilder, httpTrailerBuilder, isChunked, isCommitted, isExpectContent, isHeader, isSecure, isSkipRemainder, makeContentLengthHeader, makeTransferEncodingHeader, makeUpgradeHeader, recycle, setCharacterEncoding, setChunked, setCommitted, setContentLength, setContentLength, setContentType, setExpectContent, setHeader, setProtocol, setSecure, setSkipRemainder, setTransferEncoding, setUpgrade
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HttpRequestPacket

protected HttpRequestPacket()
Method Detail

builder

public static HttpRequestPacket.Builder builder()
Returns HttpRequestPacket builder.

Returns:
HttpRequestPacket.Builder.

setConnection

public void setConnection(Connection connection)

getConnection

public Connection getConnection()

getResponse

public HttpResponsePacket getResponse()

getMethodBC

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

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

getMethod

public String getMethod()
Get the HTTP request method. The result format is "GET|POST...".

Returns:
the HTTP request method. The result format is "GET|POST...".

setMethod

public void setMethod(String method)
Set the HTTP request method.

Parameters:
method - the HTTP request method. Format is "GET|POST...".

getRequestURIRef

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

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

getRequestURI

public String getRequestURI()
Returns the request URL.

Returns:
the request URL.

setRequestURI

public void setRequestURI(String requestURI)
Set the request URL.

Parameters:
requestURI - the request URL.

getQueryStringBC

public BufferChunk getQueryStringBC()
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 BufferChunk (avoifing creation of a String object).

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 BufferChunk (avoifing creation of a String object).

getQueryString

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

setQueryString

public void setQueryString(String query)
Set the query portion of the request URI.

Parameters:
query - the query String

serverName

public BufferChunk 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.


getServerPort

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

setServerPort

public void setServerPort(int serverPort)
Sets the Internet Protocol (IP) port specified in the Host request header.

Parameters:
serverPort - the port as specified in the Host request header

remoteAddr

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

getRemoteAddress

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

remoteHost

public BufferChunk remoteHost()
Returns:
a BufferChunk 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.

getRemoteHost

public String getRemoteHost()
Returns:
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.

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

Parameters:
requiresAcknowledgement - true if expectation processing is required.

requiresAcknowledgement

public boolean requiresAcknowledgement()
Returns:
true if this request requires acknowledgement.

localName

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

getLocalName

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

localAddr

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

getLocalAddress

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

getRemotePort

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

setRemotePort

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

Parameters:
port - the source port of the client

getLocalPort

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

setLocalPort

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

Parameters:
port - the port on which the request was received

getLocalHost

public String getLocalHost()
Returns:
the host name of the server servicing this request.

setLocalHost

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

Parameters:
host - the host name of the server servicing this request.

reset

protected void reset()
Reset the internal state.

Overrides:
reset in class HttpHeader

isRequest

public final boolean isRequest()
Returns true, if the current HttpHeader represent HTTP request message, or false otherwise.

Specified by:
isRequest in class HttpHeader
Returns:
true, if the current HttpHeader represent HTTP request message, or false otherwise.

toString

public String toString()

Overrides:
toString in class Object


Copyright © 2010 Oracle Corpration. All Rights Reserved.