Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

juju.reattore.protocol.http.impl
Class BaseHttpRequest  view BaseHttpRequest download BaseHttpRequest.java

java.lang.Object
  extended byjuju.reattore.protocol.http.impl.BaseHttpRequest
All Implemented Interfaces:
juju.reattore.protocol.http.HttpMessage, juju.reattore.protocol.http.HttpRequest

public class BaseHttpRequest
extends java.lang.Object
implements juju.reattore.protocol.http.HttpRequest

HTTP request implementation. Wraps a HTTP parser and provides the request access methods. Also acts as a proxy, only resolving certain fields as required.


Field Summary
private  juju.reattore.io.ByteSource body
           
private  java.util.Map headers
           
private  java.lang.String method
           
private  java.lang.String originalPath
           
private  java.lang.String path
           
private  java.lang.String query
           
private static java.util.IdentityHashMap TLC
           
private  java.lang.String version
           
 
Constructor Summary
BaseHttpRequest()
           
 
Method Summary
 void addHeader(java.lang.String name, java.lang.String val)
          Receives a new header from the parser.
 void changePath(java.lang.String to)
          Override the current path.
 juju.reattore.io.ByteSource getBody()
          Gets the message body as a stream.
 java.lang.String getHeader(java.lang.String key)
          Gets a header line.
 java.util.Set getHeaders()
          Gets all headers as a set of Map.Entry items.
 java.lang.String getMethod()
          Gets the request method, such as GET, POST, or PUT.
 int getNumHeaders()
          Gets the number of parsed headers not including the start line.
 java.lang.String getOriginalPath()
          Gets the original request path, such as /dir/file.html.
 java.lang.String getPath()
          Gets the request path, such as /dir/file.html.
 java.lang.String getQueryString()
          Gets the request query string, such as name=val&name=val
 java.lang.String getVersion()
          Gets the request HTTP version, such as HTTP/1.1
 void setBody(juju.reattore.io.ByteSource body)
          Sets the body attached to this request.
 void setStartLine(java.lang.String method, java.lang.String path, java.lang.String query, java.lang.String version)
          Bulk populate this request with the given values.
private  java.lang.String toLowerCase(java.lang.String key)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

headers

private java.util.Map headers

method

private java.lang.String method

path

private java.lang.String path

query

private java.lang.String query

version

private java.lang.String version

originalPath

private java.lang.String originalPath

body

private juju.reattore.io.ByteSource body

TLC

private static final java.util.IdentityHashMap TLC
Constructor Detail

BaseHttpRequest

public BaseHttpRequest()
Method Detail

addHeader

public void addHeader(java.lang.String name,
                      java.lang.String val)
Receives a new header from the parser.


setStartLine

public void setStartLine(java.lang.String method,
                         java.lang.String path,
                         java.lang.String query,
                         java.lang.String version)
Bulk populate this request with the given values.


toLowerCase

private java.lang.String toLowerCase(java.lang.String key)

getHeader

public java.lang.String getHeader(java.lang.String key)
Description copied from interface: juju.reattore.protocol.http.HttpMessage
Gets a header line.

Specified by:
getHeader in interface juju.reattore.protocol.http.HttpMessage

setBody

public void setBody(juju.reattore.io.ByteSource body)
Sets the body attached to this request.


getMethod

public java.lang.String getMethod()
Description copied from interface: juju.reattore.protocol.http.HttpRequest
Gets the request method, such as GET, POST, or PUT.

Specified by:
getMethod in interface juju.reattore.protocol.http.HttpRequest

getPath

public java.lang.String getPath()
Description copied from interface: juju.reattore.protocol.http.HttpRequest
Gets the request path, such as /dir/file.html.

Specified by:
getPath in interface juju.reattore.protocol.http.HttpRequest

getQueryString

public java.lang.String getQueryString()
Description copied from interface: juju.reattore.protocol.http.HttpRequest
Gets the request query string, such as name=val&name=val

Specified by:
getQueryString in interface juju.reattore.protocol.http.HttpRequest

getVersion

public java.lang.String getVersion()
Description copied from interface: juju.reattore.protocol.http.HttpRequest
Gets the request HTTP version, such as HTTP/1.1

Specified by:
getVersion in interface juju.reattore.protocol.http.HttpRequest

getBody

public juju.reattore.io.ByteSource getBody()
Description copied from interface: juju.reattore.protocol.http.HttpMessage
Gets the message body as a stream. Will always be present, even if it is of zero length.

Specified by:
getBody in interface juju.reattore.protocol.http.HttpMessage

getNumHeaders

public int getNumHeaders()
Description copied from interface: juju.reattore.protocol.http.HttpMessage
Gets the number of parsed headers not including the start line.

Specified by:
getNumHeaders in interface juju.reattore.protocol.http.HttpMessage

getOriginalPath

public java.lang.String getOriginalPath()
Description copied from interface: juju.reattore.protocol.http.HttpRequest
Gets the original request path, such as /dir/file.html.

Specified by:
getOriginalPath in interface juju.reattore.protocol.http.HttpRequest

changePath

public void changePath(java.lang.String to)
Description copied from interface: juju.reattore.protocol.http.HttpRequest
Override the current path.

Specified by:
changePath in interface juju.reattore.protocol.http.HttpRequest

getHeaders

public java.util.Set getHeaders()
Description copied from interface: juju.reattore.protocol.http.HttpMessage
Gets all headers as a set of Map.Entry items.

Specified by:
getHeaders in interface juju.reattore.protocol.http.HttpMessage