Mock servlet request. Implements all of the methods from the standard
HttpServletRequest class plus helper methods to aid setting up a request.
author: Chris Turner
getContentType() If there has been added uploaded files return the correct content-type.
The correct multipart content-type if there has been addeduploaded files.
setRequestToRedirectString(String redirect) Initialise the request parameters from the given redirect string that
redirects back to a particular component for display.
public void
setURL(String url) Set the complete url for this request.
Create the request using the supplied session object.
Parameters: application - The application that this request is for Parameters: session - The session object Parameters: context - The current servlet context
Add an uploaded file to the request. Use this to simulate a file that has
been uploaded to a field.
Parameters: fieldName - The fieldname of the upload field. Parameters: file - The file to upload. Parameters: contentType - The content type of the file. Must be a correct mimetype.
Return the length of the content. This is always -1 except if there has
been added uploaded files. Then the length will be the length of the
generated request.
-1 if no uploaded files has been added. Else the length of thegenerated request.
If there has been added uploaded files return the correct content-type.
The correct multipart content-type if there has been addeduploaded files. Else null.
Get the given header as a date.
Parameters: name - The header name The date, or -1 if header not found throws: IllegalArgumentException - If the header cannot be converted
Get the given header as an int.
Parameters: name - The header name The header value or -1 if header not found throws: NumberFormatException - If the header is not formatted correctly
This feature is not implemented at this time as we are not supporting
binary servlet input. This functionality may be added in the future.
The reader throws: IOException - If an I/O related problem occurs
Return a dummy dispatcher that just records that dispatch has occured
without actually doing anything.
Parameters: name - The name to dispatch to The dispatcher
Set the path that this request is supposed to be serving. The path is
relative to the web application root and should start with a / charater
Parameters: path -
setRequestToBookmarkablePage
public void setRequestToBookmarkablePage(Page page, Map params)(Code)
Initialise the request parameters to point to the given bookmarkable
page.
Parameters: page - The page to point to Parameters: params - Additional parameters
setRequestToComponent
public void setRequestToComponent(Component component)(Code)
Initialise the request parameters to point to the given component.
Parameters: component - The component
setRequestToFormComponent
public void setRequestToFormComponent(Form form, Map values)(Code)
Initialise the request parameters to point to the given form component.
The additional map should contain mappings between individual components
that appear in the form and the string value that should be submitted for
each of these components.
Parameters: form - The for to send the request to Parameters: values - The values for each of the form components
setRequestToRedirectString
public void setRequestToRedirectString(String redirect)(Code)
Initialise the request parameters from the given redirect string that
redirects back to a particular component for display.
Parameters: redirect - The redirect string to display from