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 Details

  • Method Details

    • setContentType

      void setContentType(String type)
      Sets the content type of the response.
      Parameters:
      type - the MIME content type
    • setCharacterEncoding

      void setCharacterEncoding(String charset)
      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

      OutputStream getOutputStream() throws IOException
      Returns the output stream for writing binary response data.
      Returns:
      the output stream
      Throws:
      IOException - if an I/O error occurs
    • getWriter

      PrintWriter getWriter() throws IOException
      Returns a PrintWriter for writing character response data.
      Returns:
      the print writer
      Throws:
      IOException - if an I/O error occurs
    • setHeader

      void setHeader(String name, String value)
      Sets a response header, replacing any existing values.
      Parameters:
      name - the header name
      value - the header value
    • addHeader

      void addHeader(String name, String value)
      Adds a response header without replacing existing values.
      Parameters:
      name - the header name
      value - the header value
    • isCommitted

      boolean isCommitted()
      Returns whether the response has been committed.
      Returns:
      true if the response has been committed
    • sendError

      void sendError(int sc, String msg) throws IOException
      Sends an error response with the specified status code and message.
      Parameters:
      sc - the HTTP status code
      msg - 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

      void sendRedirect(String url) throws IOException
      Sends a temporary redirect response to the specified URL.
      Parameters:
      url - the redirect URL
      Throws:
      IOException - if an I/O error occurs
    • addCookie

      void addCookie(OorianCookie cookie)
      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

      boolean containsHeader(String name)
      Returns whether the response contains the specified header.
      Parameters:
      name - the header name
      Returns:
      true if the header has been set
    • flushBuffer

      void flushBuffer() throws IOException
      Forces any content in the buffer to be written to the client.
      Throws:
      IOException - if an I/O error occurs