.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32 .\" .\" Standard preamble: .\" ======================================================================== .de Sh \" Subsection heading .br .if t .Sp .ne 5 .PP \fB\\$1\fR .PP .. .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. | will give a .\" real vertical bar. \*(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-|\(bv\*(Tr .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\} .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} .\" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .hy 0 .if n .na .\" .\" 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 "WebUtils 3" .TH WebUtils 3 "2003-07-10" "perl v5.8.8" "User Contributed Perl Documentation" .SH "NAME" AxKit::XSP::WebUtils \- Utilities for building XSP web apps .SH "SYNOPSIS" .IX Header "SYNOPSIS" Add the taglib to AxKit (via httpd.conf or .htaccess): .PP .Vb 1 \& AxAddXSPTaglib AxKit::XSP::WebUtils .Ve .PP Add the \f(CW\*(C`web:\*(C'\fR namespace to your \s-1XSP\s0 \f(CW\*(C` tag: .PP .Vb 5 \& .Ve .PP Then use the tags: .PP .Vb 3 \& \& foo.xsp \& .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" The \s-1XSP\s0 WebUtils taglib implements a number of features for building web applications with \s-1XSP\s0. It makes things like redirects and getting/setting headers simple. .SH "TAG REFERENCE" .IX Header "TAG REFERENCE" All of the below tags allow the parameters listed to be either passed as an attribute (e.g. \f(CW\*(C`), or as a child tag: .PP .Vb 3 \& \& PATH \& .Ve .PP The latter method allows you to use \s-1XSP\s0 expressions for the values. .ie n .Sh """" .el .Sh "\f(CW" .IX Subsection "" Fetch the environment variable specified with the \fBname\fR parameter. .PP .Vb 1 \& Server admin: .Ve .ie n .Sh """" .el .Sh "\f(CW" .IX Subsection "" Returns the current \s-1PATH_INFO\s0 value. .ie n .Sh """" .el .Sh "\f(CW" .IX Subsection "" Returns the current query string .ie n .Sh """" .el .Sh "\f(CW" .IX Subsection "" Returns the requested \s-1URI\s0 minus optional query string .ie n .Sh """" .el .Sh "\f(CW" .IX Subsection "" This tag returns the end-user-visible name of this web service .PP Consider www.example.com on port 80. It is served by a number of machines named \fIabs\fR, \fIlegs\fR, \fIarms\fR, \fIpecs\fR and \fIfoo1\fR, on a diversity of ports. With a proxy server in front that monkies with the headers along the way. It turns out that, while writing a script, people often wonder \*(L"How do I figure out the name of the web service that's been accessed?\*(R". Various hacks with uname, hostname, \s-1HTTP\s0 headers, etc. ensue. This function is the answer to all your problems. .ie n .Sh """" .el .Sh "\f(CW" .IX Subsection "" Returns the server root directory, aka document root. .ie n .Sh """" .el .Sh "\f(CW" .IX Subsection "" This tag allows an \s-1XSP\s0 page to issue a redirect. .PP Parameters (can be attributes or child tags): .IP "uri (required)" 4 .IX Item "uri (required)" The uri to redirect to. .IP "host (optional)" 4 .IX Item "host (optional)" The host to redirect to. .IP "secure (optional)" 4 .IX Item "secure (optional)" Set to \*(L"yes\*(R" if you wish to redirect to a secure (ssl/https) server. .PP Example (uses \s-1XSP\s0 param taglib): .PP .Vb 3 \& \& \& .Ve .ie n .Sh """" .el .Sh "\f(CW" .IX Subsection "" Encode the string using \s-1URL\s0 encoding according to the \s-1URI\s0 specification. .ie n .Sh """" .el .Sh "\f(CW" .IX Subsection "" Decode the \s-1URL\s0 encoded string. .ie n .Sh """" .el .Sh "\f(CW" .IX Subsection "" This tag allows you to get and set \s-1HTTP\s0 headers. .PP Parameters: .IP "name (required)" 4 .IX Item "name (required)" The name of the parameter. If only name is specified, you will \fBget\fR the value of the incoming \s-1HTTP\s0 header of the given name. .IP "value (optional)" 4 .IX Item "value (optional)" If you also specify a value parameter, then the tag will \fBset\fR the outgoing \s-1HTTP\s0 header to the given value. .PP Example: .PP .Vb 3 \&

\& Your browser is: \&

.Ve .ie n .Sh """" .el .Sh "\f(CW" .IX Subsection "" This tag allows you to set the reply status for the client request. .PP Parameters: .IP "code (required)" 4 .IX Item "code (required)" The integer value of a valid \s-1HTTP\s0 status code. .ie n .Sh """" .el .Sh "\f(CW" .IX Subsection "" Returns the name of the authenticated user. .ie n .Sh """" .el .Sh "\f(CW" .IX Subsection "" If the current request is protected by Basic authentication, this tag will return the decoded password sent by the client. .ie n .Sh """" .el .Sh "\f(CW" .IX Subsection "" This tag allows you to get the fully parsed \s-1URI\s0 for the current request. In contrast to the parsed \s-1URI\s0 will always include things like scheme, hostname, or the querystring. .PP Parameters: .IP "omit (optional)" 4 .IX Item "omit (optional)" Valid values: \fBpath\fR, \fBpath_info\fR, and \fBquery\fR. If specified, the corresponding \s-1URL\s0 components will be ommited for the return value. .ie n .Sh """" .el .Sh "\f(CW" .IX Subsection "" This tag allows you to get the fully parsed \s-1URI\s0 for the previous request. This can be useful in 403 error documents where it is required to post login information back to the originally requested \s-1URI\s0. .PP Parameters: .IP "omit (optional)" 4 .IX Item "omit (optional)" Valid values: \fBpath\fR, \fBpath_info\fR, and \fBquery\fR. If specified, the corresponding \s-1URL\s0 components will be ommited for the return value. .PP Example: .PP .Vb 6 \&

Access Denied. Please login

\&
\& \& \& \& ... .Ve .ie n .Sh """" .el .Sh "\f(CW" .IX Subsection "" Returns the \s-1URI\s0 of the previous request minus optional query string .ie n .Sh """" .el .Sh "\f(CW" .IX Subsection "" Returns the query string of the previous request. .ie n .Sh """" .el .Sh "\f(CW" .IX Subsection "" Returns the value of the requested \s-1CGI\s0 parameter of the previous request. .PP Parameters: .IP "name (required)" 4 .IX Item "name (required)" The name of the parameter to be retrieved. .ie n .Sh """" .el .Sh "\f(CW" .IX Subsection "" Returns true if the User Agent pattern in \fBname\fR matches the current User Agent. .PP Parameters: .IP "name (required)" 4 .IX Item "name (required)" A User Agent pattern string to be matched. .PP Example: .PP .Vb 9 \& \& if (!) { \& \&

Sorry, your Web browser is not supported.

\& \& } \& else { \& \& ... .Ve .ie n .Sh """" .el .Sh "\f(CW" .IX Subsection "" Returns true if the current request comes in via \s-1SSL\s0. .PP Example: .PP .Vb 12 \& \& if (!) { \& \& \& \& https:// \& \& use secure connection \& \& \& } \& .Ve .ie n .Sh """" .el .Sh "\f(CW" .IX Subsection "" Returns true if the current request is the first internal request, returns false if the request is a sub-request or an internal redirect. .ie n .Sh """" .el .Sh "\f(CW" .IX Subsection "" Returns the list of variants returned by mod_negotation in case of a 406 \s-1HTTP\s0 status code. Useful for 406 error documents. .PP Example: .PP .Vb 6 \&

406 Not Acceptable

\&

\& An appropriate representation of the requested resource \& could not be found on this server. \&

\& .Ve .ie n .Sh """" .el .Sh "\f(CW" .IX Subsection "" Returns the value of the Apache \*(L"ServerAdmin\*(R" config directive. .ie n .Sh """" .el .Sh "\f(CW" .IX Subsection "" Returns the last 'error\-notes' entry set by Apache. Useful for verbose 500 error documents. .PP Example: .PP .Vb 1 \&

Server Error

.Ve .PP .Vb 4 \&

An error occured. If the problem persists, please contact .

\&

Error Details:
\& \&

.Ve .SH "AUTHOR" .IX Header "AUTHOR" Matt Sergeant, matt@axkit.com .PP Original code by Steve Willer, steve@willer.cc .SH "LICENSE" .IX Header "LICENSE" This software is Copyright 2001 AxKit.com Ltd. .PP You may use or redistribute this software under the terms of either the Perl Artistic License, or the \s-1GPL\s0 version 2.0 or higher.