Construct a new mock request for the given URL.
Construct a new mock request for the given URL. See processUrl for limitations.
The URL to extract from
The servlet context of the request.
Construct a new mock request for the given URL.
Construct a new mock request for the given URL. See processUrl for limitations.
The URL to extract from
The URL to extract from
The context path for this request. Defaults to "" per the Servlet API.
Adds an "Authorization" header, per RFC1945.
The raw body of the request.
Sets the body to the given json value and content type.
Sets the body to the given json value.
Sets the body to the given json value. Also sets the contentType to "application/json"
Sets the body to the given elements and content type.
Sets the body to the given elements and content type.
Note that the elements will be converted to bytes based on the current setting of charEncoding.
Sets the body to the given elements.
Sets the body to the given elements. Also sets the contentType to "text/xml"
Note that the elements will be converted to bytes based on the current setting of charEncoding.
Sets the body to the given string and content type.
Sets the body to the given string and content type.
Note that the String will be converted to bytes based on the current setting of charEncoding.
Sets the body to the given string.
Sets the body to the given string. The content type is set to "text/plain".
Note that the String will be converted to bytes based on the current setting of charEncoding.
The character encoding of the request.
The character encoding of the request.
Defaults to UTF-8. Note that this differs from the default encoding per the HTTP spec (ISO-8859-1), so you will need to change this if you need something other than UTF-8.
Compute the path portion after the contextPath
The context path for this request.
The context path for this request. Defaults to "" per the Servlet API.
The local address that the request was received on.
The local address that the request was received on.
If you change this you should probably change localName and serverName as well.
The local hostname that the request was received on.
The local hostname that the request was received on.
If you change this you should probably change localAddr and serverName as well.
The port that this request was received on.
The port that this request was received on. You should probably change serverPort as well if you change this.
The preferred locales for the client, in decreasing order of preference.
The preferred locales for the client, in decreasing order of preference. If not set, the default locale will be used.
The query parameters for the request.
The query parameters for the request. There are two main ways to set this List, either by modifying the parameters var directly, or by assigning to queryString, which will parse the provided string into GET parameters.
Set fields based on the given URL.
Set fields based on the given URL. There are several limitations:
The URL to extract from
Set fields based on the given url string.
Set fields based on the given url string. If the url begins with "http" it is assumed to be a full URL, and is processed with processUrl(URL). If the url begins with "/" then it's assumed to be only the path and query string.
The URL to extract from
The address of the client that sent the request.
The address of the client that sent the request.
If you change this you should probably change remoteHost as well.
The hostname of the client that sent the request.
The hostname of the client that sent the request.
If you change this you should probably change remoteAddr as well.
Indicates whether the request is being handled by a secure protocol (e.
Indicates whether the request is being handled by a secure protocol (e.g. HTTPS). If you set the scheme to https you should set this to true.
The port that this request was received on.
The port that this request was received on. You should probably change localPort as well if you change this.
A utility method to set the given header to an RFC1123 date based on the given long value (epoch seconds).
The URL to extract from
(Since version 2.4) Use the "attributes" var instead
(Since version 2.4) Use the "attributes" var instead
(Since version 2.4) Use the "parameters" var instead
(Since version 2.4) Use the "parameters" var instead
A Mock ServletRequest. Change its state to create the request you are interested in. At the very least, you will need to change method and path.
There are several things that aren't supported: