Package com.blackrook.small
Interface SmallResponse
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
SmallResponse.GenericSmallResponse
Generic response object for Small.
- Since:
- 1.1.0, 1.2.1, implements AutoCloseable, 1.4.0, is an interface. See
SmallResponse.GenericSmallResponsefor implementation. - Author:
- Matthew Tropiano
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classCreates a generic response object for Small Responses. -
Method Summary
Modifier and TypeMethodDescriptiondefault voidclose()create(int status) Creates a new response with a default status.Creates a new response with status and content.Creates a new response with 200 OK status and a model-view driven content.create(SmallResponse smallResponse) Creates a new response from another SmallResponse, copying the status, content, and the headers.Creates a new response with 200 OK status and content.Creates a new response with 200 OK status and a model-view driven content.int
-
Method Details
-
getStatus
int getStatus()- Returns:
- the response HTTP status code.
-
getHeaders
- Returns:
- the header map for adding headers to the response.
-
getContent
Object getContent()- Returns:
- the response content.
-
close
- Specified by:
closein interfaceAutoCloseable- Throws:
Exception
-
create
Creates a new response with a default status.- Parameters:
status- the HTTP status to send.- Returns:
- a new response.
-
create
Creates a new response with status and content.- Parameters:
status- the HTTP status to send.content- the content object.- Returns:
- a new response.
-
create
Creates a new response with 200 OK status and content.- Parameters:
content- the content object.- Returns:
- a new response.
-
create
Creates a new response with 200 OK status and a model-view driven content.- Parameters:
model- the model to render.viewName- the name of the view to resolve and use.- Returns:
- a new response.
-
create
Creates a new response with 200 OK status and a model-view driven content.- Parameters:
status- the HTTP status to send.model- the model to render.viewName- the name of the view to resolve and use.- Returns:
- a new response.
-
create
Creates a new response from another SmallResponse, copying the status, content, and the headers.- Parameters:
smallResponse- the source SmallResponse.- Returns:
- a new response.
-