AxKit::XSP::WebUtils - Utilities for building XSP web apps


AxKit::XSP::WebUtils - Utilities for building XSP web apps


Add the taglib to AxKit (via httpd.conf or .htaccess):

    AxAddXSPTaglib AxKit::XSP::WebUtils

Add the web: namespace to your XSP <xsp:page> tag:


Then use the tags:



The XSP WebUtils taglib implements a number of features for building web applications with XSP. It makes things like redirects and getting/setting headers simple.


All of the below tags allow the parameters listed to be either passed as an attribute (e.g. <web:env_param name="PATH">), or as a child tag:


The latter method allows you to use XSP expressions for the values.

<web:env_param name="..." />

Fetch the environment variable specified with the name parameter.

  <b>Server admin: <web:env_param name="SERVER_ADMIN"/></b>


Returns the current PATH_INFO value.


Returns the current query string


Returns the full URI of the current request


This tag returns the end-user-visible name of this web service

Consider on port 80. It is served by a number of machines named abs, legs, arms, pecs and foo1, 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 ``How do I figure out the name of the web service that's been accessed?''. Various hacks with uname, hostname, HTTP headers, etc. ensue. This function is the answer to all your problems.


Returns the server root directory, aka document root.


This tag allows an XSP page to issue a redirect.

Parameters (can be attributes or child tags):

uri (required)
The uri to redirect to.

host (optional)
The host to redirect to.

secure (optional)
Set to ``yes'' if you wish to redirect to a secure (ssl/https) server.

Example (uses XSP param taglib):

  <web:redirect secure="yes">

<web:url_encode string="..."/>

Encode the string using URL encoding according to the URI specification.

<web:url_decode string="..."/>

Decode the URL encoded string.


This tag allows you to get and set HTTP headers.


name (required)
The name of the parameter. If only name is specified, you will get the value of the incoming HTTP header of the given name.

value (optional)
If you also specify a value parameter, then the tag will set the outgoing HTTP header to the given value.


  Your browser is: <web:header name="HTTP_USER_AGENT"/>


Matt Sergeant,

Original code by Steve Willer,


This software is Copyright 2001 Ltd.

You may use or redistribute this software under the terms of either the Perl Artistic License, or the GPL version 2.0 or higher.

 AxKit::XSP::WebUtils - Utilities for building XSP web apps