org.abstracthorizon.danube.http
Interface HTTPConnection

All Superinterfaces:
Adaptable, Connection
All Known Implementing Classes:
HTTPConnectionImpl

public interface HTTPConnection
extends Connection

This connection represents one HTTP request and response. It can be reused over the same underlaying connection (multiple requests over the same socket).

This implementation handles HTTP request string, headers and parameters.

Author:
Daniel Sendula

Field Summary
static SimpleDateFormat HEADER_DATE_FORMAT
           
 
Method Summary
 void addComponentPathToContextPath()
          Updates context path adding new path element to it
 void forward(String path)
          Forwards request.
 Map<String,Object> getAttributes()
          This method returns map of attributes.
 int getBufferSize()
          Returns buffer size
 String getComponentPath()
          Returns portion of request URI from context path till end or '?' whichever comes first
 String getComponentResourcePath()
          Returns remainder of path after context path and component path is removed
 String getContextPath()
          Returns portion of request path up to component path
 MultiStringMap getRequestHeaders()
          Returns request headers map
 String getRequestMethod()
          Returns request method
 MultiStringMap getRequestParameters()
          Returns request parameters map.
 String getRequestPath()
          This is similar to getRequestURI() but without path info (parameters) part
 String getRequestProtocol()
          Returns request protocol
 String getRequestURI()
          Returns raw requested uri along with path info (if supplied in GET method)
 MultiStringMap getResponseHeaders()
          Returns response headers map
 String getResponseProtocol()
          Returns response protocol
 Status getResponseStatus()
          Returns response status
 boolean isCommited()
          Returns true if headers are already send back to the client TODO - maybe this method is not needed!
 void reset()
          This method processes request.
 void setBufferSize(int size)
          Sets buffer size
 void setComponentPath(String requestURI)
          Sets request uri.
 void setComponentResourcePath(String resourcePath)
          Sets component resource path
 void setResponseProtocol(String protocol)
          Sets response protocol
 void setResponseStatus(Status status)
          Sets response status
 
Methods inherited from interface org.abstracthorizon.danube.connection.Connection
close, isClosed
 
Methods inherited from interface org.abstracthorizon.danube.adapter.Adaptable
adapt
 

Field Detail

HEADER_DATE_FORMAT

static final SimpleDateFormat HEADER_DATE_FORMAT
Method Detail

getRequestProtocol

String getRequestProtocol()
Returns request protocol

Returns:
request protocol

getRequestMethod

String getRequestMethod()
Returns request method

Returns:
request method

getRequestHeaders

MultiStringMap getRequestHeaders()
Returns request headers map

Returns:
request headers map

getRequestParameters

MultiStringMap getRequestParameters()
Returns request parameters map. If more then one parameter is supplied with the same name then List returned with all parameter values in it.

Returns:
request parameters map

getRequestURI

String getRequestURI()
Returns raw requested uri along with path info (if supplied in GET method)

Returns:
raw requested uri

getRequestPath

String getRequestPath()
This is similar to getRequestURI() but without path info (parameters) part

Returns:
full (unchanged) uri

getContextPath

String getContextPath()
Returns portion of request path up to component path

Returns:
portion of request path up to component path

addComponentPathToContextPath

void addComponentPathToContextPath()
Updates context path adding new path element to it


getComponentPath

String getComponentPath()
Returns portion of request URI from context path till end or '?' whichever comes first

Returns:
request path

setComponentPath

void setComponentPath(String requestURI)
Sets request uri. This is to be called from selectors not applicaiton code.

Parameters:
requestURI -

getComponentResourcePath

String getComponentResourcePath()
Returns remainder of path after context path and component path is removed

Returns:
remainder of path after context path and component path is removed

setComponentResourcePath

void setComponentResourcePath(String resourcePath)
Sets component resource path

Parameters:
resourcePath - component resource path

getResponseHeaders

MultiStringMap getResponseHeaders()
Returns response headers map

Returns:
response headers map

getResponseStatus

Status getResponseStatus()
Returns response status

Returns:
response status

setResponseStatus

void setResponseStatus(Status status)
Sets response status

Parameters:
status - response status

getResponseProtocol

String getResponseProtocol()
Returns response protocol

Returns:
response protocol

setResponseProtocol

void setResponseProtocol(String protocol)
Sets response protocol

Parameters:
protocol - response protocol

isCommited

boolean isCommited()
Returns true if headers are already send back to the client TODO - maybe this method is not needed!

Returns:
true if headers are already send back to the client

reset

void reset()
This method processes request. It extracts method, uri, parameters (GET or POST), protocol version and headers.


getAttributes

Map<String,Object> getAttributes()
This method returns map of attributes.

Returns:
map of attributes

forward

void forward(String path)
Forwards request.

Parameters:
path - uri for request to be forwarded to.
Throws:
IOException - if underlaying handler had IOException

setBufferSize

void setBufferSize(int size)
Sets buffer size

Parameters:
size - buffer size

getBufferSize

int getBufferSize()
Returns buffer size

Returns:
buffer size


Copyright © 2005-2009 Abstract Horizon. All Rights Reserved.