Call this method to initialize the object with information about the current request.
BOOL Initialize( IHttpRequestLookup* pRequestLookup ) throw( ); BOOL Initialize( IHttpServerContext* pServerContext, DWORD dwMaxFormSize = DEFAULT_MAX_FORM_SIZE, DWORD dwFlags = ATL_FORM_FLAG_NONE ) throw( );
- The request lookup interface used to provide access to the server context, and existing collections of files, form variables, and query parameters.
- The server context.
- The maximum size of a request that will be parsed. If the request exceeds this size, the body of the request will not be parsed. See DEFAULT_MAX_FORM_SIZE.
- The form flags.
Returns TRUE on success, FALSE on failure.
Call Initialize directly or using the appropriate constructor before using the methods and properties of the request object.
The first overload initializes the request object using an IHttpRequestLookup interface to supply the server context and existing collections of files, form variables, and query parameters.
The second overload initializes the request object using a server context and builds up the files, form variables, and query parameters from the raw data exposed by that context. This overload of Initialize does the following:
- Parses and decodes the query string into a collection of name-value pairs. This collection is accessible through the CHttpRequest::GetQueryParams method.
- Parses the body of a POST request if the size of the request data is less than or equal to dwMaxFormSize. The body of the request will consist of simple form variables and may also contain files if the request is encoded as multipart/form-data. In that case, the dwFlags parameter is passed to CMultiPartFormParser::GetMultiPartData to control the creation of the files. The collection of form variables is accessible through the CHttpRequest::GetFormVars method or the FormVars property. The collection of files is accessible through the CHttpRequest::m_Files member.
Note that Initialize does not parse the cookies associated with a request. Cookies are not processed until an attempt is made to access a cookie in the collection.