.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.16) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .ie \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} .el \{\ . de IX .. .\} .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "Jifty::Manual::RequestHandling 3pm" .TH Jifty::Manual::RequestHandling 3pm "2010-12-08" "perl v5.14.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Jifty::Manual::RequestHandling \- Jifty's request handling process .SH "DESCRIPTION" .IX Header "DESCRIPTION" This document outlines some of Jifty's inside in order to help you to understand what happens during the request processing phase. .SH "THE HANDLER" .IX Header "THE HANDLER" As soon as a \s-1HTTP\s0 request (whatever the method might be, like \s-1GET\s0, \&\s-1POST\s0, \s-1PUT\s0, ...) arrives at Jifty's border, the request is forwarded to a handler. By default, \f(CW\*(C`Jifty\->handler\*(C'\fR points to a Jifty::Handler object that is responsible for handling an incoming request. The handler receives a \s-1CGI\s0 object on which it operates. .SS "The major steps in the request handling process are:" .IX Subsection "The major steps in the request handling process are:" .IP "refresh eventually modified modules in develop mode" 4 .IX Item "refresh eventually modified modules in develop mode" This allows a perl developer to change perl modules being used in a Jifty application without the need to restart the server which would otherwise become necessary. This is never done on a live environment. .IP "build a stash" 4 .IX Item "build a stash" The stash is a storage area that can be reached by simply accessing \&\f(CW\*(C`Jifty\->handler\->stash\->{some_key}\*(C'\fR. The stash will start fresh with every request and lives for the entire lifetime of a request. Using the stash, transporting data between otherwise unconnected modules will become possible. .IP "construct a request and response object" 4 .IX Item "construct a request and response object" Using the \s-1CGI\s0 object, a Jifty::Request object is constructed and its data is populated with the \s-1CGI\s0 object's data. The request can be reached later using \f(CW\*(C`Jifty\->web\->request\*(C'\fR. The request holds information about all actions involved, all page fragments, contains state variables and arguments (usually \s-1GET/POST\s0 parameters). .Sp Also, an empty Jifty::Response object is constructed that contains one or more Jifty::Result objects, each of which holds one Jifty::Action's result. The response object can be retrieved with the \f(CW\*(C`Jifty\->web\->response\*(C'\fR method. .IP "setup plugins" 4 .IX Item "setup plugins" For every registered Jifty::Plugin, some kind of per-request initialization is performed allowing the actions provided by each plugin to run. .IP "handle static content" 4 .IX Item "handle static content" If the requested \s-1URI\s0 points to some existing static content being housed in a \f(CW\*(C`static\*(C'\fR directory, this content is handled. .IP "setup the session" 4 .IX Item "setup the session" Based on a cookie that is sent with every \s-1HTTP\s0 response, the current user is assigned a unique session. The session is stored in a Jifty::Web::Session object and can be accessed using the \&\f(CW\*(C`Jifty\->web\->session\*(C'\fR method. .IP "return from a continuation if requested" 4 .IX Item "return from a continuation if requested" If there is an open continuation on the stack (e.g. from a \&\f(CW\*(C`Jifty\->web\->tangent\*(C'\fR link) and the return has been requested (e.g. by a \f(CW\*(C`Jifty\->web\->return\*(C'\fR link), the return will execute at this stage. .IP "handle dynamic request unless already served" 4 .IX Item "handle dynamic request unless already served" First, the user is given a cookie containing the session-id. Then, the request is forwarded to \f(CW\*(C`Jifty\->handler\->dispatcher\*(C'\fR, a Jifty::Dispatcher object to handle the request. The dispatcher works through the following steps: .RS 4 .IP "setup" 4 .IX Item "setup" In this stage, all rules in the dispatcher that are marked with the word \f(CW\*(C`before\*(C'\fR are run. .IP "run the actions involved" 4 .IX Item "run the actions involved" Every Jifty::Action that is registered in a form or involved in a link or button is run in this stage. .IP "run dispatching rules" 4 .IX Item "run dispatching rules" This stage is responsible for working through all rules marked by words like \f(CW\*(C`under\*(C'\fR, \f(CW\*(C`on\*(C'\fR, \f(CW\*(C`when\*(C'\fR and so on. This is a point where based on the \s-1URI\s0 or parameters the template to get displayed may still be modified, data get retrieved, additional actions run or the template's parameters get adjusted. .IP "show the page" 4 .IX Item "show the page" Here, the template displaying the page is run. .IP "cleanup" 4 .IX Item "cleanup" This final stage of the dispatcher will run all rules marked with the word \f(CW\*(C`after\*(C'\fR. .RE .RS 4 .RE .IP "cleanup several things" 4 .IX Item "cleanup several things" Finally, the eventually modified session-record is flushed and some internally allocated structures get deallocated. .SH "SEE ALSO" .IX Header "SEE ALSO" Jifty::Handler, Jifty::Dispatcher, Jifty::Request, Jifty::Response