|
NAMEJifty::Request - Canonical internal representation of an incoming Jifty requestDESCRIPTIONThis document discusses the ins and outs of getting data from the web browser (or any other source) and figuring out what it means. Most of the time, you won't need to worry about the details, but they are provided below if you're curious.This class parses the submission and makes it available as a protocol-independent Jifty::Request object. Each request contains several types of information:
REQUEST PROPERTIESaddressargumentsbodycontent_lengthcontent_typecookiesenvheaderheadersinputmethodrequest_method (deprecated)pathpath_infoportprotocolrefererremote_hostrequest_urischemescript_namesecureuploadsuriuseruser_agentMETHODSBUILD PARAMHASHCreates a new request object. For each key in the "PARAMHASH", the method of that name is called, with the "PARAMHASH"'s value as its sole argument.setup_subrequest_envCopies the bare minimals of the plack environment from the top request; this is called in "BUILD" if the request is a subrequest.cloneReturn a copy of the request.promoteAttempt to fill in the request from any number of various methods -- YAML, JSON, etc. Falls back to query parameters. Takes a Plack::Request object.from_data_structureFills in the request from a data structure. This is called once the YAML or JSON has been parsed. See "SERIALIZATION" for details of how to construct a proper data structure.Returns itself. from_args REQCalls "from_webform" with the "parameters" in Plack::Request after splitting "|"'s in argument names. See "argument munging".Returns itself. from_webform %QUERY_ARGSParses web form arguments into the Jifty::Request data structure. Takes in the query arguments. See "SERIALIZATION" for details of how query parameters are parsed.Returns itself. argument KEY [=> VALUE]Merges a single query parameter into the request. This may add actions, change action arguments, or change state variables.template_argument KEY [=> VALUE]Sets an argument for the current template. Template arguments, unlike values set via "argument", cannot add actions, change action argument, or change state variables. They are also not stored in continuations.delete KEYRemoves the argument supplied -- this is the opposite of "argument", above.parse_form_field_name FIELDNAMETakes a form field name generated by a Jifty action. Returns a tuple of
webform_to_data_structure HASHREFConverts the data from a webform's %args to the data structure that Jifty::Request uses internally.XXX TODO: ALEX: DOC ME continuation_id [CONTINUATION_ID]Gets or sets the ID of the current continuation associated with the request.continuation [CONTINUATION]Returns the current Jifty::Continuation object associated with this request, if any.future_continuation_idGets or sets the ID of the continuation that we are about to return or call into.future_continuationReturns the Jifty::Continuation that we are about to return or call into, if any.save_continuationSaves the current request and response if we've been asked to. If we save the continuation, we redirect to the next page -- the call to "save_continuation" never returns.call_continuationCalls the Jifty::Continuation associated with this request, if there is one. Returns true if the continuation was called successfully -- if calling the continuation requires a redirect, this function will throw an exception to its enclosing dispatcher.return_from_continuationReturns from the current continuation, if there is one. If the request path doesn't match, we call the continuation again, which should redirect to the right place. If we have to do this, we return true, which should be taken as a sign to not process the request further.pathReturns the path that was requestedjust_validatingThis method returns true if the request was merely for validation. If this flag is set, then all active actions are validated, but no actions are run.state_variablesReturns an array of all of this request's state variables, as Jifty::Request::StateVariables.state_variable NAMEReturns the Jifty::Request::StateVariable object for the variable named NAME, or undef of there is no such variable.add_state_variable PARAMHASHAdds a state variable to this request's internal representation. Takes a "key" and a "value"; returns the newly-added Jifty::Request::StateVariable.remove_state_variable KEYRemoves the given state variable. The opposite of "add_state_variable", above.clear_state_variablesRemove all the state variables.actionsReturns a list of the actions in the request, as Jifty::Request::Action objects.action MONIKERReturns a Jifty::Request::Action object for the action with the given moniker, or undef if no such action was sent.add_action PARAMHASHRequired argument: "moniker".Optional arguments: "class", "order", "active", "arguments". Adds a Jifty::Request::Action with the given moniker to the request. If the request already contains an action with that moniker, it merges it in, overriding the implementation class, active state, and individual arguments. Returns the newly added Jifty::Request::Action. See Jifty::Action. clear_actionsRemoves all actions from this requestremove_action MONIKERRemoves an action with the given moniker.fragmentsReturns a list of fragments requested, as Jifty::Request::Fragment objects.fragment NAMEReturns the requested fragment with that nameadd_fragment PARAMHASHRequired arguments: "name", "path"Optional arguments: "arguments", "wrapper" Adds a Jifty::Request::Fragment with the given name to the request. If the request already contains a fragment with that name, it merges it in. Returns the newly added Jifty::Request::Fragment. See Jifty::PageRegion. do_mapping PARAMHASHTakes two possible arguments, "request" and "response"; they default to the current Jifty::Request and the current Jifty::Response. Calls "map" in Jifty::Request::Mapper on every argument of this request, pulling arguments and results from the given "request" and "response".is_subrequestReturns true if this request is a subrequest.top_requestReturns the top-level request for this request; if this is a subrequest, this is the user-created request that the handler got originally. Otherwise, returns itself;Jifty::Request::ActionA small package that encapsulates the bits of an action request:moniker [NAME] argument NAME [VALUE] arguments class [CLASS] order [INTEGER] active [BOOLEAN] has_run [BOOLEAN] delete Jifty::Request::StateVariableA small package that encapsulates the bits of a state variable:key value Jifty::Request::FragmentA small package that encapsulates the bits of a fragment request:name [NAME] path [PATH] wrapper [BOOLEAN] in_form [BOOLEAN] argument NAME [VALUE] arguments delete SERIALIZATIONCGI Query parametersThe primary source of Jifty requests through the website are CGI query parameters. These are requests submitted using CGI GET or POST requests to your Jifty application.argument munging In addition to standard Mason argument munging, Jifty also takes arguments with a name of bla=bap|beep=bop|foo=bar and an arbitrary value, and makes them appear as if they were actually separate arguments. The purpose is to allow submit buttons to act as if they'd sent multiple values, without using JavaScript. actions registration For each action, the client sends a query argument whose name is "J:A-moniker" and whose value is the fully qualified class name of the action's implementation class. This is the action "registration." The registration may also take the form "J:A-order-moniker", which also sets the action's run order. arguments The action's arguments are specified with query arguments of the form "J:A:F-argumentname-moniker". To cope with checkboxes and the like (which don't submit anything when left unchecked) we provide a level of fallback, which is checked if the first doesn't exist: "J:A:F:F-argumentname-moniker". state variables State variables are set via "J:V-name" being set to the value of the state parameter. continuations The current continuation set by passing the parameter "J:C", which is set to the id of the continuation. To create a new continuation, the parameter "J:CREATE" is passed. Calling a continuation is a simple as passing "J:CALL" with the id of the continuation to call; this will redirect to the appropriate url, with <J:RETURN> set. request options The existence of "J:VALIDATE" says that the request is only validating arguments. "J:ACTIONS" is set to a exclamation mark separated list of monikers; the actions with those monikers will be marked active, while all other actions are marked inactive. In the absence of "J:ACTIONS", all actions are active. YAML POST Request ProtocolJSON POST Request Protocol
Visit the GSP FreeBSD Man Page Interface. |