Package org.jboss.resteasy.mock
Class MockHttpRequest
- java.lang.Object
-
- org.jboss.resteasy.plugins.server.BaseHttpRequest
-
- org.jboss.resteasy.mock.MockHttpRequest
-
- All Implemented Interfaces:
HttpRequest
public class MockHttpRequest extends BaseHttpRequest
- Version:
- $Revision: 1 $
- Author:
- Bill Burke
-
-
Field Summary
Fields Modifier and Type Field Description protected ResteasyAsynchronousContextasynchronousContextprotected Map<String,Object>attributesprotected static URIEMPTY_URIprotected ResteasyHttpHeadershttpHeadersprotected StringhttpMethodprotected InputStreaminputStream-
Fields inherited from class org.jboss.resteasy.plugins.server.BaseHttpRequest
decodedFormParameters, formParameters, uri
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedMockHttpRequest()
-
Method Summary
-
Methods inherited from class org.jboss.resteasy.plugins.server.BaseHttpRequest
formParametersRead, getDecodedFormParameters, getFormParameters, isInitial, setRequestUri, setRequestUri
-
-
-
-
Field Detail
-
httpHeaders
protected ResteasyHttpHeaders httpHeaders
-
inputStream
protected InputStream inputStream
-
httpMethod
protected String httpMethod
-
asynchronousContext
protected ResteasyAsynchronousContext asynchronousContext
-
EMPTY_URI
protected static final URI EMPTY_URI
-
-
Method Detail
-
initWithUri
protected static MockHttpRequest initWithUri(String uri) throws URISyntaxException
- Throws:
URISyntaxException
-
create
public static MockHttpRequest create(String httpMethod, String absolute, String query, String contextPath)
-
create
public static MockHttpRequest create(String httpMethod, String uri) throws URISyntaxException
- Throws:
URISyntaxException
-
create
public static MockHttpRequest create(String httpMethod, URI uriObj, URI baseUri)
-
options
public static MockHttpRequest options(String uri) throws URISyntaxException
- Throws:
URISyntaxException
-
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
-
patch
public static MockHttpRequest patch(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)
-
getAsynchronousContext
public ResteasyAsynchronousContext getAsynchronousContext()
-
setAsynchronousContext
public void setAsynchronousContext(ResteasyAsynchronousContext asynchronousContext)
-
header
public MockHttpRequest header(String name, String value)
-
accept
public MockHttpRequest accept(List<javax.ws.rs.core.MediaType> accepts)
-
accept
public MockHttpRequest accept(javax.ws.rs.core.MediaType accept)
-
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(javax.ws.rs.core.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- form param namevalue- form param value- Returns:
MockHttpRequest
-
getHttpHeaders
public javax.ws.rs.core.HttpHeaders getHttpHeaders()
-
getInputStream
public InputStream getInputStream()
-
setInputStream
public void setInputStream(InputStream stream)
-
getUri
public ResteasyUriInfo getUri()
- Specified by:
getUriin interfaceHttpRequest- Overrides:
getUriin classBaseHttpRequest
-
getHttpMethod
public String getHttpMethod()
-
initialRequestThreadFinished
public void initialRequestThreadFinished()
-
removeAttribute
public void removeAttribute(String name)
-
getAttributeNames
public Enumeration<String> getAttributeNames()
-
getAsyncContext
public ResteasyAsynchronousContext getAsyncContext()
-
forward
public void forward(String path)
-
wasForwarded
public boolean wasForwarded()
-
getRemoteHost
public String getRemoteHost()
-
getRemoteAddress
public String getRemoteAddress()
-
-