org.jboss.resteasy.mock
Class MockHttpRequest
java.lang.Object
org.jboss.resteasy.mock.MockHttpRequest
- All Implemented Interfaces:
- HttpRequest
public class MockHttpRequest
- extends Object
- implements HttpRequest
- Version:
- $Revision: 1 $
- Author:
- Bill Burke
Method Summary |
MockHttpRequest |
accept(List<MediaType> accepts)
|
MockHttpRequest |
accept(String type)
|
MockHttpRequest |
addFormHeader(String name,
String value)
Set CONTENT-TYPE to ""application/x-www-form-urlencoded" |
MockHttpRequest |
content(byte[] bytes)
|
MockHttpRequest |
content(InputStream stream)
|
MockHttpRequest |
contentType(MediaType type)
|
MockHttpRequest |
contentType(String type)
|
MockHttpRequest |
cookie(String name,
String value)
|
static MockHttpRequest |
create(String httpMethod,
String uri)
|
static MockHttpRequest |
create(String httpMethod,
URI uriObj,
URI baseUri)
|
static MockHttpRequest |
deepCopy(HttpRequest request)
|
static MockHttpRequest |
delete(String uri)
|
static MockHttpRequest |
get(String uri)
|
ResteasyAsynchronousContext |
getAsyncContext()
|
ResteasyAsynchronousContext |
getAsynchronousContext()
|
Object |
getAttribute(String attribute)
Map of contextual data. |
Enumeration<String> |
getAttributeNames()
|
MultivaluedMap<String,String> |
getDecodedFormParameters()
|
MultivaluedMap<String,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()
|
String |
getHttpMethod()
|
InputStream |
getInputStream()
|
ResteasyUriInfo |
getUri()
|
static MockHttpRequest |
head(String uri)
|
MockHttpRequest |
header(String name,
String value)
|
void |
initialRequestThreadFinished()
|
protected static MockHttpRequest |
initWithUri(String uri)
|
boolean |
isInitial()
|
MockHttpRequest |
language(String language)
|
static MockHttpRequest |
post(String uri)
|
static MockHttpRequest |
put(String uri)
|
void |
removeAttribute(String name)
|
void |
setAsynchronousContext(ResteasyAsynchronousContext asynchronousContext)
|
void |
setAttribute(String name,
Object value)
|
void |
setHttpMethod(String method)
|
void |
setInputStream(InputStream stream)
If you are using a servlet container, this will *NOT* override the HttpServletRequest.getInputStream(). |
void |
setRequestUri(URI requestUri)
|
void |
setRequestUri(URI baseUri,
URI requestUri)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
httpHeaders
protected HttpHeadersImpl httpHeaders
inputStream
protected InputStream inputStream
uri
protected ResteasyUriInfo uri
httpMethod
protected String httpMethod
formParameters
protected MultivaluedMap<String,String> formParameters
decodedFormParameters
protected MultivaluedMap<String,String> decodedFormParameters
attributes
protected Map<String,Object> attributes
asynchronousContext
protected ResteasyAsynchronousContext asynchronousContext
EMPTY_URI
protected static final URI EMPTY_URI
MockHttpRequest
protected MockHttpRequest()
initWithUri
protected static MockHttpRequest initWithUri(String uri)
throws URISyntaxException
- Throws:
URISyntaxException
create
public static MockHttpRequest create(String httpMethod,
String uri)
throws URISyntaxException
- Throws:
URISyntaxException
create
public static MockHttpRequest create(String httpMethod,
URI uriObj,
URI baseUri)
get
public static MockHttpRequest get(String uri)
throws URISyntaxException
- Throws:
URISyntaxException
post
public static MockHttpRequest post(String uri)
throws URISyntaxException
- Throws:
URISyntaxException
put
public static MockHttpRequest put(String uri)
throws URISyntaxException
- Throws:
URISyntaxException
delete
public static MockHttpRequest delete(String uri)
throws URISyntaxException
- Throws:
URISyntaxException
head
public static MockHttpRequest head(String uri)
throws URISyntaxException
- Throws:
URISyntaxException
deepCopy
public static MockHttpRequest deepCopy(HttpRequest request)
throws IOException
- Throws:
IOException
setHttpMethod
public void setHttpMethod(String method)
- Specified by:
setHttpMethod
in interface HttpRequest
getAsynchronousContext
public ResteasyAsynchronousContext getAsynchronousContext()
setAsynchronousContext
public void setAsynchronousContext(ResteasyAsynchronousContext asynchronousContext)
header
public MockHttpRequest header(String name,
String value)
accept
public MockHttpRequest accept(List<MediaType> accepts)
accept
public MockHttpRequest accept(String type)
language
public MockHttpRequest language(String language)
cookie
public MockHttpRequest cookie(String name,
String value)
contentType
public MockHttpRequest contentType(String type)
contentType
public MockHttpRequest contentType(MediaType type)
content
public MockHttpRequest content(byte[] bytes)
content
public MockHttpRequest content(InputStream stream)
addFormHeader
public MockHttpRequest addFormHeader(String name,
String value)
- Set CONTENT-TYPE to ""application/x-www-form-urlencoded"
- Parameters:
name
- value
-
- Returns:
getHttpHeaders
public HttpHeaders getHttpHeaders()
- Specified by:
getHttpHeaders
in interface HttpRequest
getInputStream
public InputStream getInputStream()
- Specified by:
getInputStream
in interface HttpRequest
setInputStream
public void setInputStream(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 ResteasyUriInfo getUri()
- Specified by:
getUri
in interface HttpRequest
getHttpMethod
public String getHttpMethod()
- Specified by:
getHttpMethod
in interface HttpRequest
getFormParameters
public MultivaluedMap<String,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<String,String> getDecodedFormParameters()
- Specified by:
getDecodedFormParameters
in interface HttpRequest
setRequestUri
public void setRequestUri(URI requestUri)
throws IllegalStateException
- Specified by:
setRequestUri
in interface HttpRequest
- Throws:
IllegalStateException
setRequestUri
public void setRequestUri(URI baseUri,
URI requestUri)
throws IllegalStateException
- Specified by:
setRequestUri
in interface HttpRequest
- Throws:
IllegalStateException
isInitial
public boolean isInitial()
- Specified by:
isInitial
in interface HttpRequest
initialRequestThreadFinished
public void initialRequestThreadFinished()
getAttribute
public Object getAttribute(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(String name,
Object value)
- Specified by:
setAttribute
in interface HttpRequest
removeAttribute
public void removeAttribute(String name)
- Specified by:
removeAttribute
in interface HttpRequest
getAttributeNames
public Enumeration<String> getAttributeNames()
- Specified by:
getAttributeNames
in interface HttpRequest
getAsyncContext
public ResteasyAsynchronousContext getAsyncContext()
- Specified by:
getAsyncContext
in interface HttpRequest
Copyright © 2012. All Rights Reserved.