Package com.blackrook.small
Class SmallResponse.GenericSmallResponse
java.lang.Object
com.blackrook.small.SmallResponse.GenericSmallResponse
- All Implemented Interfaces:
SmallResponse
,AutoCloseable
- Enclosing interface:
- SmallResponse
Creates a generic response object for Small Responses.
- Since:
- 1.4.0
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.blackrook.small.SmallResponse
SmallResponse.GenericSmallResponse
-
Method Summary
Modifier and TypeMethodDescriptionaddDateHeader
(String headerName, long value) Adds a header date value.addDateHeader
(String headerName, Date value) Adds a header date value.Adds a header value.Sets that this response is an attachment.attachment
(String fileName) Sets that this response is an attachment with a filename.void
close()
Sets the content of the response.dateHeader
(String headerName, long value) Sets a header date value.dateHeader
(String headerName, Date value) Sets a header date value.int
Sets a header value.status
(int status) Sets the status on this response.Sets the MIME-Type (content type) header for the response.Sets the MIME-Type (content type) header for the response.
-
Method Details
-
status
Sets the status on this response.- Parameters:
status
- the status code.- Returns:
- itself, for call chaining.
-
header
Sets a header value. If this header was added more than once, it is cleared before the add.- Parameters:
headerName
- the header name.value
- the corresponding value.- Returns:
- itself, for call chaining.
-
dateHeader
Sets a header date value. If this header was added more than once, it is cleared before the add.- Parameters:
headerName
- the header name.value
- the corresponding date value.- Returns:
- itself, for call chaining.
- Since:
- 1.2.0
-
dateHeader
Sets a header date value. If this header was added more than once, it is cleared before the add.- Parameters:
headerName
- the header name.value
- the corresponding value.- Returns:
- itself, for call chaining.
- Since:
- 1.2.0
-
addHeader
Adds a header value.- Parameters:
headerName
- the header name.value
- the corresponding value.- Returns:
- itself, for call chaining.
-
addDateHeader
Adds a header date value.- Parameters:
headerName
- the header name.value
- the corresponding date value.- Returns:
- itself, for call chaining.
- Since:
- 1.2.0
-
addDateHeader
Adds a header date value.- Parameters:
headerName
- the header name.value
- the corresponding date value in milliseconds since the Epoch.- Returns:
- itself, for call chaining.
- Since:
- 1.2.0
-
content
Sets the content of the response.- Parameters:
content
- the content.- Returns:
- itself, for call chaining.
-
type
Sets the MIME-Type (content type) header for the response.- Parameters:
mimeType
- the MIME-Type.- Returns:
- itself, for call chaining.
-
type
Sets the MIME-Type (content type) header for the response.- Parameters:
mimeType
- the MIME-Type.charset
- the charset name.- Returns:
- itself, for call chaining.
-
attachment
Sets that this response is an attachment.- Returns:
- itself, for call chaining.
-
attachment
Sets that this response is an attachment with a filename.- Parameters:
fileName
- the file name.- Returns:
- itself, for call chaining.
-
getStatus
public int getStatus()- Specified by:
getStatus
in interfaceSmallResponse
- Returns:
- the status code.
-
getHeaders
- Specified by:
getHeaders
in interfaceSmallResponse
- Returns:
- the header map.
-
getContent
- Specified by:
getContent
in interfaceSmallResponse
- Returns:
- the response content.
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceSmallResponse
- Throws:
Exception
-