Class Bridge

java.lang.Object
org.attribyte.api.http.impl.jakarta.Bridge

public class Bridge extends Object
Utilities to bridge Jakarta Servlet API to Attribyte API.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static final Request
    fromServletRequest(jakarta.servlet.http.HttpServletRequest request, int maxBodyBytes)
    Creates a request from a Jakarta servlet HTTP request.
    static String
    Per the servlet API definition: Returns the part of the request URL from the protocol name up to the query string in the first line of the HTTP request.
    Per the servlet API definition: returns the original request, excluding the query string.
    static final void
    sendServletResponse(Response response, jakarta.servlet.http.HttpServletResponse servletResponse)
    Sends an Attribyte response using a Jakarta servlet response.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Bridge

      public Bridge()
  • Method Details

    • getRequestURL

      public static StringBuilder getRequestURL(Request request)
      Per the servlet API definition: returns the original request, excluding the query string.

      Reconstructs the URL the client used to make the request. The returned URL contains a protocol, server name, port number, and server path, but it does not include query string parameters.

      Parameters:
      request - The request.
      Returns:
      A StringBuilder containing the original URL, excluding the query string.
    • getRequestURI

      public static String getRequestURI(Request request)
      Per the servlet API definition: Returns the part of the request URL from the protocol name up to the query string in the first line of the HTTP request.

      Returns the part of the request URL from the protocol name up to the query string in the first line of the HTTP request. The web container does not decode this String.

      Parameters:
      request - The request.
      Returns:
      The URI.
    • fromServletRequest

      public static final Request fromServletRequest(jakarta.servlet.http.HttpServletRequest request, int maxBodyBytes) throws IOException
      Creates a request from a Jakarta servlet HTTP request.

      Sets an attribute, remoteAddr with the address reported by the servlet API.

      Parameters:
      request - The servlet request.
      maxBodyBytes - The maximum number of bytes read. If < 1, the body is not read.
      Returns:
      The request.
      Throws:
      IOException - on invalid request.
    • sendServletResponse

      public static final void sendServletResponse(Response response, jakarta.servlet.http.HttpServletResponse servletResponse) throws IOException
      Sends an Attribyte response using a Jakarta servlet response.
      Parameters:
      response - The Attribyte response.
      servletResponse - The servlet response.
      Throws:
      IOException - on transmit error.