Package com.oorian.jakarta
Class JakartaHttpRequest
java.lang.Object
com.oorian.jakarta.JakartaHttpRequest
- All Implemented Interfaces:
OorianHttpRequest
Adapter that wraps a
HttpServletRequest to implement the
framework-agnostic OorianHttpRequest interface.
This class is used by the thin Jakarta library to bridge between the servlet container and the Oorian common library.
- Since:
- 2.1
- Version:
- 1.0
- Author:
- Oorian Framework
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionJakartaHttpRequest(jakarta.servlet.http.HttpServletRequest request) Creates a new adapter wrapping the given servlet request. -
Method Summary
Modifier and TypeMethodDescriptionChanges the session ID associated with this request.getAttribute(String name) Returns the value of the specified request attribute.Returns the character encoding of the request body.intReturns the length of the request body in bytes, or -1 if not known.Returns the content type of the request body.Returns the context path of the web application.Returns the cookies sent with this request.jakarta.servlet.http.HttpServletRequestReturns the underlying Jakarta servlet request.Returns the value of the specified request header.Returns an enumeration of all header names in this request.getHeaders(String name) Returns all values of the specified request header as an enumeration.Returns an input stream for reading the request body as binary data.Returns the preferred locale of the client, based on the Accept-Language header.Returns the HTTP method of this request (GET, POST, PUT, DELETE, etc.).getParameter(String name) Returns the value of a request parameter.Returns a map of all request parameters.getParts()Returns the multipart parts of this request.Returns the path info portion of the request URL.Returns the query string portion of the request URL.Returns aBufferedReaderfor reading the request body as character data.Returns the IP address of the client that sent the request.Returns the request URI.Returns the request URL as a StringBuffer.Returns the scheme (protocol) used for the request (e.g., "http" or "https").Returns the name of the server that received the request.intReturns the port number on which the request was received.Returns the servlet path portion of the request URL.getSession(boolean create) Returns the session associated with this request.booleanisSecure()Returns whether this request was made using a secure channel (HTTPS).voidsetAttribute(String name, Object value) Sets a request attribute.
-
Constructor Details
-
JakartaHttpRequest
public JakartaHttpRequest(jakarta.servlet.http.HttpServletRequest request) Creates a new adapter wrapping the given servlet request.- Parameters:
request- The Jakarta servlet request to wrap.
-
-
Method Details
-
getHeader
Description copied from interface:OorianHttpRequestReturns the value of the specified request header.- Specified by:
getHeaderin interfaceOorianHttpRequest- Parameters:
name- the header name- Returns:
- the header value, or null if not present
-
getPathInfo
Description copied from interface:OorianHttpRequestReturns the path info portion of the request URL.- Specified by:
getPathInfoin interfaceOorianHttpRequest- Returns:
- the path info, or null if none
-
getQueryString
Description copied from interface:OorianHttpRequestReturns the query string portion of the request URL.- Specified by:
getQueryStringin interfaceOorianHttpRequest- Returns:
- the query string, or null if none
-
getRequestURL
Description copied from interface:OorianHttpRequestReturns the request URL as a StringBuffer.- Specified by:
getRequestURLin interfaceOorianHttpRequest- Returns:
- the request URL
-
getRequestURI
Description copied from interface:OorianHttpRequestReturns the request URI.- Specified by:
getRequestURIin interfaceOorianHttpRequest- Returns:
- the request URI
-
getServletPath
Description copied from interface:OorianHttpRequestReturns the servlet path portion of the request URL.- Specified by:
getServletPathin interfaceOorianHttpRequest- Returns:
- the servlet path
-
getParameter
Description copied from interface:OorianHttpRequestReturns the value of a request parameter.- Specified by:
getParameterin interfaceOorianHttpRequest- Parameters:
name- the parameter name- Returns:
- the parameter value, or null if not present
-
getParameterMap
Description copied from interface:OorianHttpRequestReturns a map of all request parameters.- Specified by:
getParameterMapin interfaceOorianHttpRequest- Returns:
- the parameter map
-
getContentType
Description copied from interface:OorianHttpRequestReturns the content type of the request body.- Specified by:
getContentTypein interfaceOorianHttpRequest- Returns:
- the content type, or null if not specified
-
getCharacterEncoding
Description copied from interface:OorianHttpRequestReturns the character encoding of the request body.- Specified by:
getCharacterEncodingin interfaceOorianHttpRequest- Returns:
- the character encoding, or null if not specified
-
getRemoteAddr
Description copied from interface:OorianHttpRequestReturns the IP address of the client that sent the request.- Specified by:
getRemoteAddrin interfaceOorianHttpRequest- Returns:
- the remote address
-
getContextPath
Description copied from interface:OorianHttpRequestReturns the context path of the web application.- Specified by:
getContextPathin interfaceOorianHttpRequest- Returns:
- the context path
-
getCookies
Description copied from interface:OorianHttpRequestReturns the cookies sent with this request.- Specified by:
getCookiesin interfaceOorianHttpRequest- Returns:
- an array of cookies, or null if no cookies were sent
-
getParts
Description copied from interface:OorianHttpRequestReturns the multipart parts of this request.- Specified by:
getPartsin interfaceOorianHttpRequest- Returns:
- a collection of upload parts
- Throws:
IOException- if an I/O error occurs
-
getSession
Description copied from interface:OorianHttpRequestReturns the session associated with this request.- Specified by:
getSessionin interfaceOorianHttpRequest- Parameters:
create- whether to create a new session if one doesn't exist- Returns:
- the web session, or null if create is false and no session exists
-
getServerName
Description copied from interface:OorianHttpRequestReturns the name of the server that received the request.- Specified by:
getServerNamein interfaceOorianHttpRequest- Returns:
- the server name
-
getMethod
Description copied from interface:OorianHttpRequestReturns the HTTP method of this request (GET, POST, PUT, DELETE, etc.).- Specified by:
getMethodin interfaceOorianHttpRequest- Returns:
- the HTTP method name
-
getReader
Description copied from interface:OorianHttpRequestReturns aBufferedReaderfor reading the request body as character data.- Specified by:
getReaderin interfaceOorianHttpRequest- Returns:
- a BufferedReader for reading the request body
- Throws:
IOException- if an I/O error occurs
-
getInputStream
Description copied from interface:OorianHttpRequestReturns an input stream for reading the request body as binary data.- Specified by:
getInputStreamin interfaceOorianHttpRequest- Returns:
- the input stream
- Throws:
IOException- if an I/O error occurs
-
getScheme
Description copied from interface:OorianHttpRequestReturns the scheme (protocol) used for the request (e.g., "http" or "https").- Specified by:
getSchemein interfaceOorianHttpRequest- Returns:
- the scheme
-
getServerPort
public int getServerPort()Description copied from interface:OorianHttpRequestReturns the port number on which the request was received.- Specified by:
getServerPortin interfaceOorianHttpRequest- Returns:
- the server port
-
isSecure
public boolean isSecure()Description copied from interface:OorianHttpRequestReturns whether this request was made using a secure channel (HTTPS).- Specified by:
isSecurein interfaceOorianHttpRequest- Returns:
- true if the request is secure
-
getHeaderNames
Description copied from interface:OorianHttpRequestReturns an enumeration of all header names in this request.- Specified by:
getHeaderNamesin interfaceOorianHttpRequest- Returns:
- an enumeration of header names
-
getHeaders
Description copied from interface:OorianHttpRequestReturns all values of the specified request header as an enumeration.- Specified by:
getHeadersin interfaceOorianHttpRequest- Parameters:
name- the header name- Returns:
- an enumeration of header values
-
getContentLength
public int getContentLength()Description copied from interface:OorianHttpRequestReturns the length of the request body in bytes, or -1 if not known.- Specified by:
getContentLengthin interfaceOorianHttpRequest- Returns:
- the content length, or -1
-
getAttribute
Description copied from interface:OorianHttpRequestReturns the value of the specified request attribute.- Specified by:
getAttributein interfaceOorianHttpRequest- Parameters:
name- the attribute name- Returns:
- the attribute value, or null if not set
-
setAttribute
Description copied from interface:OorianHttpRequestSets a request attribute.- Specified by:
setAttributein interfaceOorianHttpRequest- Parameters:
name- the attribute namevalue- the attribute value
-
getLocale
Description copied from interface:OorianHttpRequestReturns the preferred locale of the client, based on the Accept-Language header.- Specified by:
getLocalein interfaceOorianHttpRequest- Returns:
- the preferred locale
-
changeSessionId
Description copied from interface:OorianHttpRequestChanges the session ID associated with this request.This method generates a new session ID for the current session while preserving all session attributes. It is used for session fixation protection after authentication.
- Specified by:
changeSessionIdin interfaceOorianHttpRequest- Returns:
- the new session ID
-
getDelegate
public jakarta.servlet.http.HttpServletRequest getDelegate()Returns the underlying Jakarta servlet request.- Returns:
- The wrapped
HttpServletRequest.
-