Interface HTTPEngineResponderMixin

All Known Implementing Classes:
AbstractHTTPEngine

public interface HTTPEngineResponderMixin
A mixin containing utility methods for the HTTPEngine respond methods.
Since:
3.6.1
  • Method Summary

    Modifier and Type
    Method
    Description
    org.omegazero.net.socket.SocketConnection
     
    Returns the HTTP version name string used for the HTTPMessage version field.
    void
    respond(org.omegazero.http.common.HTTPRequest request, org.omegazero.http.common.HTTPResponseData httpResponseData)
     
    default void
    respondError(Proxy proxy, org.omegazero.http.common.HTTPRequest request, int status, String title, String message, String... headers)
    Prepares an error response with the given parameters.
    default void
    respondEx(Proxy proxy, org.omegazero.http.common.HTTPRequest request, int status, byte[] data, String[] h1, String... h2)
    Responds to the given request with the given parameters.
    default void
    respondUNetError(Proxy proxy, org.omegazero.http.common.HTTPRequest request, int status, String message, org.omegazero.net.socket.SocketConnection uconn, UpstreamServer userver)
    Emits a HTTP_FORWARD_FAILED event on the Proxy event bus with the given parameters, and, if no response was sent, responds with an appropriate error message.
  • Method Details

    • getDownstreamConnection

      org.omegazero.net.socket.SocketConnection getDownstreamConnection()
    • respond

      void respond(org.omegazero.http.common.HTTPRequest request, org.omegazero.http.common.HTTPResponseData httpResponseData)
    • getHTTPVersionName

      String getHTTPVersionName()
      Returns the HTTP version name string used for the HTTPMessage version field.
      Returns:
      The HTTP version name
    • respondError

      default void respondError(Proxy proxy, org.omegazero.http.common.HTTPRequest request, int status, String title, String message, String... headers)
      Prepares an error response with the given parameters.

      The respondError method can directly delegate to this method.

      Parameters:
      proxy - The Proxy instance
      request - The request to respond to
      status - The status code of the response
      title - Title of the error message
      message - Error message
      headers - Headers to send in the response
    • respondUNetError

      default void respondUNetError(Proxy proxy, org.omegazero.http.common.HTTPRequest request, int status, String message, org.omegazero.net.socket.SocketConnection uconn, UpstreamServer userver)
      Emits a HTTP_FORWARD_FAILED event on the Proxy event bus with the given parameters, and, if no response was sent, responds with an appropriate error message.

      This method is used when the HTTP request could not be completed due to a problem with the upstream server.

      Parameters:
      proxy - The Proxy instance
      request - The request
      status - The response status
      message - The response error message
      uconn - The upstream connection
      userver - The upstream server
    • respondEx

      default void respondEx(Proxy proxy, org.omegazero.http.common.HTTPRequest request, int status, byte[] data, String[] h1, String... h2)
      Responds to the given request with the given parameters.

      The respond method can directly delegate to this method.

      Parameters:
      proxy - The Proxy instance
      request - The request to respond to
      status - The status code of the response
      data - The data to send in the response
      h1 - The response headers
      h2 - A second set of response headers