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
- Version:
- $Revision: 1 $
- Author:
- Bill Burke
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ResteasyAsynchronousContextprotected static final URIprotected ResteasyHttpHeadersprotected Stringprotected InputStreamFields inherited from class org.jboss.resteasy.plugins.server.BaseHttpRequest
decodedFormParameters, formParameters, uri -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaccept(jakarta.ws.rs.core.MediaType accept) addFormHeader(String name, String value) Set CONTENT-TYPE to ""application/x-www-form-urlencoded"content(byte[] bytes) content(InputStream stream) contentType(jakarta.ws.rs.core.MediaType type) contentType(String type) static MockHttpRequeststatic MockHttpRequeststatic MockHttpRequeststatic MockHttpRequestdeepCopy(HttpRequest request) static MockHttpRequestvoidstatic MockHttpRequestgetAttribute(String attribute) Map of contextual data.jakarta.ws.rs.core.HttpHeadersReturns the Internet Protocol (IP) address of the client or last proxy that sent the request.Returns the fully qualified name of the client or the last proxy that sent the request.getUri()This method *MUST* always return the same instance.static MockHttpRequestvoidprotected static MockHttpRequestinitWithUri(String uri) static MockHttpRequeststatic MockHttpRequeststatic MockHttpRequeststatic MockHttpRequestvoidremoveAttribute(String name) voidsetAsynchronousContext(ResteasyAsynchronousContext asynchronousContext) voidsetAttribute(String name, Object value) voidsetHttpMethod(String method) voidsetInputStream(InputStream stream) If you are using a servlet container, this will *NOT* override the HttpServletRequest.getInputStream().booleanMethods inherited from class org.jboss.resteasy.plugins.server.BaseHttpRequest
formParametersRead, getDecodedFormParameters, getFormParameters, isInitial, setRequestUri, setRequestUriMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.jboss.resteasy.spi.HttpRequest
getFormEntityPart, getFormEntityParts
-
Field Details
-
httpHeaders
-
inputStream
-
httpMethod
-
attributes
-
asynchronousContext
-
EMPTY_URI
-
-
Constructor Details
-
MockHttpRequest
protected MockHttpRequest()
-
-
Method Details
-
initWithUri
- Throws:
URISyntaxException
-
create
public static MockHttpRequest create(String httpMethod, String absolute, String query, String contextPath) -
create
- Throws:
URISyntaxException
-
create
-
options
- Throws:
URISyntaxException
-
get
- Throws:
URISyntaxException
-
post
- Throws:
URISyntaxException
-
put
- Throws:
URISyntaxException
-
patch
- Throws:
URISyntaxException
-
delete
- Throws:
URISyntaxException
-
head
- Throws:
URISyntaxException
-
deepCopy
- Throws:
IOException
-
setHttpMethod
-
getAsynchronousContext
-
setAsynchronousContext
-
header
-
accept
-
accept
-
accept
-
language
-
cookie
-
contentType
-
contentType
-
content
-
content
-
addFormHeader
Set CONTENT-TYPE to ""application/x-www-form-urlencoded"- Parameters:
name- form param namevalue- form param value- Returns:
MockHttpRequest
-
getHttpHeaders
public jakarta.ws.rs.core.HttpHeaders getHttpHeaders() -
getMutableHeaders
-
getInputStream
-
setInputStream
Description copied from interface:HttpRequestIf you are using a servlet container, this will *NOT* override the HttpServletRequest.getInputStream(). It will only override it for the resteasy HttpRequest- Parameters:
stream- input stream
-
getUri
Description copied from interface:HttpRequestThis method *MUST* always return the same instance.- Specified by:
getUriin interfaceHttpRequest- Overrides:
getUriin classBaseHttpRequest- Returns:
- uri info
-
getHttpMethod
-
initialRequestThreadFinished
public void initialRequestThreadFinished() -
getAttribute
Description copied from interface:HttpRequestMap of contextual data. Similar to HttpServletRequest attributes- Parameters:
attribute- attribute name- Returns:
- attribute
-
setAttribute
-
removeAttribute
-
getAttributeNames
-
getAsyncContext
-
forward
-
wasForwarded
public boolean wasForwarded() -
getRemoteHost
Description copied from interface:HttpRequestReturns the fully qualified name of the client or the last proxy that sent the request. If the engine cannot or chooses not to resolve the hostname (to improve performance), this method returns the dotted-string form of the IP address.- Returns:
- a
Stringcontaining the fully qualified name of the client
-
getRemoteAddress
Description copied from interface:HttpRequestReturns the Internet Protocol (IP) address of the client or last proxy that sent the request.- Returns:
- a
Stringcontaining the IP address of the client that sent the request
-