Class AbstractWebRequest
java.lang.Object
services.moleculer.web.servlet.request.AbstractWebRequest
- All Implemented Interfaces:
HttpConstants, WebRequest
- Direct Known Subclasses:
BlockingWebRequest, NonBlockingWebRequest
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Stringprotected final intprotected final Stringprotected final LinkedHashMap<String, String> protected final Stringprotected final booleanprotected final Stringprotected final Stringprotected final Stringprotected final jakarta.servlet.http.HttpServletRequestprotected services.moleculer.stream.PacketStreamFields inherited from interface HttpConstants
ACCEPT, ACCEPT_ENCODING, AUTHORIZATION, CACHE_CONTROL, CHUNKED, CLOSE, CONNECT, CONNECTION, CONTENT_ENCODING, CONTENT_LENGTH, CONTENT_TYPE, CONTENT_TYPE_HTML, CONTENT_TYPE_JSON, COOKIE, DEFLATE, DELETE, ETAG, GET, GZIP, HEAD, IF_NONE_MATCH, KEEP_ALIVE, LOCATION, META_CONTENT_TYPE, META_HEADERS, META_LOCALE, META_LOCATION, META_SESSION, META_STATUS, META_TEMPLATE, NO_CACHE, OPTIONS, PATCH, POST, PROPERTY_COOKIES, PROPERTY_SESSION_ID, PROPERTY_USER, PUT, SET_COOKIE, TRACE, TRANSFER_ENCODING, WWW_AUTHENTICATE, X_FORWARDED_FOR -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractWebRequest(jakarta.servlet.http.HttpServletRequest req) -
Method Summary
Modifier and TypeMethodDescriptionReturns the Internet Protocol (IP) address of the client or last proxy that sent the request.services.moleculer.stream.PacketStreamgetBody()Returns the request body as PacketStream.intReturns the length, in bytes, of the request body and made available by the input stream, or -1 if the length is not known ir is greater than Integer.MAX_VALUE.Returns the MIME type of the body of the request, or null if the type is not known.Returns the value of the specified request header as a String.Returns an iterator of all the header names this request contains.Returns the internal object of this WebRequest.Returns the name of the HTTP method with which this request was made, for example, GET, POST, or PUT.getPath()Returns any extra path information associated with the URL the client sent when it made this request.Returns the name and version of the protocol the request uses in the form protocol/majorVersion.minorVersion, for example, HTTP/1.1.getQuery()Returns the query string that is contained in the request URL after the path.booleanChecks if the Content-Type header defines a multipart request.
-
Field Details
-
req
protected final jakarta.servlet.http.HttpServletRequest req -
protocol
-
path
-
query
-
method
-
contentLength
protected final int contentLength -
contentType
-
multipart
protected final boolean multipart -
address
-
headers
-
stream
protected services.moleculer.stream.PacketStream stream
-
-
Constructor Details
-
AbstractWebRequest
- Throws:
IOException
-
-
Method Details
-
getAddress
Returns the Internet Protocol (IP) address of the client or last proxy that sent the request. For HTTP servlets, same as the value of the CGI variable REMOTE_ADDR.- Specified by:
getAddressin interfaceWebRequest- Returns:
- a String containing the IP address of the client that sent the request
-
getMethod
Returns the name of the HTTP method with which this request was made, for example, GET, POST, or PUT. Same as the value of the CGI variable REQUEST_METHOD.- Specified by:
getMethodin interfaceWebRequest- Returns:
- a String specifying the name of the method with which this request was made
-
getPath
Returns any extra path information associated with the URL the client sent when it made this request. The extra path information follows the servlet path but precedes the query string and will start with a "/" character.- Specified by:
getPathin interfaceWebRequest- Returns:
- a String, decoded by the web container, specifying extra path information that comes after the servlet path but before the query string in the request URL
-
getQuery
Returns the query string that is contained in the request URL after the path. This method returns null if the URL does not have a query string. Same as the value of the CGI variable QUERY_STRING.- Specified by:
getQueryin interfaceWebRequest- Returns:
- a String containing the query string or null if the URL contains no query string. The value is not decoded by the container
-
getContentLength
public int getContentLength()Returns the length, in bytes, of the request body and made available by the input stream, or -1 if the length is not known ir is greater than Integer.MAX_VALUE. For HTTP servlets, same as the value of the CGI variable CONTENT_LENGTH.- Specified by:
getContentLengthin interfaceWebRequest- Returns:
- an integer containing the length of the request body or -1 if the length is not known or is greater than Integer.MAX_VALUE
-
getContentType
Returns the MIME type of the body of the request, or null if the type is not known. For HTTP servlets, same as the value of the CGI variable CONTENT_TYPE.- Specified by:
getContentTypein interfaceWebRequest- Returns:
- a String containing the name of the MIME type of the request, or null if the type is not known
-
getBody
public services.moleculer.stream.PacketStream getBody()Returns the request body as PacketStream.- Specified by:
getBodyin interfaceWebRequest- Returns:
- Request body (or null)
-
getHeader
Returns the value of the specified request header as a String. If the request did not include a header of the specified name, this method returns null. If there are multiple headers with the same name, this method returns the first head in the request. The header name is case insensitive. You can use this method with any request header.- Specified by:
getHeaderin interfaceWebRequest- Parameters:
name- name a String specifying the header name- Returns:
- a String containing the value of the requested header, or null if the request does not have a header of that name
-
getHeaders
Returns an iterator of all the header names this request contains. If the request has no headers, this method returns an empty iterator.- Specified by:
getHeadersin interfaceWebRequest- Returns:
- an iterator of all the header names sent with this request; if the request has no headers, an empty iterator
-
getProtocol
Returns the name and version of the protocol the request uses in the form protocol/majorVersion.minorVersion, for example, HTTP/1.1. For HTTP servlets, the value returned is the same as the value of the CGI variableSERVER_PROTOCOL.- Specified by:
getProtocolin interfaceWebRequest- Returns:
- a
Stringcontaining the protocol name and version number
-
isMultipart
public boolean isMultipart()Checks if the Content-Type header defines a multipart request.- Specified by:
isMultipartin interfaceWebRequest- Returns:
- true if the request is a multipart request, false otherwise
-
getInternalObject
Returns the internal object of this WebRequest.- Specified by:
getInternalObjectin interfaceWebRequest- Returns:
- internal object (HttpServletRequest)
-