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
URISyntaxException
public static MockHttpRequest create(String httpMethod, String uri) throws URISyntaxException
URISyntaxException
public static MockHttpRequest create(String httpMethod, URI uriObj, URI baseUri)
public static MockHttpRequest get(String uri) throws URISyntaxException
URISyntaxException
public static MockHttpRequest post(String uri) throws URISyntaxException
URISyntaxException
public static MockHttpRequest put(String uri) throws URISyntaxException
URISyntaxException
public static MockHttpRequest delete(String uri) throws URISyntaxException
URISyntaxException
public static MockHttpRequest head(String uri) throws URISyntaxException
URISyntaxException
public static MockHttpRequest deepCopy(HttpRequest request) throws IOException
IOException
public 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 HttpRequest
public InputStream getInputStream()
getInputStream
in interface HttpRequest
public void setInputStream(InputStream stream)
HttpRequest
setInputStream
in interface HttpRequest
public UriInfo getUri()
getUri
in interface HttpRequest
public String getHttpMethod()
getHttpMethod
in interface HttpRequest
public MultivaluedMap<String,String> getFormParameters()
HttpRequest
getFormParameters
in interface HttpRequest
public MultivaluedMap<String,String> getDecodedFormParameters()
getDecodedFormParameters
in interface HttpRequest
public String getPreprocessedPath()
HttpRequest
getPreprocessedPath
in interface HttpRequest
public void setPreprocessedPath(String path)
setPreprocessedPath
in interface HttpRequest
public void suspend()
public void suspend(long timeout)
public void complete()
public boolean isInitial()
HttpRequest
isInitial
in interface HttpRequest
public boolean isSuspended()
HttpRequest
isSuspended
in interface HttpRequest
public boolean isTimeout()
public AsynchronousResponse createAsynchronousResponse(long suspendTimeout)
HttpRequest
createAsynchronousResponse
in interface HttpRequest
public AsynchronousResponse getAsynchronousResponse()
HttpRequest
getAsynchronousResponse
in interface HttpRequest
public void initialRequestThreadFinished()
HttpRequest
initialRequestThreadFinished
in interface HttpRequest
public Object getAttribute(String attribute)
HttpRequest
getAttribute
in interface HttpRequest
public void setAttribute(String name, Object value)
setAttribute
in interface HttpRequest
public void removeAttribute(String name)
removeAttribute
in interface HttpRequest
Copyright © 2018 JBoss by Red Hat. All rights reserved.