Class Bridge
java.lang.Object
org.attribyte.api.http.impl.jakarta.Bridge
Utilities to bridge Jakarta Servlet API to Attribyte API.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic final RequestfromServletRequest(jakarta.servlet.http.HttpServletRequest request, int maxBodyBytes) Creates a request from a Jakarta servlet HTTP request.static StringgetRequestURI(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.static StringBuildergetRequestURL(Request request) Per the servlet API definition: returns the original request, excluding the query string.static final voidsendServletResponse(Response response, jakarta.servlet.http.HttpServletResponse servletResponse) Sends an Attribyte response using a Jakarta servlet response.
-
Constructor Details
-
Bridge
public Bridge()
-
-
Method Details
-
getRequestURL
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
StringBuildercontaining the original URL, excluding the query string.
-
getRequestURI
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,
remoteAddrwith 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.
-