-
- All Implemented Interfaces:
-
com.hexagonkt.http.server.ResponsePort
public final class TestResponse implements ResponsePort
-
-
Field Summary
Fields Modifier and Type Field Description private Map<String, Cookie>cookiesprivate Objectbodyprivate StringcontentTypeprivate Integerstatusprivate OutputStreamoutputStream
-
Constructor Summary
Constructors Constructor Description TestResponse(Map<String, Cookie> cookies, Object body, String contentType, Integer status, OutputStream outputStream)
-
Method Summary
Modifier and Type Method Description final Map<String, Cookie>getCookies()final UnitsetCookies(Map<String, Cookie> cookies)final ObjectgetBody()final UnitsetBody(Object body)final StringgetContentType()final UnitsetContentType(String contentType)final IntegergetStatus()final UnitsetStatus(Integer status)final OutputStreamgetOutputStream()final UnitsetOutputStream(OutputStream outputStream)UnitaddCookie(Cookie cookie)Sends a response by adding the given cookie. Objectbody()Provides the body of the response. Unitbody(Object value)Sets the body of the response. StringcontentType()Provides the content type of the response. UnitcontentType(String value)Sets the content type of the response. OutputStreamoutputStream()Provides a OutputStream instance for the response. Unitredirect(String url)Sends a redirect response to the client using the specified redirect URL. UnitremoveCookie(String name)Sends a response by removing the cookie with specified name. Integerstatus()Provides the status code of the response. Unitstatus(Integer value)Sets the status code of the response. -
-
Method Detail
-
getCookies
final Map<String, Cookie> getCookies()
-
setCookies
final Unit setCookies(Map<String, Cookie> cookies)
-
getContentType
final String getContentType()
-
setContentType
final Unit setContentType(String contentType)
-
getOutputStream
final OutputStream getOutputStream()
-
setOutputStream
final Unit setOutputStream(OutputStream outputStream)
-
addCookie
Unit addCookie(Cookie cookie)
Sends a response by adding the given cookie.
- Parameters:
cookie- Cookie to be added.
-
contentType
String contentType()
Provides the content type of the response.
-
contentType
Unit contentType(String value)
Sets the content type of the response.
- Parameters:
value- Content type info.
-
outputStream
OutputStream outputStream()
Provides a OutputStream instance for the response.
-
redirect
Unit redirect(String url)
Sends a redirect response to the client using the specified redirect URL.
- Parameters:
url- Redirect URL.
-
removeCookie
Unit removeCookie(String name)
Sends a response by removing the cookie with specified name.
- Parameters:
name- Cookie to be deleted.
-
-
-
-