Package spark.http.matching
Class ResponseWrapper
java.lang.Object
spark.Response
spark.http.matching.ResponseWrapper
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbody()
returns the bodyvoid
Sets the bodyvoid
Adds not persistent cookie to the response.void
Adds cookie to the response.void
Adds cookie to the response.void
Adds cookie to the response.void
Adds cookie to the response.void
cookie
(String domain, String path, String name, String value, int maxAge, boolean secured, boolean httpOnly) Adds cookie to the response.(package private) static ResponseWrapper
create()
boolean
(package private) Response
int
hashCode()
void
Adds/Sets a response header(package private) boolean
javax.servlet.http.HttpServletResponse
raw()
void
Trigger a browser redirectvoid
Trigger a browser redirect with specific http 3XX status code.void
removeCookie
(String name) Removes the cookie.void
removeCookie
(String path, String name) Removes the cookie with given path and name.void
setDelegate
(Response delegate) int
status()
Returns the status codevoid
status
(int statusCode) Sets the status code for thetoString()
type()
Returns the content typevoid
Sets the content type for the response
-
Field Details
-
delegate
-
redirected
private boolean redirected
-
-
Constructor Details
-
ResponseWrapper
private ResponseWrapper()
-
-
Method Details
-
create
-
setDelegate
-
getDelegate
Response getDelegate() -
status
public void status(int statusCode) Description copied from class:Response
Sets the status code for the -
status
public int status()Description copied from class:Response
Returns the status code -
body
Description copied from class:Response
Sets the body -
body
Description copied from class:Response
returns the body -
equals
-
hashCode
public int hashCode() -
raw
public javax.servlet.http.HttpServletResponse raw() -
redirect
Description copied from class:Response
Trigger a browser redirect -
redirect
Description copied from class:Response
Trigger a browser redirect with specific http 3XX status code. -
isRedirected
boolean isRedirected()- Returns:
- true if redirected has been done
-
header
Description copied from class:Response
Adds/Sets a response header -
toString
-
type
Description copied from class:Response
Sets the content type for the response -
type
Description copied from class:Response
Returns the content type -
cookie
Description copied from class:Response
Adds not persistent cookie to the response. Can be invoked multiple times to insert more than one cookie. -
cookie
Description copied from class:Response
Adds cookie to the response. Can be invoked multiple times to insert more than one cookie. -
cookie
Description copied from class:Response
Adds cookie to the response. Can be invoked multiple times to insert more than one cookie. -
cookie
Description copied from class:Response
Adds cookie to the response. Can be invoked multiple times to insert more than one cookie. -
cookie
public void cookie(String path, String name, String value, int maxAge, boolean secured, boolean httpOnly) Description copied from class:Response
Adds cookie to the response. Can be invoked multiple times to insert more than one cookie.- Overrides:
cookie
in classResponse
- Parameters:
path
- path of the cookiename
- name of the cookievalue
- value of the cookiemaxAge
- max age of the cookie in seconds (negative for the not persistent cookie, zero - deletes the cookie)secured
- if true : cookie will be securedhttpOnly
- if true: cookie will be marked as http only
-
cookie
public void cookie(String domain, String path, String name, String value, int maxAge, boolean secured, boolean httpOnly) Description copied from class:Response
Adds cookie to the response. Can be invoked multiple times to insert more than one cookie.- Overrides:
cookie
in classResponse
- Parameters:
domain
- domain of the cookiepath
- path of the cookiename
- name of the cookievalue
- value of the cookiemaxAge
- max age of the cookie in seconds (negative for the not persistent cookie, zero - deletes the cookie)secured
- if true : cookie will be securedhttpOnly
- if true: cookie will be marked as http only
-
removeCookie
Description copied from class:Response
Removes the cookie.- Overrides:
removeCookie
in classResponse
- Parameters:
name
- name of the cookie
-
removeCookie
Description copied from class:Response
Removes the cookie with given path and name.- Overrides:
removeCookie
in classResponse
- Parameters:
path
- path of the cookiename
- name of the cookie
-