Jakarta Project: HTTP Tag library

Version: 1.0

Table of Contents

Overview
Requirements
Configuration
Tag Summary
Tag Reference
Examples
Javadocs
Revision History

Overview

The HTTP tag library allows HTTP requests to be performed using JSP custom tags. This allows JSP to be used to perform HTTP GETs or PUT operations for example to make 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/http-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

requestPerforms a HTTP request on the given URL with the specified action and optional body.
headerDefines a HTTP header for the current HTTP request tag.
bodyDefines the HTTP body for the current HTTP request tag.
 

Tag Reference

requestAvailability: version 1.0
Performs a HTTP request on the given URL with the specified action and optional body.
 
Tag Classorg.apache.taglibs.http.HttpRequestTag
Tag BodyJSP
Script VariableNo
RestrictionsNone
Attributes 
 
NameRequiredRuntime Expression Evaluation
urltruetrue
actiontruetrue
Example
  1. <%-- --%>

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

headerAvailability: version 1.0
Defines a HTTP header for the current HTTP request tag.
 
Tag Classorg.apache.taglibs.http.HttpHeaderTag
Tag Bodynone
Script VariableNo
RestrictionsNone
Attributes 
 
NameRequiredRuntime Expression Evaluation
nametruetrue
valuefalsetrue
Example
  1. <%-- --%>

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

bodyAvailability: version 1.0
Defines the HTTP body for the current HTTP request tag.
 
Tag Classorg.apache.taglibs.http.HttpBodyTag
Tag BodyJSP
Script VariableNo
RestrictionsNone
AttributesNone
Example
  1. <%-- --%>

    <http:request url="http://services.xmethods.net:80/perl/soaplite.cgi" action="POST"> <http:header name="SOAPAction" value="urn:xmethodsBabelFish#BabelFish"/> <http:header name="Content-Type" value="text/xml"/> <http: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> </http:body> </http:request>

Examples

See the example application http-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.