Package com.oorian
Interface OorianHttpResponse
- All Known Implementing Classes:
JakartaHttpResponse,TestHttpResponse
public interface OorianHttpResponse
Abstraction layer for HTTP response access, decoupling framework code from servlet API specifics.
This interface wraps the subset of HTTP response methods used by the Oorian framework, allowing the core library to operate without direct servlet API dependencies.
- Since:
- 2.1
- Version:
- 1.0
- Author:
- Marvin P. Warble Jr.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final int -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCookie(OorianCookie cookie) Adds a cookie to the response.voidAdds a response header without replacing existing values.booleancontainsHeader(String name) Returns whether the response contains the specified header.voidForces any content in the buffer to be written to the client.Returns the output stream for writing binary response data.intReturns the current HTTP status code of this response.Returns a PrintWriter for writing character response data.booleanReturns whether the response has been committed.voidSends an error response with the specified status code and message.voidsendRedirect(String url) Sends a temporary redirect response to the specified URL.voidsetCharacterEncoding(String charset) Sets the character encoding of the response.voidsetContentLength(int len) Sets the content length of the response body.voidsetContentType(String type) Sets the content type of the response.voidSets a response header, replacing any existing values.voidsetStatus(int sc) Sets the HTTP status code of the response.
-
Field Details
-
SC_OK
static final int SC_OK- See Also:
-
SC_CREATED
static final int SC_CREATED- See Also:
-
SC_ACCEPTED
static final int SC_ACCEPTED- See Also:
-
SC_NO_CONTENT
static final int SC_NO_CONTENT- See Also:
-
SC_MOVED_PERMANENTLY
static final int SC_MOVED_PERMANENTLY- See Also:
-
SC_FOUND
static final int SC_FOUND- See Also:
-
SC_NOT_MODIFIED
static final int SC_NOT_MODIFIED- See Also:
-
SC_TEMPORARY_REDIRECT
static final int SC_TEMPORARY_REDIRECT- See Also:
-
SC_BAD_REQUEST
static final int SC_BAD_REQUEST- See Also:
-
SC_UNAUTHORIZED
static final int SC_UNAUTHORIZED- See Also:
-
SC_FORBIDDEN
static final int SC_FORBIDDEN- See Also:
-
SC_NOT_FOUND
static final int SC_NOT_FOUND- See Also:
-
SC_METHOD_NOT_ALLOWED
static final int SC_METHOD_NOT_ALLOWED- See Also:
-
SC_CONFLICT
static final int SC_CONFLICT- See Also:
-
SC_GONE
static final int SC_GONE- See Also:
-
SC_UNSUPPORTED_MEDIA_TYPE
static final int SC_UNSUPPORTED_MEDIA_TYPE- See Also:
-
SC_TOO_MANY_REQUESTS
static final int SC_TOO_MANY_REQUESTS- See Also:
-
SC_INTERNAL_SERVER_ERROR
static final int SC_INTERNAL_SERVER_ERROR- See Also:
-
SC_NOT_IMPLEMENTED
static final int SC_NOT_IMPLEMENTED- See Also:
-
SC_BAD_GATEWAY
static final int SC_BAD_GATEWAY- See Also:
-
SC_SERVICE_UNAVAILABLE
static final int SC_SERVICE_UNAVAILABLE- See Also:
-
-
Method Details
-
setContentType
Sets the content type of the response.- Parameters:
type- the MIME content type
-
setCharacterEncoding
Sets the character encoding of the response.- Parameters:
charset- the character encoding name
-
setContentLength
void setContentLength(int len) Sets the content length of the response body.- Parameters:
len- the content length in bytes
-
getOutputStream
Returns the output stream for writing binary response data.- Returns:
- the output stream
- Throws:
IOException- if an I/O error occurs
-
getWriter
Returns a PrintWriter for writing character response data.- Returns:
- the print writer
- Throws:
IOException- if an I/O error occurs
-
setHeader
Sets a response header, replacing any existing values.- Parameters:
name- the header namevalue- the header value
-
addHeader
Adds a response header without replacing existing values.- Parameters:
name- the header namevalue- the header value
-
isCommitted
boolean isCommitted()Returns whether the response has been committed.- Returns:
- true if the response has been committed
-
sendError
Sends an error response with the specified status code and message.- Parameters:
sc- the HTTP status codemsg- the error message- Throws:
IOException- if an I/O error occurs
-
setStatus
void setStatus(int sc) Sets the HTTP status code of the response.- Parameters:
sc- the status code
-
sendRedirect
Sends a temporary redirect response to the specified URL.- Parameters:
url- the redirect URL- Throws:
IOException- if an I/O error occurs
-
addCookie
Adds a cookie to the response.- Parameters:
cookie- the cookie to add
-
getStatus
int getStatus()Returns the current HTTP status code of this response.- Returns:
- the status code
-
containsHeader
Returns whether the response contains the specified header.- Parameters:
name- the header name- Returns:
- true if the header has been set
-
flushBuffer
Forces any content in the buffer to be written to the client.- Throws:
IOException- if an I/O error occurs
-