Package org.actioncontroller.jakarta
Class FakeJakartaApiClient.FakeApiClientExchange
- java.lang.Object
-
- org.actioncontroller.jakarta.FakeJakartaApiClient.FakeApiClientExchange
-
- All Implemented Interfaces:
ApiClientExchange
- Enclosing class:
- FakeJakartaApiClient
public class FakeJakartaApiClient.FakeApiClientExchange extends Object implements ApiClientExchange
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddRequestCookie(String name, Object value)Sets the specified HTTP cookie value.voidcheckForError()voidexecuteRequest()StringgetApiURL()Returns the path to where the controllers paths are evaluated relative to, that is, the Servlet's context URL.StringgetPathInfo()StringgetRequestMethod()URLgetRequestURL()ReadergetResponseBodyReader()InputStreamgetResponseBodyStream()intgetResponseCode()List<String>getResponseCookies(String name)List<String>getResponseHeaders(String name)booleanisError()voidoutput(String contentType, ApiHttpExchange.OutputStreamConsumer consumer)voidsetClientCertificate(X509Certificate[] certificate)voidsetHeader(String name, Object value)voidsetPathInfo(String pathInfo)voidsetRemoteUser(Object remoteUser)voidsetRequestParameter(String name, Object value)Sets the specified HTTP request parameter to be included in URL query (for GET requests) or application/x-www-form-urlencoded body (for other request methods).voidsetTarget(String method, String pathInfo)voidwrite(String contentType, ApiHttpExchange.WriterConsumer consumer)
-
-
-
Method Detail
-
setTarget
public void setTarget(String method, String pathInfo)
- Specified by:
setTargetin interfaceApiClientExchange
-
getRequestMethod
public String getRequestMethod()
- Specified by:
getRequestMethodin interfaceApiClientExchange
-
getApiURL
public String getApiURL()
Description copied from interface:ApiClientExchangeReturns the path to where the controllers paths are evaluated relative to, that is, the Servlet's context URL. For example, if anApiServletis bound as "/api/*" in a webapp mounted at "/app", getApiURL might returnhttps://example.com:7443/app/api.- Specified by:
getApiURLin interfaceApiClientExchange
-
getPathInfo
public String getPathInfo()
- Specified by:
getPathInfoin interfaceApiClientExchange
-
setPathInfo
public void setPathInfo(String pathInfo)
- Specified by:
setPathInfoin interfaceApiClientExchange
-
getRequestURL
public URL getRequestURL()
- Specified by:
getRequestURLin interfaceApiClientExchange
-
setRequestParameter
public void setRequestParameter(String name, Object value)
Description copied from interface:ApiClientExchangeSets the specified HTTP request parameter to be included in URL query (for GET requests) or application/x-www-form-urlencoded body (for other request methods).- Specified by:
setRequestParameterin interfaceApiClientExchange- Parameters:
name- Name of the HTTP request parameter to setvalue- If null or Optional.empty, parameter will be unset; if Optional, value will be extracted
-
addRequestCookie
public void addRequestCookie(String name, Object value)
Description copied from interface:ApiClientExchangeSets the specified HTTP cookie value. The cookie value will be URL encoded before sent in the Cookie-header- Specified by:
addRequestCookiein interfaceApiClientExchange- Parameters:
name- Name of the HTTP cookie to setvalue- If null or Optional.empty, cookie will be unset; if Optional, value will be extracted
-
setHeader
public void setHeader(String name, Object value)
- Specified by:
setHeaderin interfaceApiClientExchange
-
executeRequest
public void executeRequest() throws IOException- Specified by:
executeRequestin interfaceApiClientExchange- Throws:
IOException
-
isError
public boolean isError()
-
getResponseCode
public int getResponseCode()
- Specified by:
getResponseCodein interfaceApiClientExchange
-
checkForError
public void checkForError() throws HttpClientException- Specified by:
checkForErrorin interfaceApiClientExchange- Throws:
HttpClientException
-
getResponseHeaders
public List<String> getResponseHeaders(String name)
- Specified by:
getResponseHeadersin interfaceApiClientExchange
-
getResponseCookies
public List<String> getResponseCookies(String name)
- Specified by:
getResponseCookiesin interfaceApiClientExchange
-
getResponseBodyReader
public Reader getResponseBodyReader()
- Specified by:
getResponseBodyReaderin interfaceApiClientExchange
-
getResponseBodyStream
public InputStream getResponseBodyStream()
- Specified by:
getResponseBodyStreamin interfaceApiClientExchange
-
setClientCertificate
public void setClientCertificate(X509Certificate[] certificate)
- Specified by:
setClientCertificatein interfaceApiClientExchange
-
write
public void write(String contentType, ApiHttpExchange.WriterConsumer consumer) throws IOException
- Specified by:
writein interfaceApiClientExchange- Throws:
IOException
-
output
public void output(String contentType, ApiHttpExchange.OutputStreamConsumer consumer) throws IOException
- Specified by:
outputin interfaceApiClientExchange- Throws:
IOException
-
setRemoteUser
public void setRemoteUser(Object remoteUser)
-
-