#include <HttpServletRequestImpl.h>
Classes | |
class | CookieSeparator |
Public Member Functions | |
HttpServletRequestImpl (Connection &con, serverconfig::AppContext *ctx, const std::string &servletPath, size_t maxRequestSize, size_t maxFileSize) | |
~HttpServletRequestImpl () | |
void | load () |
void | setRespRef (HttpServletResponseImpl *resp) |
virtual bool | isRequestedSessionIdValid () |
void | addUploadedFile (const std::string &name, UploadedFileImpl *file) |
void | addParam (const std::string &name, const std::string &value) |
std::string | getFileSaveTemplate () const |
virtual boost::shared_ptr< void > | getAttribute (const std::string &name) |
virtual bool | hasAttribute (const std::string &name) const |
virtual std::auto_ptr < std::vector< std::string > > | getAttributeNames () const |
virtual void | setAttribute (const std::string &name, boost::shared_ptr< void >) |
virtual void | removeAttribute (const std::string &name) |
virtual std::string | getCharacterEncoding () const |
virtual void | setCharacterEncoding (const std::string &env) |
virtual int | getContentLength () const |
virtual std::string | getContentType () const |
virtual std::istream & | getInputStream () |
virtual std::string | getParameter (const std::string &name) const |
virtual std::auto_ptr < std::vector< std::string > > | getParameterNames () const |
virtual std::auto_ptr < std::vector< std::string > > | getParameterValues (const std::string &name) const |
virtual std::auto_ptr < std::multimap< std::string, std::string > > | getParameterMap () const |
virtual std::string | getProtocol () const |
virtual std::string | getScheme () const |
virtual std::string | getServerName () const |
virtual int | getServerPort () const |
virtual std::string | getRemoteAddr () const |
virtual std::string | getRemoteHost () const |
virtual bool | isSecure () const |
virtual servlet::RequestDispatcher * | getRequestDispatcher (const std::string &path) |
virtual int | getRemotePort () const |
virtual std::string | getLocalName () const |
virtual std::string | getLocalAddr () const |
virtual int | getLocalPort () const |
virtual std::string | getAuthType () const |
virtual std::auto_ptr < cookielist_t > | getCookies () const |
virtual long | getDateHeader (const std::string &name) const |
virtual std::string | getHeader (const std::string &name) const |
virtual std::auto_ptr < std::vector< std::string > > | getHeaders (const std::string &name) const |
virtual std::auto_ptr < std::vector< std::string > > | getHeaderNames () const |
virtual int | getIntHeader (const std::string &name) const |
virtual std::string | getMethod () const |
virtual std::string | getPathInfo () const |
virtual std::string | getPathTranslated () const |
virtual std::string | getContextPath () const |
virtual std::string | getQueryString () const |
virtual std::string | getRemoteUser () const |
virtual bool | isUserInRole (const std::string &role) const |
virtual std::string | getRequestedSessionId () const |
virtual std::string | getRequestURI () const |
virtual std::string | getRequestURL () const |
virtual std::string | getServletPath () const |
virtual servlet::HttpSession * | getSession (bool create=true) |
virtual bool | isRequestedSessionIdValid () const |
virtual bool | isRequestedSessionIdFromCookie () const |
virtual bool | isRequestedSessionIdFromURL () const |
virtual servlet::UploadedFile * | getUploadedFile (const std::string &) |
Protected Attributes | |
Connection & | m_con |
serverconfig::AppContext * | m_ctx |
HttpServletResponseImpl * | m_resp |
std::istream | m_inputStream |
Private Types | |
typedef std::map< std::string, servlet::UploadedFile * > | filelist_t |
Private Member Functions | |
void | getHeaders () |
void | getParams () |
void | parseQueryString (std::istream &queryString) |
void | parseMultipartData (std::istream &data) |
void | parseCookieHeader (const std::string &data) |
void | parsePart (const std::string &data) |
Static Private Member Functions | |
static void | parseAddr (const std::string &addr, std::string &name, unsigned short &port) |
static void | addr2host (const std::string &addr, std::string &name) |
Private Attributes | |
filelist_t | m_files |
std::string | m_localAddr |
std::string | m_localName |
unsigned short | m_localPort |
std::string | m_remoteAddr |
std::string | m_remoteHost |
unsigned short | m_remotePort |
std::string | m_serverName |
unsigned short | m_serverPort |
std::string | m_scheme |
std::string | m_characterEncoding |
long | m_contentLength |
std::string | m_contentType |
util::attr_t | m_attributes |
util::mparam_t | m_parameters |
util::mparam_t | m_headers |
std::string | m_method |
std::string | m_uri |
std::string | m_queryString |
cookielist_t | m_cookies |
std::string | m_sessionId |
bool | m_isSecure |
std::string | m_pathInfo |
std::string | m_remoteUser |
std::string | m_servletPath |
std::string | m_protocol |
servlet::HttpSession * | m_session |
size_t | m_maxRequestSize |
size_t | m_maxFileSize |
bool | m_inputStreamTaken |
Definition at line 43 of file HttpServletRequestImpl.h.
typedef std::map<std::string,servlet::UploadedFile*> container::HttpServletRequestImpl::filelist_t [private] |
Definition at line 46 of file HttpServletRequestImpl.h.
container::HttpServletRequestImpl::HttpServletRequestImpl | ( | Connection & | con, | |
serverconfig::AppContext * | ctx, | |||
const std::string & | servletPath, | |||
size_t | maxRequestSize, | |||
size_t | maxFileSize | |||
) |
Definition at line 51 of file HttpServletRequestImpl.cpp.
container::HttpServletRequestImpl::~HttpServletRequestImpl | ( | ) |
void container::HttpServletRequestImpl::addParam | ( | const std::string & | name, | |
const std::string & | value | |||
) |
Definition at line 718 of file HttpServletRequestImpl.cpp.
References m_parameters.
Referenced by container::MimePartCharSink::partDone().
void container::HttpServletRequestImpl::addr2host | ( | const std::string & | addr, | |
std::string & | name | |||
) | [static, private] |
Definition at line 99 of file HttpServletRequestImpl.cpp.
Referenced by getLocalName(), and getRemoteHost().
void container::HttpServletRequestImpl::addUploadedFile | ( | const std::string & | name, | |
UploadedFileImpl * | file | |||
) |
Definition at line 710 of file HttpServletRequestImpl.cpp.
References m_files.
Referenced by container::MimePartCharSink::partDone().
boost::shared_ptr< void > container::HttpServletRequestImpl::getAttribute | ( | const std::string & | name | ) | [virtual] |
Returns the value of the named attribute as an Object
, or null
if no attribute of the given name exists.
Attributes can be set two ways. The servlet container may set attributes to make available custom information about a request. For example, for requests made using HTTPS, the attribute javax.servlet.request.X509Certificate
can be used to retrieve information on the certificate of the client. Attributes can also be set programatically using servlet::ServletRequest#setAttribute. This allows information to be embedded into a request before a servlet::RequestDispatcher call.
Attribute names should follow the same conventions as package names. This specification reserves names matching java.*
, javax.*
, and sun.*
.
name | a String specifying the name of the attribute |
Object
containing the value of the attribute, or null
if the attribute does not exist Implements servlet::ServletRequest.
Definition at line 723 of file HttpServletRequestImpl.cpp.
References m_attributes.
std::auto_ptr< std::vector< std::string > > container::HttpServletRequestImpl::getAttributeNames | ( | ) | const [virtual] |
Returns an Enumeration
containing the names of the attributes available to this request. This method returns an empty Enumeration
if the request has no attributes available to it.
Enumeration
of strings containing the names of the request's attributes Implements servlet::ServletRequest.
Definition at line 735 of file HttpServletRequestImpl.cpp.
References container::util::getMapKeyNames(), and m_attributes.
std::string container::HttpServletRequestImpl::getAuthType | ( | ) | const [virtual] |
Returns the name of the authentication scheme used to protect the servlet. All servlet containers support basic, form and client certificate authentication, and may additionally support digest authentication. If the servlet is not authenticated null
is returned.
Same as the value of the CGI variable AUTH_TYPE.
null
if the request was not authenticated. Implements servlet::HttpServletRequest.
Definition at line 846 of file HttpServletRequestImpl.cpp.
std::string container::HttpServletRequestImpl::getCharacterEncoding | ( | ) | const [virtual] |
Returns the name of the character encoding used in the body of this request. This method returns null
if the request does not specify a character encoding
String
containing the name of the character encoding, or null
if the request does not specify a character encoding Implements servlet::ServletRequest.
Definition at line 749 of file HttpServletRequestImpl.cpp.
References m_characterEncoding.
int container::HttpServletRequestImpl::getContentLength | ( | ) | const [virtual] |
Returns the length, in bytes, of the request body and made available by the input stream, or -1 if the length is not known. For HTTP servlets, same as the value of the CGI variable CONTENT_LENGTH.
Implements servlet::ServletRequest.
Definition at line 757 of file HttpServletRequestImpl.cpp.
References m_contentLength.
std::string container::HttpServletRequestImpl::getContentType | ( | ) | const [virtual] |
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.
String
containing the name of the MIME type of the request, or null if the type is not known Implements servlet::ServletRequest.
Definition at line 761 of file HttpServletRequestImpl.cpp.
References m_contentType.
Referenced by parseMultipartData().
std::string container::HttpServletRequestImpl::getContextPath | ( | ) | const [virtual] |
Returns the portion of the request URI that indicates the context of the request. The context path always comes first in a request URI. The path starts with a "/" character but does not end with a "/" character. For servlets in the default (root) context, this method returns "". The container does not decode this string.
String
specifying the portion of the request URI that indicates the context of the request Implements servlet::HttpServletRequest.
Definition at line 905 of file HttpServletRequestImpl.cpp.
References container::serverconfig::AppContext::getServletContextName(), and m_ctx.
std::auto_ptr< servlet::HttpServletRequest::cookielist_t > container::HttpServletRequestImpl::getCookies | ( | ) | const [virtual] |
Returns an array containing all of the Cookie
objects the client sent with this request. This method returns null
if no cookies were sent.
Cookies
included with this request, or null
if the request has no cookies Implements servlet::HttpServletRequest.
Definition at line 850 of file HttpServletRequestImpl.cpp.
References m_cookies.
long container::HttpServletRequestImpl::getDateHeader | ( | const std::string & | name | ) | const [virtual] |
Returns the value of the specified request header as a long
value that represents a Date
object. Use this method with headers that contain dates, such as If-Modified-Since
.
The date is returned as the number of milliseconds since January 1, 1970 GMT. The header name is case insensitive.
If the request did not have a header of the specified name, this method returns -1. If the header can't be converted to a date, the method throws an IllegalArgumentException
.
name | a String specifying the name of the header |
long
value representing the date specified in the header expressed as the number of milliseconds since January 1, 1970 GMT, or -1 if the named header was not included with the requestIllegalArgumentException | If the header value can't be converted to a date |
Implements servlet::HttpServletRequest.
Definition at line 854 of file HttpServletRequestImpl.cpp.
References getHeader().
std::string container::HttpServletRequestImpl::getFileSaveTemplate | ( | ) | const [inline] |
Definition at line 175 of file HttpServletRequestImpl.h.
References container::serverconfig::AppContext::getFileSaveTemplate(), and m_ctx.
Referenced by container::MimePartCharSink::processHeader().
std::string container::HttpServletRequestImpl::getHeader | ( | const std::string & | name | ) | const [virtual] |
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.
name | a String specifying the header name |
String
containing the value of the requested header, or null
if the request does not have a header of that name Implements servlet::HttpServletRequest.
Definition at line 866 of file HttpServletRequestImpl.cpp.
References m_headers.
Referenced by getDateHeader(), getIntHeader(), and getParams().
std::auto_ptr< std::vector< std::string > > container::HttpServletRequestImpl::getHeaderNames | ( | ) | const [virtual] |
Returns an enumeration of all the header names this request contains. If the request has no headers, this method returns an empty enumeration.
Some servlet containers do not allow servlets to access headers using this method, in which case this method returns null
null
Implements servlet::HttpServletRequest.
Definition at line 877 of file HttpServletRequestImpl.cpp.
References container::util::getMapKeyNames(), and m_headers.
std::auto_ptr< std::vector< std::string > > container::HttpServletRequestImpl::getHeaders | ( | const std::string & | name | ) | const [virtual] |
Returns all the values of the specified request header as an Enumeration
of String
objects.
Some headers, such as Accept-Language
can be sent by clients as several headers each with a different value rather than sending the header as a comma separated list.
If the request did not include any headers of the specified name, this method returns an empty Enumeration
. The header name is case insensitive. You can use this method with any request header.
name | a String specifying the header name |
Enumeration
containing the values of the requested header. If the request does not have any headers of that name return an empty enumeration. If the container does not allow access to header information, return null Implements servlet::HttpServletRequest.
Definition at line 873 of file HttpServletRequestImpl.cpp.
References container::util::getMapValues(), and m_headers.
void container::HttpServletRequestImpl::getHeaders | ( | ) | [private] |
Parses request line and headers of the request. Fills out method
, uri
, contentType
, contentLength
, serverName
, serverPort
, and calls ServletRequestImpl::parseCookieHeader if it encounters Cookie header
Definition at line 124 of file HttpServletRequestImpl.cpp.
References getServletPath(), m_contentLength, m_contentType, m_headers, m_inputStream, m_localAddr, m_localName, m_localPort, m_method, m_pathInfo, m_protocol, m_queryString, m_remoteAddr, m_remoteHost, m_remotePort, m_scheme, m_serverName, m_serverPort, m_uri, parseAddr(), and parseCookieHeader().
Referenced by load().
std::istream & container::HttpServletRequestImpl::getInputStream | ( | ) | [virtual] |
Retrieves the body of the request as binary data using a std::istream. Either this method or getReader may be called to read the body, not both.
IllegalStateException | if the getReader method has already been called for this request | |
IOException | if an input or output exception occurred |
Implements servlet::ServletRequest.
Definition at line 765 of file HttpServletRequestImpl.cpp.
References m_inputStream, and m_inputStreamTaken.
int container::HttpServletRequestImpl::getIntHeader | ( | const std::string & | name | ) | const [virtual] |
Returns the value of the specified request header as an int
. If the request does not have a header of the specified name, this method returns -1. If the header cannot be converted to an integer, this method throws a NumberFormatException
.
The header name is case insensitive.
name | a String specifying the name of a request header |
NumberFormatException | If the header value can't be converted to an int |
Implements servlet::HttpServletRequest.
Definition at line 881 of file HttpServletRequestImpl.cpp.
References getHeader().
std::string container::HttpServletRequestImpl::getLocalAddr | ( | ) | const [virtual] |
Returns the Internet Protocol (IP) address of the interface on which the request was received.
String
containing the IP address on which the request was received.Implements servlet::ServletRequest.
Definition at line 838 of file HttpServletRequestImpl.cpp.
References m_localAddr.
std::string container::HttpServletRequestImpl::getLocalName | ( | ) | const [virtual] |
Returns the host name of the Internet Protocol (IP) interface on which the request was received.
String
containing the host name of the IP on which the request was received.Implements servlet::ServletRequest.
Definition at line 832 of file HttpServletRequestImpl.cpp.
References addr2host(), m_localAddr, and m_localName.
int container::HttpServletRequestImpl::getLocalPort | ( | ) | const [virtual] |
Returns the Internet Protocol (IP) port number of the interface on which the request was received.
Implements servlet::ServletRequest.
Definition at line 842 of file HttpServletRequestImpl.cpp.
References m_localPort.
std::string container::HttpServletRequestImpl::getMethod | ( | ) | const [virtual] |
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.
String
specifying the name of the method with which this request was made Implements servlet::HttpServletRequest.
Definition at line 893 of file HttpServletRequestImpl.cpp.
References m_method.
std::string container::HttpServletRequestImpl::getParameter | ( | const std::string & | name | ) | const [virtual] |
Returns the value of a request parameter as a String
, or null
if the parameter does not exist. Request parameters are extra information sent with the request. For HTTP servlets, parameters are contained in the query string or posted form data.
You should only use this method when you are sure the parameter has only one value. If the parameter might have more than one value, use getParameterValues.
If you use this method with a multivalued parameter, the value returned is equal to the first value in the array returned by getParameterValues
.
If the parameter data was sent in the request body, such as occurs with an HTTP POST request, then reading the body directly via getInputStream or getReader can interfere with the execution of this method.
name | a String specifying the name of the parameter |
String
representing the single value of the parameterImplements servlet::ServletRequest.
Definition at line 772 of file HttpServletRequestImpl.cpp.
References m_parameters.
std::auto_ptr< std::multimap< std::string, std::string > > container::HttpServletRequestImpl::getParameterMap | ( | ) | const [virtual] |
Returns a java.util.Map of the parameters of this request. Request parameters are extra information sent with the request. For HTTP servlets, parameters are contained in the query string or posted form data.
Implements servlet::ServletRequest.
Definition at line 787 of file HttpServletRequestImpl.cpp.
References m_parameters.
std::auto_ptr< std::vector< std::string > > container::HttpServletRequestImpl::getParameterNames | ( | ) | const [virtual] |
Returns an Enumeration
of String
objects containing the names of the parameters contained in this request. If the request has no parameters, the method returns an empty Enumeration
.
Enumeration
of String
objects, each String
containing the name of a request parameter; or an empty Enumeration
if the request has no parameters Implements servlet::ServletRequest.
Definition at line 779 of file HttpServletRequestImpl.cpp.
References container::util::getMapKeyNames(), and m_parameters.
std::auto_ptr< std::vector< std::string > > container::HttpServletRequestImpl::getParameterValues | ( | const std::string & | name | ) | const [virtual] |
Returns an array of String
objects containing all of the values the given request parameter has, or null
if the parameter does not exist.
If the parameter has a single value, the array has a length of 1.
name | a String containing the name of the parameter whose value is requested |
String
objects containing the parameter's valuesImplements servlet::ServletRequest.
Definition at line 783 of file HttpServletRequestImpl.cpp.
References container::util::getMapValues(), and m_parameters.
void container::HttpServletRequestImpl::getParams | ( | ) | [private] |
Process request and get request parameters if any
Parses query string from GET request, url-encoded POST data, and multi-part data, in case of file uploads
Definition at line 203 of file HttpServletRequestImpl.cpp.
References getHeader(), getQueryString(), m_contentLength, m_inputStream, m_maxRequestSize, m_method, parseMultipartData(), and parseQueryString().
Referenced by load().
std::string container::HttpServletRequestImpl::getPathInfo | ( | ) | const [virtual] |
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.
This method returns null
if there was no extra path information.
Same as the value of the CGI variable PATH_INFO.
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; or null
if the URL does not have any extra path information Implements servlet::HttpServletRequest.
Definition at line 897 of file HttpServletRequestImpl.cpp.
References m_pathInfo.
Referenced by getPathTranslated().
std::string container::HttpServletRequestImpl::getPathTranslated | ( | ) | const [virtual] |
Returns any extra path information after the servlet name but before the query string, and translates it to a real path. Same as the value of the CGI variable PATH_TRANSLATED.
If the URL does not have any extra path information, this method returns null
or the servlet container cannot translate the virtual path to a real path for any reason (such as when the web application is executed from an archive).
The web container does not decode this string.
String
specifying the real path, or null
if the URL does not have any extra path information Implements servlet::HttpServletRequest.
Definition at line 901 of file HttpServletRequestImpl.cpp.
References getPathInfo(), container::serverconfig::AppContext::getRealPath(), and m_ctx.
std::string container::HttpServletRequestImpl::getProtocol | ( | ) | const [virtual] |
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 variable SERVER_PROTOCOL
.
String
containing the protocol name and version number Implements servlet::ServletRequest.
Definition at line 791 of file HttpServletRequestImpl.cpp.
References m_protocol.
std::string container::HttpServletRequestImpl::getQueryString | ( | ) | const [virtual] |
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.
String
containing the query string or null
if the URL contains no query string. The value is not decoded by the container. Implements servlet::HttpServletRequest.
Definition at line 917 of file HttpServletRequestImpl.cpp.
References m_queryString.
Referenced by getParams().
std::string container::HttpServletRequestImpl::getRemoteAddr | ( | ) | const [virtual] |
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
.
String
containing the IP address of the client that sent the request Implements servlet::ServletRequest.
Definition at line 807 of file HttpServletRequestImpl.cpp.
References m_remoteAddr.
std::string container::HttpServletRequestImpl::getRemoteHost | ( | ) | const [virtual] |
Returns the fully qualified name of the client or the last proxy that sent the request. If the engine cannot or chooses not to resolve the hostname (to improve performance), this method returns the dotted-string form of the IP address. For HTTP servlets, same as the value of the CGI variable REMOTE_HOST
.
String
containing the fully qualified name of the client Implements servlet::ServletRequest.
Definition at line 811 of file HttpServletRequestImpl.cpp.
References addr2host(), m_remoteAddr, and m_remoteHost.
int container::HttpServletRequestImpl::getRemotePort | ( | ) | const [virtual] |
Returns the Internet Protocol (IP) source port of the client or last proxy that sent the request.
Implements servlet::ServletRequest.
Definition at line 828 of file HttpServletRequestImpl.cpp.
References m_remotePort.
std::string container::HttpServletRequestImpl::getRemoteUser | ( | ) | const [virtual] |
Returns the login of the user making this request, if the user has been authenticated, or null
if the user has not been authenticated. Whether the user name is sent with each subsequent request depends on the browser and type of authentication. Same as the value of the CGI variable REMOTE_USER.
String
specifying the login of the user making this request, or null
if the user login is not known Implements servlet::HttpServletRequest.
Definition at line 921 of file HttpServletRequestImpl.cpp.
References m_remoteUser.
servlet::RequestDispatcher * container::HttpServletRequestImpl::getRequestDispatcher | ( | const std::string & | path | ) | [virtual] |
Returns a servlet::RequestDispatcher object that acts as a wrapper for the resource located at the given path. A RequestDispatcher
object can be used to forward a request to the resource or to include the resource in a response. The resource can be dynamic or static.
The pathname specified may be relative, although it cannot extend outside the current servlet context. If the path begins with a "/" it is interpreted as relative to the current context root. This method returns null
if the servlet container cannot return a RequestDispatcher
.
The difference between this method and servlet::ServletContext#getRequestDispatcher is that this method can take a relative path.
path | a String specifying the pathname to the resource. If it is relative, it must be relative against the current servlet. |
RequestDispatcher
object that acts as a wrapper for the resource at the specified path, or null
if the servlet container cannot return a RequestDispatcher
ServletContext::getRequestDispatcher
Implements servlet::ServletRequest.
Definition at line 821 of file HttpServletRequestImpl.cpp.
References container::serverconfig::AppContext::getRequestDispatcher(), and m_ctx.
std::string container::HttpServletRequestImpl::getRequestedSessionId | ( | ) | const [virtual] |
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 null
.
String
specifying the session ID, or null
if the request did not specify a session IDImplements servlet::HttpServletRequest.
Definition at line 929 of file HttpServletRequestImpl.cpp.
References m_sessionId.
Referenced by getSession(), isRequestedSessionIdValid(), and setRespRef().
std::string container::HttpServletRequestImpl::getRequestURI | ( | ) | const [virtual] |
Returns the part of this request's 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. For example:
First line of HTTP request | Returned Value | |
---|---|---|
POST /some/path.html HTTP/1.1 | /some/path.html | |
GET http://foo.bar/a.html HTTP/1.0 | /a.html | |
HEAD /xyz?a=b HTTP/1.1 | /xyz |
To reconstruct an URL with a scheme and host, use HttpUtils#getRequestURL.
String
containing the part of the URL from the protocol name up to the query stringImplements servlet::HttpServletRequest.
Definition at line 933 of file HttpServletRequestImpl.cpp.
References m_uri.
Referenced by getRequestURL().
std::string container::HttpServletRequestImpl::getRequestURL | ( | ) | const [virtual] |
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.
Because this method returns a StringBuffer
, not a string, you can modify the URL easily, for example, to append query parameters.
This method is useful for creating redirect messages and for reporting errors.
StringBuffer
object containing the reconstructed URL Implements servlet::HttpServletRequest.
Definition at line 937 of file HttpServletRequestImpl.cpp.
References getRequestURI(), getScheme(), getServerName(), and getServerPort().
std::string container::HttpServletRequestImpl::getScheme | ( | ) | const [virtual] |
Returns the name of the scheme used to make this request, for example, http
, https
, or ftp
. Different schemes have different rules for constructing URLs, as noted in RFC 1738.
String
containing the name of the scheme used to make this request Implements servlet::ServletRequest.
Definition at line 795 of file HttpServletRequestImpl.cpp.
References m_scheme.
Referenced by getRequestURL().
std::string container::HttpServletRequestImpl::getServerName | ( | ) | const [virtual] |
Returns the host name of the server to which the request was sent. It is the value of the part before ":" in the Host
header value, if any, or the resolved server name, or the server IP address.
String
containing the name of the server Implements servlet::ServletRequest.
Definition at line 799 of file HttpServletRequestImpl.cpp.
References m_serverName.
Referenced by getRequestURL().
int container::HttpServletRequestImpl::getServerPort | ( | ) | const [virtual] |
Returns the port number to which the request was sent. It is the value of the part after ":" in the Host
header value, if any, or the server port where the client connection was accepted on.
Implements servlet::ServletRequest.
Definition at line 803 of file HttpServletRequestImpl.cpp.
References m_serverPort.
Referenced by getRequestURL().
std::string container::HttpServletRequestImpl::getServletPath | ( | ) | const [virtual] |
Returns the part of this request's URL that calls the servlet. This path starts with a "/" character and includes either the servlet name or a path to the servlet, but does not include any extra path information or a query string. Same as the value of the CGI variable SCRIPT_NAME.
This method will return an empty string ("") if the servlet used to process this request was matched using the "/"* pattern.
String
containing the name or path of the servlet being called, as specified in the request URL, decoded, or an empty string if the servlet used to process the request is matched using the "/"* pattern. Implements servlet::HttpServletRequest.
Definition at line 943 of file HttpServletRequestImpl.cpp.
References m_servletPath.
Referenced by getHeaders().
servlet::HttpSession * container::HttpServletRequestImpl::getSession | ( | bool | create = true |
) | [virtual] |
Gets session associated with current request.
create | Whether to create a new session if it doesn't yet exist The session is associated with current request through session ID passed as cookie. Thus, if session is retrieved after request is committed and session is new (cookie needs to be set), an InvalidStateException will be thrown |
Implements servlet::HttpServletRequest.
Definition at line 406 of file HttpServletRequestImpl.cpp.
References container::HttpServletResponseImpl::addCookie(), servlet::HttpSession::getId(), getRequestedSessionId(), container::serverconfig::AppContext::getServletContextName(), container::serverconfig::AppContext::getSession(), container::serverconfig::AppContext::getSessionCookieName(), container::serverconfig::AppContext::getUriBase(), servlet::HttpSession::isNew(), m_ctx, m_resp, and m_session.
Referenced by setRespRef().
servlet::UploadedFile * container::HttpServletRequestImpl::getUploadedFile | ( | const std::string & | name | ) | [virtual] |
name | parameter name, as defined by request. _not_ the name of file |
Implements servlet::HttpServletRequest.
Definition at line 458 of file HttpServletRequestImpl.cpp.
References m_files.
bool container::HttpServletRequestImpl::hasAttribute | ( | const std::string & | name | ) | const [virtual] |
[C++ Servlet API Extention]
Returns the false if no attribute of the given name exists. Returns true otherwize
Attributes can be set two ways. The servlet container may set attributes to make available custom information about a request. For example, for requests made using HTTPS, the attribute javax.servlet.request.X509Certificate
can be used to retrieve information on the certificate of the client. Attributes can also be set programatically using servlet::ServletRequest#setAttribute. This allows information to be embedded into a request before a servlet::RequestDispatcher call.
Attribute names should follow the same conventions as package names. This specification reserves names matching java.*
, javax.*
, and sun.*
.
name | a String specifying the name of the attribute |
Implements servlet::ServletRequest.
Definition at line 730 of file HttpServletRequestImpl.cpp.
References m_attributes.
bool container::HttpServletRequestImpl::isRequestedSessionIdFromCookie | ( | ) | const [virtual] |
Checks whether the requested session ID came in as a cookie.
true
if the session ID came in as a cookie; otherwise, false
Implements servlet::HttpServletRequest.
Definition at line 952 of file HttpServletRequestImpl.cpp.
bool container::HttpServletRequestImpl::isRequestedSessionIdFromURL | ( | ) | const [virtual] |
Checks whether the requested session ID came in as part of the request URL.
true
if the session ID came in as part of a URL; otherwise, false
Implements servlet::HttpServletRequest.
Definition at line 956 of file HttpServletRequestImpl.cpp.
bool container::HttpServletRequestImpl::isRequestedSessionIdValid | ( | ) | const [virtual] |
Checks whether the requested session ID is still valid.
true
if this request has an id for a valid session in the current session context; false
otherwiseHttpSessionContext
Implements servlet::HttpServletRequest.
Definition at line 947 of file HttpServletRequestImpl.cpp.
References container::serverconfig::AppContext::getSession(), m_ctx, m_sessionId, and container::HttpSessionImpl::validP().
bool container::HttpServletRequestImpl::isRequestedSessionIdValid | ( | ) | [virtual] |
Definition at line 444 of file HttpServletRequestImpl.cpp.
References getRequestedSessionId(), container::serverconfig::AppContext::isSessionValid(), and m_ctx.
Referenced by setRespRef().
bool container::HttpServletRequestImpl::isSecure | ( | ) | const [virtual] |
Returns the preferred Locale
that the client will accept content in, based on the Accept-Language header. If the client request doesn't provide an Accept-Language header, this method returns the default locale for the server.
Locale
for the client
Returns an Enumeration
of Locale
objects indicating, in decreasing order starting with the preferred locale, the locales that are acceptable to the client based on the Accept-Language header. If the client request doesn't provide an Accept-Language header, this method returns an Enumeration
containing one Locale
, the default locale for the server.
Enumeration
of preferred Locale
objects for the clientReturns a boolean indicating whether this request was made using a secure channel, such as HTTPS.
Implements servlet::ServletRequest.
Definition at line 817 of file HttpServletRequestImpl.cpp.
References m_isSecure.
bool container::HttpServletRequestImpl::isUserInRole | ( | const std::string & | role | ) | const [virtual] |
Returns a boolean indicating whether the authenticated user is included in the specified logical "role". Roles and role membership can be defined using deployment descriptors. If the user has not been authenticated, the method returns false
.
role | a String specifying the name of the role |
boolean
indicating whether the user making this request belongs to a given role; false
if the user has not been authenticated Implements servlet::HttpServletRequest.
Definition at line 925 of file HttpServletRequestImpl.cpp.
void container::HttpServletRequestImpl::load | ( | ) |
Definition at line 68 of file HttpServletRequestImpl.cpp.
References getHeaders(), getParams(), m_characterEncoding, m_con, m_maxRequestSize, and container::Connection::setLimit().
void container::HttpServletRequestImpl::parseAddr | ( | const std::string & | addr, | |
std::string & | name, | |||
unsigned short & | port | |||
) | [static, private] |
void container::HttpServletRequestImpl::parseCookieHeader | ( | const std::string & | data | ) | [private] |
Parses Cookie header and adds cookies to request cookie list
Definition at line 319 of file HttpServletRequestImpl.cpp.
References container::serverconfig::AppContext::getSessionCookieName(), m_cookies, m_ctx, m_sessionId, servlet::Cookie::setDomain(), servlet::Cookie::setPath(), servlet::Cookie::setVersion(), and container::version().
Referenced by getHeaders().
void container::HttpServletRequestImpl::parseMultipartData | ( | std::istream & | data | ) | [private] |
Definition at line 677 of file HttpServletRequestImpl.cpp.
References container::find_boundary(), getContentType(), and container::MimePartCharSink::partDone().
Referenced by getParams().
void container::HttpServletRequestImpl::parsePart | ( | const std::string & | data | ) | [private] |
void container::HttpServletRequestImpl::parseQueryString | ( | std::istream & | queryString | ) | [private] |
Definition at line 224 of file HttpServletRequestImpl.cpp.
References m_parameters, and servlet::util::urlInPlaceDecode().
Referenced by getParams().
void container::HttpServletRequestImpl::removeAttribute | ( | const std::string & | name | ) | [virtual] |
Removes an attribute from this request. This method is not generally needed as attributes only persist as long as the request is being handled.
Attribute names should follow the same conventions as package names. Names beginning with java.*
, javax.*
, and com.sun.*
, are reserved for use by Sun Microsystems.
name | a String specifying the name of the attribute to remove |
Implements servlet::ServletRequest.
Definition at line 743 of file HttpServletRequestImpl.cpp.
References m_attributes.
void container::HttpServletRequestImpl::setAttribute | ( | const std::string & | name, | |
boost::shared_ptr< void > | o | |||
) | [virtual] |
Stores an attribute in this request. Attributes are reset between requests. This method is most often used in conjunction with servlet::RequestDispatcher.
Attribute names should follow the same conventions as package names. Names beginning with java.*
, javax.*
, and com.sun.*
, are reserved for use by Sun Microsystems.
If the object passed in is null, the effect is the same as calling removeAttribute.
It is warned that when the request is dispatched from the servlet resides in a different web application by RequestDispatcher
, the object set by this method may not be correctly retrieved in the caller servlet.
name | a String specifying the name of the attribute | |
o | the Object to be stored |
Implements servlet::ServletRequest.
Definition at line 739 of file HttpServletRequestImpl.cpp.
References m_attributes.
void container::HttpServletRequestImpl::setCharacterEncoding | ( | const std::string & | env | ) | [virtual] |
Overrides the name of the character encoding used in the body of this request. This method must be called prior to reading request parameters or reading input using getReader().
env | a String containing the name of the character encoding. |
java.io.UnsupportedEncodingException | if this is not a valid encoding |
Implements servlet::ServletRequest.
Definition at line 753 of file HttpServletRequestImpl.cpp.
References m_characterEncoding.
void container::HttpServletRequestImpl::setRespRef | ( | HttpServletResponseImpl * | resp | ) |
Sets reference to responce in the request
Request processing may need to do some things to responce. This includes handling SessionID cookie, and probably some other stuff. So, when ServletContainer creates request and response, it calls this function before passing the request to Servlet::service
Definition at line 431 of file HttpServletRequestImpl.cpp.
References getRequestedSessionId(), getSession(), isRequestedSessionIdValid(), and m_resp.
Definition at line 61 of file HttpServletRequestImpl.h.
Referenced by getAttribute(), getAttributeNames(), hasAttribute(), removeAttribute(), and setAttribute().
std::string container::HttpServletRequestImpl::m_characterEncoding [private] |
Definition at line 58 of file HttpServletRequestImpl.h.
Referenced by getCharacterEncoding(), load(), and setCharacterEncoding().
Connection& container::HttpServletRequestImpl::m_con [protected] |
long container::HttpServletRequestImpl::m_contentLength [private] |
Definition at line 59 of file HttpServletRequestImpl.h.
Referenced by getContentLength(), getHeaders(), and getParams().
std::string container::HttpServletRequestImpl::m_contentType [private] |
Definition at line 60 of file HttpServletRequestImpl.h.
Referenced by getContentType(), and getHeaders().
Definition at line 67 of file HttpServletRequestImpl.h.
Referenced by getCookies(), parseCookieHeader(), and ~HttpServletRequestImpl().
Definition at line 166 of file HttpServletRequestImpl.h.
Referenced by getContextPath(), getFileSaveTemplate(), getPathTranslated(), getRequestDispatcher(), getSession(), isRequestedSessionIdValid(), and parseCookieHeader().
Definition at line 47 of file HttpServletRequestImpl.h.
Referenced by addUploadedFile(), getUploadedFile(), and ~HttpServletRequestImpl().
Definition at line 63 of file HttpServletRequestImpl.h.
Referenced by getHeader(), getHeaderNames(), and getHeaders().
std::istream container::HttpServletRequestImpl::m_inputStream [protected] |
Definition at line 168 of file HttpServletRequestImpl.h.
Referenced by getHeaders(), getInputStream(), and getParams().
bool container::HttpServletRequestImpl::m_inputStreamTaken [private] |
bool container::HttpServletRequestImpl::m_isSecure [private] |
std::string container::HttpServletRequestImpl::m_localAddr [private] |
Definition at line 49 of file HttpServletRequestImpl.h.
Referenced by getHeaders(), getLocalAddr(), and getLocalName().
std::string container::HttpServletRequestImpl::m_localName [mutable, private] |
Definition at line 50 of file HttpServletRequestImpl.h.
Referenced by getHeaders(), and getLocalName().
unsigned short container::HttpServletRequestImpl::m_localPort [private] |
Definition at line 51 of file HttpServletRequestImpl.h.
Referenced by getHeaders(), and getLocalPort().
size_t container::HttpServletRequestImpl::m_maxFileSize [private] |
Definition at line 76 of file HttpServletRequestImpl.h.
size_t container::HttpServletRequestImpl::m_maxRequestSize [private] |
std::string container::HttpServletRequestImpl::m_method [private] |
Definition at line 64 of file HttpServletRequestImpl.h.
Referenced by getHeaders(), getMethod(), and getParams().
Definition at line 62 of file HttpServletRequestImpl.h.
Referenced by addParam(), getParameter(), getParameterMap(), getParameterNames(), getParameterValues(), and parseQueryString().
std::string container::HttpServletRequestImpl::m_pathInfo [private] |
Definition at line 70 of file HttpServletRequestImpl.h.
Referenced by getHeaders(), and getPathInfo().
std::string container::HttpServletRequestImpl::m_protocol [private] |
Definition at line 73 of file HttpServletRequestImpl.h.
Referenced by getHeaders(), and getProtocol().
std::string container::HttpServletRequestImpl::m_queryString [private] |
Definition at line 66 of file HttpServletRequestImpl.h.
Referenced by getHeaders(), and getQueryString().
std::string container::HttpServletRequestImpl::m_remoteAddr [private] |
Definition at line 52 of file HttpServletRequestImpl.h.
Referenced by getHeaders(), getRemoteAddr(), and getRemoteHost().
std::string container::HttpServletRequestImpl::m_remoteHost [mutable, private] |
Definition at line 53 of file HttpServletRequestImpl.h.
Referenced by getHeaders(), and getRemoteHost().
unsigned short container::HttpServletRequestImpl::m_remotePort [private] |
Definition at line 54 of file HttpServletRequestImpl.h.
Referenced by getHeaders(), and getRemotePort().
std::string container::HttpServletRequestImpl::m_remoteUser [private] |
Definition at line 167 of file HttpServletRequestImpl.h.
Referenced by getSession(), and setRespRef().
std::string container::HttpServletRequestImpl::m_scheme [private] |
Definition at line 57 of file HttpServletRequestImpl.h.
Referenced by getHeaders(), and getScheme().
std::string container::HttpServletRequestImpl::m_serverName [private] |
Definition at line 55 of file HttpServletRequestImpl.h.
Referenced by getHeaders(), and getServerName().
unsigned short container::HttpServletRequestImpl::m_serverPort [private] |
Definition at line 56 of file HttpServletRequestImpl.h.
Referenced by getHeaders(), and getServerPort().
std::string container::HttpServletRequestImpl::m_servletPath [private] |
std::string container::HttpServletRequestImpl::m_sessionId [private] |
Definition at line 68 of file HttpServletRequestImpl.h.
Referenced by getRequestedSessionId(), isRequestedSessionIdValid(), and parseCookieHeader().
std::string container::HttpServletRequestImpl::m_uri [private] |
Definition at line 65 of file HttpServletRequestImpl.h.
Referenced by getHeaders(), and getRequestURI().