public class Response extends Object
Modifier | Constructor and Description |
---|---|
protected |
Response() |
Modifier and Type | Method and Description |
---|---|
String |
body() |
void |
body(String body)
Sets the body
|
void |
cookie(String name,
String value)
Adds not persistent cookie to the response.
|
void |
cookie(String name,
String value,
int maxAge)
Adds cookie to the response.
|
void |
cookie(String name,
String value,
int maxAge,
boolean secured)
Adds cookie to the response.
|
void |
cookie(String path,
String name,
String value,
int maxAge,
boolean secured)
Adds cookie to the response.
|
void |
header(String header,
String value)
Adds/Sets a response header
|
javax.servlet.http.HttpServletResponse |
raw()
Gets the raw response object handed in by Jetty
|
void |
redirect(String location)
Trigger a browser redirect
|
void |
redirect(String location,
int httpStatusCode)
Trigger a browser redirect with specific http 3XX status code.
|
void |
removeCookie(String name)
Removes the cookie.
|
void |
status(int statusCode)
Sets the status code for the response
|
void |
type(String contentType)
Sets the content type for the response
|
public void status(int statusCode)
public void type(String contentType)
public void body(String body)
public String body()
public javax.servlet.http.HttpServletResponse raw()
public void redirect(String location)
location
- Where to redirectpublic void redirect(String location, int httpStatusCode)
location
- Where to redirect permanentlyhttpStatusCode
- the http status codepublic void cookie(String name, String value)
name
- name of the cookievalue
- value of the cookiepublic void cookie(String name, String value, int maxAge)
name
- 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)public void cookie(String name, String value, int maxAge, boolean secured)
name
- 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 secured
zero - deletes the cookie)public void cookie(String path, String name, String value, int maxAge, boolean secured)
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 secured
zero - deletes the cookie)public void removeCookie(String name)
name
- name of the cookieCopyright © 2013. All Rights Reserved.