org.jboss.resteasy.plugins.server.servlet
Class HttpServletInputMessage

java.lang.Object
  extended by org.jboss.resteasy.plugins.server.servlet.HttpServletInputMessage
All Implemented Interfaces:
HttpRequest
Direct Known Subclasses:
JBossWebAsyncHttpRequest, Servlet3AsyncHttpRequest, Tomcat6AsyncHttpRequest

public class HttpServletInputMessage
extends java.lang.Object
implements HttpRequest

Abstraction for an inbound http request on the server, or a response from a server to a client

We have this abstraction so that we can reuse marshalling objects in a client framework and serverside framework

Version:
$Revision: 1 $
Author:
Bill Burke

Field Summary
protected  AbstractAsynchronousResponse asynchronousResponse
           
protected  MultivaluedMap<java.lang.String,java.lang.String> decodedFormParameters
           
protected  SynchronousDispatcher dispatcher
           
protected  MultivaluedMap<java.lang.String,java.lang.String> formParameters
           
protected  HttpHeaders httpHeaders
           
protected  java.lang.String httpMethod
           
protected  HttpResponse httpResponse
           
protected  java.util.concurrent.CountDownLatch latch
           
protected  java.io.InputStream overridenStream
           
protected  java.lang.String preProcessedPath
           
protected  javax.servlet.http.HttpServletRequest request
           
protected  boolean suspended
           
protected  long suspendTimeout
           
protected  UriInfo uri
           
 
Constructor Summary
HttpServletInputMessage(javax.servlet.http.HttpServletRequest request, HttpResponse httpResponse, HttpHeaders httpHeaders, UriInfo uri, java.lang.String httpMethod, SynchronousDispatcher dispatcher)
           
 
Method Summary
 AsynchronousResponse createAsynchronousResponse(long suspendTimeout)
          This method will create an asynchronous response and prepare the request to be issued asynchronously
 AsynchronousResponse getAsynchronousResponse()
          Returns the AsynchronousResponse created by createAsynchronousResponse
 java.lang.Object getAttribute(java.lang.String attribute)
          Map of contextual data.
 MultivaluedMap<java.lang.String,java.lang.String> getDecodedFormParameters()
           
 MultivaluedMap<java.lang.String,java.lang.String> getFormParameters()
          application/x-www-form-urlencoded parameters

This is here because @FormParam needs it and for when there are servlet filters that eat up the input stream

 HttpHeaders getHttpHeaders()
           
 java.lang.String getHttpMethod()
           
 java.io.InputStream getInputStream()
           
 java.lang.String getPreprocessedPath()
          Encoded preprocessed path with extension mappings and matrix parameters removed
 MultivaluedMap<java.lang.String,java.lang.String> getPutDecodedFormParameters()
           
 MultivaluedMap<java.lang.String,java.lang.String> getPutFormParameters()
           
 UriInfo getUri()
           
 void initialRequestThreadFinished()
          Callback by the initial calling thread.
 boolean isInitial()
          Asynchronous HTTP support.
 boolean isSuspended()
          Asynchronous HTTP support.
 boolean isTimeout()
           
 void removeAttribute(java.lang.String name)
           
 void setAttribute(java.lang.String name, java.lang.Object value)
           
 void setInputStream(java.io.InputStream stream)
          If you are using a servlet container, this will *NOT* override the HttpServletRequest.getInputStream().
 void setPreprocessedPath(java.lang.String path)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

httpHeaders

protected HttpHeaders httpHeaders

request

protected javax.servlet.http.HttpServletRequest request

latch

protected java.util.concurrent.CountDownLatch latch

suspendTimeout

protected long suspendTimeout

dispatcher

protected SynchronousDispatcher dispatcher

httpResponse

protected HttpResponse httpResponse

suspended

protected boolean suspended

uri

protected UriInfo uri

httpMethod

protected java.lang.String httpMethod

preProcessedPath

protected java.lang.String preProcessedPath

formParameters

protected MultivaluedMap<java.lang.String,java.lang.String> formParameters

decodedFormParameters

protected MultivaluedMap<java.lang.String,java.lang.String> decodedFormParameters

asynchronousResponse

