Jakarta Project: IO Tag library

Version: 1.0

Table of Contents

Overview
Requirements
Configuration
Tag Summary
Tag Reference
Examples
Javadocs
Revision History

Overview

The IO library allows URLs and HTTP requests to be performed using JSP custom tags. This allows JSP to be used to perform HTTP GETs or PUT operations and to make XML-RPC and SOAP requests.

Requirements

This custom tag library requires no software other than a servlet container that supports the JavaServer Pages Specification, version 1.1 or higher.

Configuration

Follow these steps to configure your web application with this tag library:

To use the tags from this library in your JSP pages, add the following directive at the top of each page:

<%@ taglib uri="http://jakarta.apache.org/taglibs/io-1.0" prefix="http" %>

where "http" is the tag name prefix you wish to use for tags from this library. You can change this value to any prefix you like.

Tag Summary

pipe Acts like a Unix pipe between tags that are not capable of piping themselves. A pipe can take some input or some output or both. If no input is specified then its body content is used. If no output is specified then the current output is used.
set Sets the property on its parent tag. Either the body of this tag is used as the value or a PipeConsumer can be included in my body.
get Returns the bean or bean property and pipes it into its parent PipeConsumer tag.
request Requests the content of the given URL.
http Performs a HTTP request on the given URL with the specified action and optional body. If no action is specified then it defaults to "GET".
header Defines a URL / HTTP header for the current request tag. The value of the header can be specified as an attribute otherwise the value of the tags body is taken instead.
param Defines a query argument for the URL of the current request. The value of the parameter can be specified as an attribute otherwise the value of the tags body is taken instead.
soap Performs a HTTP SOAP request on the given URL, SOAPAction and body.
xmlrpc Performs an XML RPC request on the given URL.
 

Tag Reference

pipeAvailability: version 1.0
Acts like a Unix pipe between tags that are not capable of piping themselves. A pipe can take some input or some output or both. If no input is specified then its body content is used. If no output is specified then the current output is used.
 
Tag Classorg.apache.taglibs.io.PipeTag
Tag BodyJSP
Script VariableNo
Restrictions
Attributes 
 
NameRequiredRuntime Expression Evaluation
pipeInputfalsetrue
pipeOutputfalsetrue
Example
  1. <%-- --%>

    <io:pipe input="<%= request.getReader() %>"/>

setAvailability: version 1.0
Sets the property on its parent tag. Either the body of this tag is used as the value or a PipeConsumer can be included in my body.
 
Tag Classorg.apache.taglibs.io.SetTag
Tag BodyJSP
Script VariableNo
Restrictions
Attributes 
 
NameRequiredRuntime Expression Evaluation
propertytruetrue
pipeInputfalsetrue
Example
  1. <%-- --%>

    <io:set name="url">some text with mixed tags & expressions</io:set>

getAvailability: version 1.0
Returns the bean or bean property and pipes it into its parent PipeConsumer tag.
 
Tag Classorg.apache.taglibs.io.GetTag
Tag BodyJSP
Script VariableNo
Restrictions
Attributes 
 
NameRequiredRuntime Expression Evaluation
nametruetrue
propertyfalsetrue
Example
  1. <%-- --%>

    <io:get name="something" property"bar"/>

requestAvailability: version 1.0
Requests the content of the given URL.
 
Tag Classorg.apache.taglibs.io.URLTag
Tag BodyJSP
Script Variable
RestrictionsNone
Attributes 
 
NameRequiredRuntime Expression Evaluation
urltruetrue
outputfalsetrue
Example
  1. <%-- --%>

    <io:url url="/WEB-INF/foo.xml"/>

httpAvailability: version 1.0
Performs a HTTP request on the given URL with the specified action and optional body. If no action is specified then it defaults to "GET".
 
Tag Classorg.apache.taglibs.io.HttpTag
Tag BodyJSP
Script VariableNo
RestrictionsNone
Attributes 
 
NameRequiredRuntime Expression Evaluation
urltruetrue
actionfalsetrue
Example
  1. <%-- --%>

    <io:http url="http://jakarta.apache.org" action="GET"/>

headerAvailability: version 1.0
Defines a URL / HTTP header for the current request tag. The value of the header can be specified as an attribute otherwise the value of the tags body is taken instead.
 
Tag Classorg.apache.taglibs.io.URLHeaderTag
Tag BodyJSP
Script VariableNo
RestrictionsNone
Attributes 
 
NameRequiredRuntime Expression Evaluation
nametruetrue
valuefalsetrue
Example
  1. <%-- --%>

    <io:http url="http://jakarta.apache.org" action="GET"/> <io:header name="Content-Type" value="text/xml"/> </io:http>

paramAvailability: version 1.0
Defines a query argument for the URL of the current request. The value of the parameter can be specified as an attribute otherwise the value of the tags body is taken instead.
 
Tag Classorg.apache.taglibs.io.URLParameterTag
Tag BodyJSP
Script VariableNo
RestrictionsMust be specified before any <http:header> or <http:body> tags
Attributes 
 
NameRequiredRuntime Expression Evaluation
nametruetrue
valuefalsetrue
Example
  1. <%-- --%>

    <io:http url="http://jakarta.apache.org" action="GET"/> <io:header name="Content-Type" value="text/xml"/> </io:http>

soapAvailability: version 1.0
Performs a HTTP SOAP request on the given URL, SOAPAction and body.
 
Tag Classorg.apache.taglibs.io.HttpSoapTag
Tag BodyJSP
Script VariableNo
RestrictionsNone
Attributes 
 
NameRequiredRuntime Expression Evaluation
urltruetrue
SOAPActiontruetrue
Example
  1. <%-- --%>

    <io:soap url="http://services.xmethods.net:80/perl/soaplite.cgi" SOAPAction="urn:xmethodsBabelFish#BabelFish"> <io:body> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <SOAP-ENV:Body> <m:BabelFish xmlns:m="urn:xmethodsBabelFish"> <translationmode>en_fr</translationmode> <sourcedata>SOAP is quite easy with JSP.</sourcedata> </m:BabelFish> </SOAP-ENV:Body> </SOAP-ENV:Envelope> </io:body> </io:soap>

xmlrpcAvailability: version 1.0
Performs an XML RPC request on the given URL.
 
Tag Classorg.apache.taglibs.io.XmlRpcTag
Tag BodyJSP
Script VariableNo
RestrictionsNone
Attributes 
 
NameRequiredRuntime Expression Evaluation
urltruetrue
userAgentfalsetrue
Example
  1. <%-- --%>

    <io:xmlrpc url="/RPC2"> <io:body> <?xml version="1.0"?> <methodCall> <methodName>examples.getStateName</methodName> <params> <param> <value><i4>41</i4></value> </param> </params> </methodCall> </io:body> </io:xmlrpc>

Examples

See the example application io-examples.war for examples of the usage of the tags from this custom tag library.

Java Docs

Java programmers can view the java class documentation for this tag library as javadocs.

Revision History

Review the complete revision history of this tag library.