rwsf::HttpServletRequestrwsf::ServletRequest
#include rwsf/servlet/http/HttpServletRequest.h
Extends rwsf::ServletRequest to provide request information for HTTP servlets. An HTTP servlet receives an rwsf::HttpServletRequest object for each request from a client. The request object contains the complete information in the request as well as any rwsf::HttpSession object associated with the request.
The following table lists methods that are either non-standard or not supported at this release.
getAuthType() |
currently a no-op at this release. |
||
getRemoteUser() |
currently a no-op at this release. |
getUserPrincipal() |
not included in this implementation. |
isUserInRole() |
currently a no-op at this release. |
||
parseDate() |
added method. |
virtual ~HttpServletRequest();
Destructor.
std::string getAuthType() const;
Returns the empty string. This method is currently unimplemented.
int getContentLength() const;
Reimplements method in rwsf::ServletRequest
Base class documentation:
Returns the content length of the request payload, or -1 if the Agent cannot determine the length.
Implementation documentation:
Returns the value of the Content-Length header of the request, or -1 if the request contains no such header.
std::string getContentType() const;
Reimplements method in rwsf::ServletRequest
Base class documentation:
Returns the Content-Type of the request. When the request has no content type, returns the empty string.
std::string getContextPath() const;
Returns the path for the context from the request URI. For example, in the URL /examples/HelloWorld, the context path is /examples.
bool getCookie(const std::string & name, rwsf::Cookie & cookie) const;
Locates the cookie named name in this request. If such a cookie exists, the function copies the located cookie to cookie and returns true. Otherwise, the function returns false and cookie is unchanged. Name comparisons are case-sensitive.
std::list< rwsf::Cookie > getCookies() const;
Returns a list of the cookies in this request. Returns an empty list if this request has no cookies.
rwsf::DateTime getDateHeader(const std::string & name) const;
Returns the value of the named HTTP header as an rwsf::DateTime. Returns a null date if the header does not exist. Returns an invalid date if the header value is not a valid HTTP/1.1 date string. Header name comparisons are case-insensitive.
std::string getHeader(const std::string & name) const;
Returns the value of the HTTP header in this request with a name matching name. If this request contains no such header, returns the empty string. Header name comparisons are case-insensitive.
rwsf::Enumeration< std::string > getHeaderNames() const;
Returns an enumeration of the names of the headers contained in the request. Use this method with caution. The contents of the enumeration and the order of the values may vary from request to request.
rwsf::Enumeration< std::string > getHeaders(const std::string & name) const;
Returns an enumeration for all values for the HTTP header named name. This is useful for HTTP headers that can have multiple values. For headers that contain a single value, this function returns an enumeration that contains that value. If the request contains no matching HTTP header, this function returns an empty enumeration. Header name comparisons are case-insensitive.
int getIntHeader(const std::string & name) const;
Returns the value of the HTTP header named name as an int. If the header cannot be found, returns 1. If the value cannot be converted to an int, returns 0.
std::string getMethod() const;
Returns the HTTP method which was used to invoke this request. The value will be a nonstandard HTTP method or one of the following: POST, GET, PUT, DELETE, OPTIONS, or HEAD.
std::string getPathInfo() const;
This method returns any extra path information from the request. If there is no extra path information, returns the empty string.
For example, if the servlet is located at /examples/hello, then this function returns /extra/path for the request URI /examples/Hello/extra/path?val=10. For the request URI /examples/Hello, this function returns the empty string.
std::string getPathTranslated() const;
Returns the full path on the underlying operating system that corresponds to the path in the HTTP request. This method returns the empty string if the path info is empty.
std::string getQueryString() const;
Returns the query string portion of the request URI. This method returns the empty string if there is no query string. The query string for a URI such as /rwsf/Hello?val=10 would be val=10.
std::string getRemoteUser() const;
Returns the login name of the user who made this request. If the user is not known, returns the empty string. This method is currently unimplemented. All calls to this function return the empty string.
std::string getRequestedSessionId() const;
Returns the session ID for the current session. If there is no current session, returns the empty string.
std::string getRequestURI() const;
Returns the entire request URI.
std::string getRequestURL() const;
Returns the entire URL that was used to make the request. The returned string includes the protocol, server, port, and URI.
std::string getServletPath() const;
Returns the path for this servlet from the request URI. The servlet path is the portion of the path between the servlet context and the extra path info or query string. For example, the URI /rwsf/HelloWorld?val=10 has a servlet path of /HelloWorld.
rwsf::HttpSession getSession(bool create, rwsf::HttpSession::Lifetime l = rwsf::HttpSession::Transient) const;
Returns the current session. If there is no current session or if the current session is invalid, returns a new session if create is true, returns an invalid session if create is false.
rwsf::HttpSession getSession(rwsf::HttpSession::Lifetime l = rwsf::HttpSession::Transient) const;
Returns the current session. If there is no current session or if the current session is invalid, returns a new session.
bool isRequestedSessionIdFromCookie() const;
Returns true if the current session was created from a cookie. The Agent uses JSESSIONID as the cookie to store the session id.
bool isRequestedSessionIdFromURL() const;
Returns true if the current session was found in the URL. The Agent uses a query string parameter name of jsessionid to store the session id.
bool isRequestedSessionIdValid() const;
Returns true if the current session is valid, false otherwise.
bool isUserInRole(const std::string & role) const;
Returns false. This method is currently unimplemented.
rwsf::DateTime parseDate(const std::string & value) const;
This method can be used with the getHeader() method to convert an HTTP header representing a date object to an rwsf::DateTime object.
© Copyright Rogue Wave Software, Inc. All Rights Reserved. All Rights Reserved. Rogue Wave is a registered trademark of Rogue Wave Software, Inc. in the United States and other countries. HydraExpress is a trademark of Rogue Wave Software, Inc. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.