public class MockHttpRequest extends Object implements HttpRequest
| Modifier and Type | Field and Description |
|---|---|
protected Map<String,Object> |
attributes |
protected MultivaluedMap<String,String> |
decodedFormParameters |
protected static URI |
EMPTY_URI |
protected MultivaluedMap<String,String> |
formParameters |
protected HttpHeadersImpl |
httpHeaders |
protected String |
httpMethod |
protected InputStream |
inputStream |
protected String |
preprocessedPath |
protected UriInfo |
uri |
| Modifier | Constructor and Description |
|---|---|
protected |
MockHttpRequest() |
| Modifier and Type | Method and Description |
|---|---|
MockHttpRequest |
accept(List<MediaType> accepts) |
MockHttpRequest |
accept(String type) |
MockHttpRequest |
addFormHeader(String name,
String value)
Set CONTENT-TYPE to ""application/x-www-form-urlencoded"
|
void |
complete() |
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) |
AsynchronousResponse |
createAsynchronousResponse(long suspendTimeout)
This method will create an asynchronous response and prepare the
request to be issued asynchronously
|
static MockHttpRequest |
deepCopy(HttpRequest request) |
static MockHttpRequest |
delete(String uri) |
static MockHttpRequest |
get(String uri) |
AsynchronousResponse |
getAsynchronousResponse()
Returns the AsynchronousResponse created by createAsynchronousResponse
|
Object |
getAttribute(String attribute)
Map of contextual data.
|
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() |
String |
getPreprocessedPath()
Encoded preprocessed path with extension mappings and matrix parameters removed
|
UriInfo |
getUri() |
static MockHttpRequest |
head(String uri) |
MockHttpRequest |
header(String name,
String value) |
void |
initialRequestThreadFinished()
Callback by the initial calling thread.
|
protected static MockHttpRequest |
initWithUri(String uri) |
boolean |
isInitial()
Asynchronous HTTP support.
|
boolean |
isSuspended()
Asynchronous HTTP support.
|
boolean |
isTimeout() |
MockHttpRequest |
language(String language) |
static MockHttpRequest |
post(String uri) |
static MockHttpRequest |
put(String uri) |
void |
removeAttribute(String name) |
void |
setAttribute(String name,
Object value) |
void |
setInputStream(InputStream stream)
If you are using a servlet container, this will *NOT* override the HttpServletRequest.getInputStream().
|
void |
setPreprocessedPath(String path) |
void |
suspend() |
void |
suspend(long timeout) |
protected HttpHeadersImpl httpHeaders
protected InputStream inputStream
protected UriInfo uri
protected String httpMethod
protected String preprocessedPath
protected MultivaluedMap<String,String> formParameters
protected MultivaluedMap<String,String> decodedFormParameters
protected static final URI EMPTY_URI
protected static MockHttpRequest initWithUri(String uri) throws URISyntaxException
URISyntaxExceptionpublic static MockHttpRequest create(String httpMethod, String uri) throws URISyntaxException
URISyntaxExceptionpublic static MockHttpRequest create(String httpMethod, URI uriObj, URI baseUri)
public static MockHttpRequest get(String uri) throws URISyntaxException
URISyntaxExceptionpublic static MockHttpRequest post(String uri) throws URISyntaxException
URISyntaxExceptionpublic static MockHttpRequest put(String uri) throws URISyntaxException
URISyntaxExceptionpublic static MockHttpRequest delete(String uri) throws URISyntaxException
URISyntaxExceptionpublic static MockHttpRequest head(String uri) throws URISyntaxException
URISyntaxExceptionpublic static MockHttpRequest deepCopy(HttpRequest request) throws IOException
IOExceptionpublic MockHttpRequest header(String name, String value)
public MockHttpRequest accept(List<MediaType> accepts)
public MockHttpRequest accept(String type)
public MockHttpRequest language(String language)
public MockHttpRequest cookie(String name, String value)
public MockHttpRequest contentType(String type)
public MockHttpRequest contentType(MediaType type)
public MockHttpRequest content(byte[] bytes)
public MockHttpRequest content(InputStream stream)
public MockHttpRequest addFormHeader(String name, String value)
name - value - public HttpHeaders getHttpHeaders()
getHttpHeaders in interface HttpRequestpublic InputStream getInputStream()
getInputStream in interface HttpRequestpublic void setInputStream(InputStream stream)
HttpRequestsetInputStream in interface HttpRequestpublic UriInfo getUri()
getUri in interface HttpRequestpublic String getHttpMethod()
getHttpMethod in interface HttpRequestpublic MultivaluedMap<String,String> getFormParameters()
HttpRequestgetFormParameters in interface HttpRequestpublic MultivaluedMap<String,String> getDecodedFormParameters()
getDecodedFormParameters in interface HttpRequestpublic String getPreprocessedPath()
HttpRequestgetPreprocessedPath in interface HttpRequestpublic void setPreprocessedPath(String path)
setPreprocessedPath in interface HttpRequestpublic void suspend()
public void suspend(long timeout)
public void complete()
public boolean isInitial()
HttpRequestisInitial in interface HttpRequestpublic boolean isSuspended()
HttpRequestisSuspended in interface HttpRequestpublic boolean isTimeout()
public AsynchronousResponse createAsynchronousResponse(long suspendTimeout)
HttpRequestcreateAsynchronousResponse in interface HttpRequestpublic AsynchronousResponse getAsynchronousResponse()
HttpRequestgetAsynchronousResponse in interface HttpRequestpublic void initialRequestThreadFinished()
HttpRequestinitialRequestThreadFinished in interface HttpRequestpublic Object getAttribute(String attribute)
HttpRequestgetAttribute in interface HttpRequestpublic void setAttribute(String name, Object value)
setAttribute in interface HttpRequestpublic void removeAttribute(String name)
removeAttribute in interface HttpRequestCopyright © 2018 JBoss by Red Hat. All rights reserved.