public class MockHttpRequest extends BaseHttpRequest
Modifier and Type | Field and Description |
---|---|
protected ResteasyAsynchronousContext |
asynchronousContext |
protected Map<String,Object> |
attributes |
protected static URI |
EMPTY_URI |
protected ResteasyHttpHeaders |
httpHeaders |
protected String |
httpMethod |
protected InputStream |
inputStream |
decodedFormParameters, formParameters, uri
Modifier | Constructor and Description |
---|---|
protected |
MockHttpRequest() |
Modifier and Type | Method and Description |
---|---|
MockHttpRequest |
accept(List<javax.ws.rs.core.MediaType> accepts) |
MockHttpRequest |
accept(javax.ws.rs.core.MediaType accept) |
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(javax.ws.rs.core.MediaType type) |
MockHttpRequest |
contentType(String type) |
MockHttpRequest |
cookie(String name,
String value) |
static MockHttpRequest |
create(String httpMethod,
String uri) |
static MockHttpRequest |
create(String httpMethod,
String absolute,
String query,
String contextPath) |
static MockHttpRequest |
create(String httpMethod,
URI uriObj,
URI baseUri) |
static MockHttpRequest |
deepCopy(HttpRequest request) |
static MockHttpRequest |
delete(String uri) |
void |
forward(String path) |
static MockHttpRequest |
get(String uri) |
ResteasyAsynchronousContext |
getAsyncContext() |
ResteasyAsynchronousContext |
getAsynchronousContext() |
Object |
getAttribute(String attribute)
Map of contextual data.
|
Enumeration<String> |
getAttributeNames() |
javax.ws.rs.core.HttpHeaders |
getHttpHeaders() |
String |
getHttpMethod() |
InputStream |
getInputStream() |
javax.ws.rs.core.MultivaluedMap<String,String> |
getMutableHeaders() |
String |
getRemoteAddress()
Returns the Internet Protocol (IP) address of the client
or last proxy that sent the request.
|
String |
getRemoteHost()
Returns the fully qualified name of the client
or the last proxy that sent the request.
|
ResteasyUriInfo |
getUri()
This method *MUST* always return the same instance.
|
static MockHttpRequest |
head(String uri) |
MockHttpRequest |
header(String name,
String value) |
void |
initialRequestThreadFinished() |
protected static MockHttpRequest |
initWithUri(String uri) |
MockHttpRequest |
language(String language) |
static MockHttpRequest |
options(String uri) |
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().
|
boolean |
wasForwarded() |
formParametersRead, getDecodedFormParameters, getFormParameters, isInitial, setRequestUri, setRequestUri
protected ResteasyHttpHeaders httpHeaders
protected InputStream inputStream
protected String httpMethod
protected ResteasyAsynchronousContext asynchronousContext
protected static final URI EMPTY_URI
protected static MockHttpRequest initWithUri(String uri) throws URISyntaxException
URISyntaxException
public static MockHttpRequest create(String httpMethod, String absolute, String query, String contextPath)
public static MockHttpRequest create(String httpMethod, String uri) throws URISyntaxException
URISyntaxException
public static MockHttpRequest create(String httpMethod, URI uriObj, URI baseUri)
public static MockHttpRequest options(String uri) throws URISyntaxException
URISyntaxException
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 void setHttpMethod(String method)
public ResteasyAsynchronousContext getAsynchronousContext()
public void setAsynchronousContext(ResteasyAsynchronousContext asynchronousContext)
public MockHttpRequest header(String name, String value)
public MockHttpRequest accept(List<javax.ws.rs.core.MediaType> accepts)
public MockHttpRequest accept(javax.ws.rs.core.MediaType accept)
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(javax.ws.rs.core.MediaType type)
public MockHttpRequest content(byte[] bytes)
public MockHttpRequest content(InputStream stream)
public MockHttpRequest addFormHeader(String name, String value)
name
- form param namevalue
- form param valueMockHttpRequest
public javax.ws.rs.core.HttpHeaders getHttpHeaders()
public InputStream getInputStream()
public void setInputStream(InputStream stream)
HttpRequest
stream
- input streampublic ResteasyUriInfo getUri()
HttpRequest
getUri
in interface HttpRequest
getUri
in class BaseHttpRequest
public String getHttpMethod()
public void initialRequestThreadFinished()
public Object getAttribute(String attribute)
HttpRequest
attribute
- attribute namepublic void removeAttribute(String name)
public Enumeration<String> getAttributeNames()
public ResteasyAsynchronousContext getAsyncContext()
public void forward(String path)
public boolean wasForwarded()
public String getRemoteHost()
HttpRequest
String
containing the fully
qualified name of the clientpublic String getRemoteAddress()
HttpRequest
String
containing the
IP address of the client that sent the requestCopyright © 2020 JBoss by Red Hat. All rights reserved.