public abstract class AbstractResponse<T extends AbstractResponse<T>> extends StreamView
| Modifier and Type | Field and Description |
|---|---|
protected byte[] |
content |
protected String |
contentType |
protected int |
status |
| Constructor and Description |
|---|
AbstractResponse(int status) |
| Modifier and Type | Method and Description |
|---|---|
String |
getContentType()
Gets the content type of the response to be streamed back to the
requestor.
|
String |
getHeaderValue(String headerName)
Returns the associated header value, or null
if the header has not been set.
|
byte[] |
getPayload()
Gets the content of the response to be streamed back to the requestor.
|
int |
getStatus() |
void |
render(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
This method is invoked last in the sequence of steps involved in
processing a request sent to the FrontController.
|
protected abstract T |
self() |
T |
withContent(byte[] content) |
T |
withContent(String content) |
T |
withContentLocation(String contentLocation) |
T |
withContentType(String contentType) |
T |
withEncoding(String encoding) |
T |
withExpires(Date date) |
T |
withHeader(String name,
String value) |
T |
withLanguage(String language) |
T |
withLastModified(Date date) |
T |
withLocation(String location) |
T |
withTag(String tag) |
protected final int status
protected String contentType
protected byte[] content
protected abstract T self()
public T withContent(byte[] content)
public String getHeaderValue(String headerName)
headerName - the name of the headerpublic int getStatus()
public String getContentType()
StreamViewgetContentType in class StreamViewpublic byte[] getPayload()
StreamViewgetPayload in class StreamViewpublic void render(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
throws javax.servlet.ServletException,
IOException
ViewThis method is invoked last in the sequence of steps involved in processing a request sent to the FrontController. The servlet request can be used to set any attributes, then to obtain a RequestDispatcher for forwarding or including, or the servlet response may be used to send a redirect, for example.
Users should note that any exceptions thrown from this method are not guaranteed to be caught in the FrontController. They may escape to the requestor. Users should handle any exceptions inside the implementation of this method if different behaviour is desired.
render in interface Viewrender in class StreamViewrequest - the servlet requestresponse - the servlet responsejavax.servlet.ServletExceptionIOExceptionCopyright © 2011-2012 MojaveMVC.org