Class to encapsulate request data.Fields:
actionaction requested (view, edit, save, ...)
cookieshashref whose keys are cookie names and values are CGI::Cookie objects
headershashref whose keys are header name
methodrequest method (GET, HEAD, POST)
paramhashref of parameters, both query and body ones
param_listarrayref with parameter names in received order
path_infopath_info of request (eg. /WebName/TopciName)
remote_addressClient's IP address
remote_userRemote HTTP authenticated user
secureBoolean value about use of encryption
server_portPort that the webserver listens on
uploadshashref whose keys are parameter name of uploaded files
urithe request uri
$initializer- may be a filehandle or hashref.
savemethod. Note: Restore only parameters
ObjectMethodaction([$action]) → $action
Gets/Sets action requested (view, edit, save, ...)
ObjectMethodbase_action() → $action
Get the first action ever set in this request object. This remains unchanged even if a request cache is unwrapped on to of this request. The idea is that callers can always find out the action that initiated the HTTP request. This is required for (for example) checking access controls.
ObjectMethodmethod( [ $method ] ) → $method
Sets/Gets request method (GET, HEAD, POST).
ObjectMethodpathInfo( [ $path ] ) → $path
Sets/Gets request path info.
Called without parameters returns current pathInfo.There is a
path_info()alias for compatibility with CGI. Note that the string returned is a URL encoded byte string i.e. it will only contain characters -A-Za-z0-9_.~!*\'();:@&=+$,/?%# If you intend to analyse it, you will probably have to Foswiki::urlDecode it first.
ObjectMethodprotocol() → $protocol
Returns 'https' if secure connection. 'http' otherwise.
ObjectMethoduri( [$uri] ) → $uri
Gets/Sets request uri.
ObjectMethodqueryString() → $query_string
Returns query_string part of request uri, if any.
query_string()alias provided for compatibility with CGI. Note that the string returned is a URL encoded byte string i.e. it will only contain characters -A-Za-z0-9_.~!*\'();:@&=+$,/?%# If you intend to analyse it, you will probably have to Foswiki::urlDecode it first.
ObjectMethodurl( [-full → 1,
Reasonably compatible with CGI corresponding method. Doesn't support -rewrite. See Item5914.
ObjectMethodsecure( [$secure] ) → $secure
Gets/Sets connection's secure flag.
ObjectMethodremoteAddress( [$ip] ) → $ip
Gets/Sets client IP address.
remote_addr()alias for compatibility with CGI.
ObjectMethodremoteUser( [$userName] ) → $userName
Gets/Sets remote user's name.
remote_user()alias for compatibility with CGI.
ObjectMethodserverPort( [$userName] ) → $userName
Gets/Sets server user's name.
server_port()alias for compatibility with CGI.
ObjectMethodqueryParam( [-name → $name, -value => $value |
This method is used by engines, during its prepare phase. Should not be used anywhere else. Since bodyParam must exist and it has different semantics from param method, this one exists for symmetry, and could be modified in the future, so it could be possible to get query and body parameters independently.
ObjectMethodbodyParam( [-name → $name, -value => $value |
Adds parameters passed within request body to the object. Should be called only by engines. Otherwise use param() method.
ObjectMethodparam( [-name → $name, -value => $value |
Resonably compatible with CGI.NOTE this method will assert if it is called in a list context. A list context might be:
my_function( $query->param( ...
my @l = $query->param(...
defined($query->param( ...is OK
lc($query->param( ...is OK
... if ( $query->param( ...is OK
multi_param(fully compatible) to retrieve list parameters.
ObjectMethodcookie($name [, $value, $path, $secure, $expires]) → $value
$nameparameter returns value of cookie with that name or undef if it doesn't exist.
Gets/Sets cookies hashref. Keys are cookie names and values CGI::Cookie objects.
ObjectMethoddelete( @paramNames )
Deletes parameters from request.
Delete()alias provided for compatibility with CGI
Deletes all parameter name and value(s).
delete_all()alias provided for compatibility with CGI.
ObjectMethodheader([-name → $name, -value => $value |
httpmethod. %ENV is not available and must be replaced by calls to this and other methods of this class.
httpis provided for compatibility, but is deprecated. Use this one instead. Calls to CGI
headermethod must be replaced by calls to Foswiki::Response
ObjectMethodsave( $fh )
Saves object state to filehandle. Object may be loaded later passing $fh to new constructor or by calling load().
ObjectMethodload( $fh )
Loads object state from filehandle, probably created with a previous save().
ObjectMethodupload( $name ) → $handle
Called with file name parameter returns an open filehandle to uploaded file.
ObjectMethoduploadInfo( $fname ) → $headers
Returns a hashref to information about uploaded files as sent by browser.
ObjectMethodtmpFileName( $fname ) → $tmpFileName
Returns the name of temporarly created file to store uploaded $fname.$fname may be obtained by calling
param()with form field name.
ObjectMethoduploads( [ \%uploads ] ) → $hashref
ObjectMethodhttp( [$header] ) → $value DEPRECATED
Called without parameters returns a list of all available header filed names.
Given a field name returns value associated.
http('HTTP_USER_AGENT'); http('User-Agent') and http('User_Agent') are equivalent.Please, use
header()instead. Present only for compatibility with CGI.
ObjectMethodhttps( [$name] ) → $value || $secure DEPRECATED
http()method above. Called with no parameters returns secure flag. Please, use
secure()instead. Present only for compatibility with CGI.
ObjectMethoduserAgent() → $userAgent;
Convenience method to get User-Agent string.
user_agent()alias provided for compatibility with CGI.
Convenience method to get Referer uri.