public class Response extends Object
Constructor and Description |
---|
Response()
Constructs a new empty response with status code 200 (OK).
|
Response(Response p)
Constructs a new empty response from an existing one.
|
Modifier and Type | Method and Description |
---|---|
void |
addCookie(Cookie c)
Adds a cookie.
|
void |
addSession(Session s)
Adds a session as relevant for the response.
|
String |
getETag()
Returns the current ETag of this response.
|
AbstractHandler |
getHandler(String name)
Returns a registered handler, or null if not found.
|
Collection<AbstractHandler> |
getHandlers()
Returns the registered handlers.
|
long |
getLastModified()
Returns the current Last-Modified timestamp of this response.
|
Object |
getObject()
Returns the payload
|
Object |
getResult() |
Set<Session> |
getSessions()
Returns the associated sessions.
|
int |
getStatus()
Returns the status code.
|
String |
getText()
Returns the plain-text payload.
|
XML |
getXML()
Returns the XML payload.
|
boolean |
hasPayload() |
boolean |
isAugmented()
Returns augmented status.
|
boolean |
isText()
Checks whether the payload is plain-text.
|
boolean |
isXML()
Checks whether the payload is XML.
|
void |
refresh(Object value)
Refreshes the ETag and the Last-Modified timestamp.
|
void |
setAugmented(boolean augmented)
Sets augmented status.
|
void |
setContentType(String contenttype)
Sets the Content-Type.
|
void |
setHandler(String name,
AbstractHandler sh)
Registers a handler for this response.
|
void |
setResult(Object result) |
void |
setStatus(int status)
Sets the status code.
|
void |
setText(String str)
Sets the payload to the given plain-text value.
|
void |
setXML(XML xml)
Sets the payload to the given XML value.
|
void |
write(HttpServletRequest request,
HttpServletResponse response)
Writes this response as HTTP response to the client and closes the response.
|
public Response()
public Response(Response p)
public void addCookie(Cookie c)
public void addSession(Session s)
public String getETag()
public AbstractHandler getHandler(String name)
public Collection<AbstractHandler> getHandlers()
public long getLastModified()
public Object getObject()
public Object getResult()
public Set<Session> getSessions()
public int getStatus()
public String getText() throws JWIGException
JWIGException
- if the response has no plain-text valuepublic XML getXML() throws JWIGException
JWIGException
- if the response has no XML valuepublic boolean hasPayload()
public boolean isAugmented()
public boolean isText()
public boolean isXML()
public void refresh(Object value)
public void setAugmented(boolean augmented)
public void setContentType(String contenttype)
public void setHandler(String name, AbstractHandler sh)
public void setResult(Object result)
public void setStatus(int status)
HttpServletResponse
for possible status codes)public void setText(String str)
public void setXML(XML xml)
public void write(HttpServletRequest request, HttpServletResponse response)
Copyright © 2008-2012 Anders Møller & Mathias Schwarz.