protected AbstractAsynchronousResponse asynchronousResponse

overridenStream

protected java.io.InputStream overridenStream
Constructor Detail

HttpServletInputMessage

public HttpServletInputMessage(javax.servlet.http.HttpServletRequest request,
                               HttpResponse httpResponse,
                               HttpHeaders httpHeaders,
                               UriInfo uri,
                               java.lang.String httpMethod,
                               SynchronousDispatcher dispatcher)
Method Detail

getPutFormParameters

public MultivaluedMap<java.lang.String,java.lang.String> getPutFormParameters()

getPutDecodedFormParameters

public MultivaluedMap<java.lang.String,java.lang.String> getPutDecodedFormParameters()

getAttribute

public java.lang.Object getAttribute(java.lang.String attribute)
Description copied from interface: HttpRequest
Map of contextual data. Similar to HttpServletRequest attributes

Specified by:
getAttribute in interface HttpRequest
Returns:

setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.Object value)
Specified by:
setAttribute in interface HttpRequest

removeAttribute

public void removeAttribute(java.lang.String name)
Specified by:
removeAttribute in interface HttpRequest

getFormParameters

public MultivaluedMap<java.lang.String,java.lang.String> getFormParameters()
Description copied from interface: HttpRequest
application/x-www-form-urlencoded parameters

This is here because @FormParam needs it and for when there are servlet filters that eat up the input stream

Specified by:
getFormParameters in interface HttpRequest
Returns:
null if no parameters, this is encoded map

getDecodedFormParameters

public MultivaluedMap<java.lang.String,java.lang.String> getDecodedFormParameters()
Specified by:
getDecodedFormParameters in interface HttpRequest

getHttpHeaders

public HttpHeaders getHttpHeaders()
Specified by:
getHttpHeaders in interface HttpRequest

getInputStream

public java.io.InputStream getInputStream()
Specified by:
getInputStream in interface HttpRequest

setInputStream

public void setInputStream(java.io.InputStream stream)
Description copied from interface: HttpRequest
If you are using a servlet container, this will *NOT* override the HttpServletRequest.getInputStream(). It will only override it for the resteasy HttpRequest

Specified by:
setInputStream in interface HttpRequest

getUri

public UriInfo getUri()
Specified by:
getUri in interface HttpRequest

getHttpMethod

public java.lang.String getHttpMethod()
Specified by:
getHttpMethod in interface HttpRequest

getPreprocessedPath

public java.lang.String getPreprocessedPath()
Description copied from interface: HttpRequest
Encoded preprocessed path with extension mappings and matrix parameters removed

Specified by:
getPreprocessedPath in interface HttpRequest
Returns:

setPreprocessedPath

public void setPreprocessedPath(java.lang.String path)
Specified by:
setPreprocessedPath in interface HttpRequest

createAsynchronousResponse

public AsynchronousResponse createAsynchronousResponse(long suspendTimeout)
Description copied from interface: HttpRequest
This method will create an asynchronous response and prepare the request to be issued asynchronously

Specified by:
createAsynchronousResponse in interface HttpRequest
Returns:

getAsynchronousResponse

public AsynchronousResponse getAsynchronousResponse()
Description copied from interface: HttpRequest
Returns the AsynchronousResponse created by createAsynchronousResponse

Specified by:
getAsynchronousResponse in interface HttpRequest
Returns:

isInitial

public boolean isInitial()
Description copied from interface: HttpRequest
Asynchronous HTTP support. Mirrors Servlet 3.0 API

Specified by:
isInitial in interface HttpRequest

isTimeout

public boolean isTimeout()

isSuspended

public boolean isSuspended()
Description copied from interface: HttpRequest
Asynchronous HTTP support. Mirrors Servlet 3.0 API

Specified by:
isSuspended in interface HttpRequest

initialRequestThreadFinished

public void initialRequestThreadFinished()
Description copied from interface: HttpRequest
Callback by the initial calling thread. This callback will probably do nothing in an asynchronous environment but will be used to simulate AsynchronousResponse in vanilla Servlet containers that do not support asychronous HTTP.

Specified by:
initialRequestThreadFinished in interface HttpRequest


Copyright © 2010. All Rights Reserved.