/** * Returns the name of the scheme used to make this request, for example, * <code>http</code>, <code>https</code>, or <code>ftp</code>. Different * schemes have different rules for constructing URLs, as noted in RFC 1738. * * @return a <code>String</code> containing the name of the scheme used to * make this request */ default String getScheme () { return getRequest ().getScheme (); }
/** * 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. * * @return a <code>String</code> specifying the name of the method with which * this request was made */ default String getMethod () { return getRequest ().getMethod (); }
/** * Returns the host name of the server to which the request was sent. It is * the value of the part before ":" in the <code>Host</code> header value, if * any, or the resolved server name, or the server IP address. * * @return a <code>String</code> containing the name of the server */ default String getServerName () { return getRequest ().getServerName (); }
/** * Returns the port number to which the request was sent. It is the value of * the part after ":" in the <code>Host</code> header value, if any, or the * server port where the client connection was accepted on. * * @return an integer specifying the port number */ default int getServerPort () { return getRequest ().getServerPort (); }
/** * Returns a boolean indicating whether this request was made using a secure * channel, such as HTTPS. * * @return a boolean indicating if the request was made using a secure channel */ default boolean isSecure () { return getRequest ().isSecure (); }
/** * 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 * <code>REMOTE_ADDR</code>. * * @return a <code>String</code> containing the IP address of the client that * sent the request */ default String getRemoteAddr () { return getRequest ().getRemoteAddr (); }
/** * Returns the Internet Protocol (IP) source port of the client or last proxy * that sent the request. * * @return an integer specifying the port number */ default int getRemotePort () { return getRequest ().getRemotePort (); }
/** * Returns the Internet Protocol (IP) port number of the interface on which * the request was received. * * @return an integer specifying the port number */ default int getLocalPort () { return getRequest ().getLocalPort (); }
/** * Returns the Internet Protocol (IP) address of the interface on which the * request was received. * * @return a <code>String</code> containing the IP address on which the * request was received. */ default String getLocalAddr () { return getRequest ().getLocalAddr (); }
/** * Returns the session ID specified by the client. This may not be the same as * the ID of the current valid session for this request. If the client did not * specify a session ID, this method returns <code>null</code>. * * @return a <code>String</code> specifying the session ID, or * <code>null</code> if the request did not specify a session ID * @see #isRequestedSessionIdValid */ @Nullable default String getRequestedSessionId () { return getRequest ().getRequestedSessionId (); }
/** * @return The {@link EHttpVersion} of the request. */ @Nullable default EHttpVersion getHttpVersion () { return RequestHelper.getHttpVersion (getRequest ()); }
/** * Checks whether the requested session ID came in as a cookie. * * @return <code>true</code> if the session ID came in as a cookie; otherwise, * <code>false</code> * @see #getSession */ default boolean isRequestedSessionIdFromCookie () { return getRequest ().isRequestedSessionIdFromCookie (); }
/** * Checks whether the requested session ID came in as part of the request URL. * * @return <code>true</code> if the session ID came in as part of a URL; * otherwise, <code>false</code> * @see #getSession */ default boolean isRequestedSessionIdFromURL () { return getRequest ().isRequestedSessionIdFromURL (); }
/** * Return the URI of the request within the servlet context. * * @return the path within the web application and never <code>null</code>. By * default "/" is returned is an empty request URI is determined. */ @Nonnull default String getPathWithinServletContext () { return RequestHelper.getPathWithinServletContext (getRequest ()); }
/** * Returns the query string that is contained in the request URL after the * path. This method returns <code>null</code> if the URL does not have a * query string. Same as the value of the CGI variable QUERY_STRING. * * @return a <code>String</code> containing the query string or * <code>null</code> if the URL contains no query string. The value is * not decoded by the container. */ default String getQueryString () { return ServletHelper.getRequestQueryString (getRequest ()); }
/** * Get the user agent object of this HTTP request. * * @return A non-<code>null</code> user agent object. */ @Nonnull default IUserAgent getUserAgent () { return RequestHelper.getUserAgent (getRequest ()); }
/** * Returns the host name of the Internet Protocol (IP) interface on which the * request was received. * * @return a <code>String</code> containing the host name of the IP on which * the request was received. */ default String getLocalName () { return getRequest ().getLocalName (); }
/** * @return The {@link EHttpMethod} matching the {@link #getMethod()} */ @Nullable default EHttpMethod getHttpMethod () { return RequestHelper.getHttpMethod (getRequest ()); }
/** * @return Return the absolute server path. E.g. "http://localhost:8080" */ @Nonnull default String getFullServerPath () { return RequestHelper.getFullServerName (getRequest ()).toString (); }
/** * @return The charset defined for this request. May be <code>null</code> if * none is present; */ @Nullable default Charset getCharset () { final String sEncoding = getRequest ().getCharacterEncoding (); return StringHelper.hasNoText (sEncoding) ? null : CharsetHelper.getCharsetFromName (sEncoding); }