You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-dev@jakarta.apache.org by js...@apache.org on 2002/01/29 19:23:04 UTC

cvs commit: jakarta-taglibs/jmstags/xml intro.xml jmstags.xml

jstrachan    02/01/29 10:23:04

  Added:       jmstags  TODO.txt build.properties.sample build.xml
               jmstags/doc/conf web.xml
               jmstags/doc/web Overview.html
               jmstags/examples/conf web.xml
               jmstags/examples/web index.jsp receiveTool.jsp sendTool.jsp
               jmstags/examples/web/test sendMap.jsp sendMap2.jsp
                        sendMessage.jsp sendObject.jsp sendText.jsp
                        sendText2.jsp
               jmstags/jmsimpl Messenger.xml
               jmstags/src/org/apache/taglibs/jms AbstractBodyTag.java
                        AbstractTag.java ConnectionContext.java
                        ConnectionTag.java DestinationTag.java
                        MapEntryTag.java MapMessageTag.java
                        MessageOperationTag.java MessageTag.java
                        ObjectMessageTag.java PropertyTag.java
                        ReceiveTag.java SendTag.java TextMessageTag.java
                        package.html
               jmstags/xml intro.xml jmstags.xml
  Log:
  First checkin of the JMS taglib
  
  Revision  Changes    Path
  1.1                  jakarta-taglibs/jmstags/TODO.txt
  
  Index: TODO.txt
  ===================================================================
  TO DO LIST
  ==========
  
  * Queue browsing?
  
  
  
  1.1                  jakarta-taglibs/jmstags/build.properties.sample
  
  Index: build.properties.sample
  ===================================================================
  #
  # Compile-time dependencies
  #
  
  jms.jar=/java/jms/jms.jar
  
  servlet.jar=/java/servlet/servlet.jar
  
  # jakarta commons-digester.jar
  commons-messenger.jar=../../jakarta-commons/messenger/dist/commons-messenger.jar
  
  
  #
  # Runtime dependencies
  #
  
  # jakarta commons-digester.jar
  commons-digester.jar=../../jakarta-commons/digester/dist/commons-digester.jar
  
  # jakarta commons-collections.jar
  commons-collections.jar=../../jakarta-commons/collections/dist/commons-collections.jar
  
  # jakarta commons-beanutils.jar
  commons-beanutils.jar=../../jakarta-commons/beanutils/dist/commons-beanutils.jar
  
  
  # junit.jar - JUnit 3.2+ Classpath
  junit.jar=/java/junit/junit.jar
  
  # Messenger deployment config to use in tests, defaults to Suns RI
  messenger.xml=jmsimpl/Messenger.xml
  
  # Directory where the JMS implementation JARs reside
  # which are copied to WEB-INF/lib
  jms.lib.dir=jmsimpl/lib
  
  # Directory where the JMS classes or properties files reside 
  # which are copied to WEB-INF/classes
  jms.classes.dir=jmsimpl/classes
  
  
  
  
  1.1                  jakarta-taglibs/jmstags/build.xml
  
  Index: build.xml
  ===================================================================
  <?xml version="1.0"?>
  
  <!DOCTYPE project [
      <!ENTITY common SYSTEM "file:../common.xml">
  ]>
  
  <project name="jmstags" default="main">
  
    <property file="../build.properties"/>
    <property file="build.properties"/>
    <property name="classpath" value="${servlet.jar}:${commons-messenger.jar}:${jms.jar}" />
  
    <property name="checkRequirements.pre" value="checkRequirements.pre"/>
    <property name="examples.pre" value="examples.pre"/>
  
    <target name="checkRequirements.pre">
      <antcall target="checkRequiredFile">
         <param name="file" value="${commons-messenger.jar}"/>
         <param name="fail.message" value="a jar file containing the commons-messenger classes is required to compile the jms taglib. please define the property commons-messenger.jar in your build.properties file and ensure that the file exists"/>
      </antcall>
      <antcall target="checkRequiredFile">
         <param name="file" value="${jms.jar}"/>
         <param name="fail.message" value="a jar file containing the JMS API is required to compile the jms taglib. please define the property jms.jar in your build.properties file and ensure that the file exists"/>
      </antcall>
    </target>
  
  
    <!-- =================================================================== -->
    <!-- copy the required jars into the examples lib dir                    -->
    <!-- =================================================================== -->
  
    <target name="examples.pre">
  
      <!-- copy the jars required -->
      <copy todir="${build.examples}/WEB-INF/lib" file="${commons-messenger.jar}"/>
      <copy todir="${build.examples}/WEB-INF/lib" file="${commons-digester.jar}"/>
      <copy todir="${build.examples}/WEB-INF/lib" file="${commons-beanutils.jar}"/>
      <copy todir="${build.examples}/WEB-INF/lib" file="${commons-collections.jar}"/>
  
      <!-- install the chosen Messenger deployment document -->
      <copy tofile="${build.examples}/WEB-INF/Messenger.xml" file="${messenger.xml}"/>
  
  
      <!-- copy any JMS provider jars and config files -->
  
      <!-- avoid not-exist errors if no properties defined -->
      <mkdir dir="${jms.classes.dir}"/>
      <mkdir dir="${jms.lib.dir}"/>
  
      <copy toDir="${build.examples}/WEB-INF/lib">
        <fileset dir="${jms.lib.dir}"/>
      </copy>
  
      <copy toDir="${build.examples}/WEB-INF/classes">
        <fileset dir="${jms.classes.dir}"/>
      </copy>
    </target>
  
    &common;
  
  </project>
  
  
  
  
  1.1                  jakarta-taglibs/jmstags/doc/conf/web.xml
  
  Index: web.xml
  ===================================================================
  <?xml version="1.0"?>
  <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
  <web-app>
      <display-name>JMS Taglib Documentation</display-name>
      <description>HTML and Javadocs for the JMS tag library.</description>
      <welcome-file-list>
          <welcome-file>index.html</welcome-file>
      </welcome-file-list>
  </web-app>
  
  
  
  1.1                  jakarta-taglibs/jmstags/doc/web/Overview.html
  
  Index: Overview.html
  ===================================================================
  <html>
  
  <head>
  <meta http-equiv="Content-Language" content="en-gb">
  <meta name="GENERATOR" content="Microsoft FrontPage 5.0">
  <meta name="ProgId" content="FrontPage.Editor.Document">
  <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
  <title>New Page 1</title>
  </head>
  
  <body>
  
  <h1>JMS Tags Overview</h1>
  <p>The JMS tag library allows JMS messages to be sent and received from within a JSP 
  page. 
  This allows web developers to use Message Orientated Middleware (MOM) directly from 
  within JSP.</p>
  <h2>Why use JMS in a web application?</h2>
  <p>JMS provides a universal API to all Message Orientated Middleware (MOM) 
  technologies such as MQSeries, MSMQ, TibCo Rendezvous and SpiritWave. MOM 
  provides a number of important features for building web applications.</p>
  <h3>Asynchronous processing</h3>
  <p>Remote Procedure Call (RPC) mechanisms like RMI, CORBA and EJB are 
  predominantly synchronous in nature, a client will block on an RPC call until 
  the server has finished. In MOM systems, asynchronous processing can occur to 
  maximise throughput and reduce latency. </p>
  <p>For example if a web application has a registration page, then a registration 
  message could be sent on a MOM queue so that asynchronously the message can be 
  processed by some back end server. This allows the users online experience to be 
  fast, for them to keep working and navigating the site without blocking, then at 
  some point later the back end can verify the user, add them to the user database 
  and an email can be sent back to the user to confirm.</p>
  <h3>Loosely coupled, connectionless architecture</h3>
  <p>RMI and EJB technologies tend to be connection based so that clients and 
  servers must be running at the same time for the clients to be able to function. 
  If a server is taken down or fails then client side references to remote objects 
  become stale or operations timeout. This can lead to complex application code to 
  detect these kinds of failures and retry operations; usually server failures 
  will cause the clients to fail as well.</p>
  <p>In MOM systems the client and server sides are completely decoupled, there is 
  no direct connection and so both sides can continue to work when the other is 
  not present. At any point the server side can be taken down for maintenance and 
  restarted or relocated without adversely affecting the clients.</p>
  <p>This decoupling also makes it much easier to completely replace a client or 
  server using any technology, language or platform at a later date.</p>
  <h3>Scalability, load balancing and fault tolerance</h3>
  <p>Most MOM implementations implement proper load balancing of messages across 
  consumers (servers); if a server fails then another takes over ensuring proper 
  load balancing and fault tolerance. Few RMI or EJB vendors offer this facility.</p>
  <p>Most MOM implementations have a variety of <i>Quality of Services</i> such as 
  to provide for long-term message persistence when there are no servers available 
  to process the messages, to ensure no message loss. Finally message consumers 
  (servers) can work against the same JMS queue as peers in a cluster so as the 
  load increases more consumers can be run to deal with the load.</p>
  <h2>Common use cases</h2>
  <p>As JSP pages are rendered, its often useful to log information such as what 
  the user is looking at so that other decoupled processes can analyse the 
  information in inference engines, personalization software etc. The JMS tag 
  library makes it very easy to log information at any point a JSP page is 
  rendered.</p>
  <p>Using XML as the format of JMS messages is becoming increasingly common as it 
  provides a language and platform neutral format for data. JSP is particularly 
  good at producing textual mark-up and so is very useful for composing XML 
  centric JMS messages.</p>
  <p>Finally when rendering a JSP page it can often be useful to fire off some 
  asynchronous processing on some back end business logic server, without 
  hampering the users online experience. Sending JMS messages from the web tier is 
  an ideal way to do that, especially if the back end business logic is 
  implemented on some non-Java platform such as .NET or mainframes.</p>
  <h2>JMS tag library deployment</h2>
  <p>The JMS tag library is currently built on top of the
  <a href="http://jakarta.apache.org/commons/messenger.html">Messenger</a> 
  component from <a href="http://jakarta.apache.org/commons/">Jakarta Commons</a>. 
  This provides a simple configuration mechanism using an XML deployment 
  descriptor to configure all of the JMS connections, their factories, JNDI 
  drivers and settings, 
  the quality of service configuration etc. Please refer to the
  <a href="http://jakarta.apache.org/commons/messenger.html">Messenger</a> website 
  for further details of how this configuration should look.</p>
  <p>Essentially your web application should have a Messenger.xml deployment 
  configuration document in the WEB-INF/classes directory or you should explicitly 
  configure Messenger using an initialisation Servlet. In addition all the 
  necessary Messenger jars should be placed in your WEB-INF/lib directory along 
  with any jars required by your JMS provider.</p>
  <h2>Establishing a connection</h2>
  <p>To perform any JMS operation you will need a JMS connection which is used via 
  the Messenger facade. The &lt;jms:connection&gt; tag is used to export a connection. 
  The connection can be exported as a JSP attribute variable for explicit 
  coordination between JSP tags as follows.</p>
  <pre>&lt;jms:connection var=&quot;myConn&quot; name=&quot;topicConnection&quot;/&gt;
  &lt;jms:send connection="$myConn"&gt;
  ...
  &lt;/jms:send&gt;
  </pre>
  <p>Or tags can be nested to provide implicit tag communication which avoids the 
  need to use JSP attributes.</p>
  <pre>&lt;jms:connection name=&quot;topicConnection&quot;/&gt;
    &lt;jms:send&gt;
    ...
    &lt;/jms:send&gt;
  &lt;/jms:connection&gt;
  </pre>
  <p>The <i>name</i> attribute used in the &lt;jms:connection&gt; tag refers to the 
  logical name of the JMS connection in the Messenger.xml deployment document. 
  This allows the exact JMS provider, the quality of service, JNDI provider and so 
  forth to all be changed at deployment time without needing to change your JSP 
  files. So you can start developing your web application using (say) the 
  reference implementation of JMS then at a later date just change your deployment 
  descriptor to switch to a better JMS provider like MQSeries or SpiritWave.</p>
  <h2>Sending a message</h2>
  
  <p>Messages are sent using the &lt;jms:send&gt; tag. This tag requires a <i>connection</i>, 
  <i>destination</i> and <i>message</i> to be specified. These can all be passed in explicitly 
  using tag attributes as follows.</p>
  
  <pre>&lt;jms:connection var=&quot;myConn&quot; name=&quot;topicConnection&quot;/&gt;
  &lt;jms:destination var=&quot;myDest&quot; connection=&quot;$myConn&quot; name=&quot;PRICE.STOCK.IBM&quot;/&gt;
  &lt;jms:message var=&quot;myMsg&quot; connection=&quot;$myConn&quot; type=&quot;PriceChange&quot;/&gt;
  &lt;jms:send connection=&quot;$myConn&quot; destination=&quot;$myDest&quot; message=&quot;$myMsg&quot;/&gt;    	</pre>
  <p>Or tag nesting can be used to specify the connection, destination and 
  message. This more nested implicit approach is simpler to read and less error 
  prone, though does result in more tag nesting. Any of the message tags described 
  below may be nested within a &lt;jms:send&gt; tag.</p>
  <pre>&lt;jms:connection name=&quot;topicConnection&quot;/&gt;
    &lt;jms:send&gt;    	
      &lt;jms:destination&gt;PRICE.STOCK.IBM&lt;/jms:destination&gt;
      &lt;jms:message type=&quot;PriceChange&quot;/&gt;
    &lt;/jms:send&gt;
  &lt;/jms:connection&gt;
  </pre>
  <h2>Message tags</h2>
  <p>JMS provides a variety of Message interfaces which are reflected by the 
  following different message tags. For each message tag the standard JMS header 
  properties are available as tag attributes (such as <i>correlationID</i>, <i>replyTo</i> 
  and <i>type</i>) and user defined header properties can be specified via nested &lt;jms:property&gt; 
  tags.</p>
  <h3>&lt;jms:message&gt;</h3>
  <p>This creates a standard JMS Message which has no body, just the standard and 
  user defined JMS headers properties.</p>
  <pre>&lt;jms:connection name=&quot;topicConnection&quot;/&gt;
    &lt;jms:message var=&quot;myMsg&quot;/&gt;
    &lt;jms:message var=&quot;myMsg2&quot; type=&quot;PriceChange&quot; correlationID=&quot;hello1234&quot;&gt;
      &lt;jms:property name=&quot;foo&quot; value=&quot;$user.name&quot;/&gt;
      &lt;jms:property name=&quot;bar&quot;&gt;some text&lt;/jms:property&gt;
    &lt;/jms:message&gt;
  &lt;/jms:connection&gt;
  </pre>
  <h3>&lt;jms:mapMessage&gt;</h3>
  <p>This creates a standard JMS MapMessage which the body has a number of 
  different entries like a Map or Hashtable in Java. The keys of the MapMessage 
  body must be Strings and the values can be any primitive type like Numbers or 
  Date. The entries in the MapMessage are specified via the &lt;jms:mapEntry&gt; tag.&nbsp;
  </p>
  <pre>&lt;jms:connection name=&quot;topicConnection&quot;/&gt;
    &lt;jms:mapMessage var=&quot;myMsg&quot;&gt;
      &lt;jms:mapEntry name=&quot;foo&quot; value=&quot;$user.birthdate&quot;/&gt;
      &lt;jms:mapEntry name=&quot;bar&quot;&gt;James&lt;/jms:mapEntry&gt;
    &lt;/jms:mapMessage &gt;
  &lt;/jms:connection&gt;
  </pre>
  <p>An alternative is to specify the MapMessage entries via a Map object using 
  the <i>map</i> attribute as follows.&nbsp; </p>
  <pre>&lt;jms:connection name=&quot;topicConnection&quot;/&gt;
    &lt;jms:mapMessage var=&quot;myMsg&quot; map=&quot;$myEntries&quot;/&gt;
  &lt;/jms:connection&gt;
  </pre>
  <h3>&lt;jms:objectMessage&gt;</h3>
  <p>This creates a standard JMS ObjectMessage where the body is any Serializable 
  Java object, which is specified via the <i>body</i> attribute. </p>
  <pre>&lt;jms:connection name=&quot;topicConnection&quot;/&gt;
    &lt;jms:objectMessage var=&quot;myMsg&quot; body=&quot;$user.address&quot;/&gt;
  &lt;/jms:connection&gt;
  </pre>
  <h3>&lt;jms:textMessage&gt;</h3>
  <p>This creates a standard JMS TextMessage where the body is a String. The text 
  can be specified either via the <i>body</i> attribute or by using the content of the 
  &lt;jms:textMessage&gt; tag itself. e.g.. </p>
  <pre>&lt;jms:connection name=&quot;topicConnection&quot;/&gt;
    &lt;jms:textMessage var=&quot;myMsg&quot; body=&quot;this is some text&quot;/&gt;
    &lt;jms:textMessage var=&quot;myMsg2&quot;&gt;This is some more text&lt;/jms:textMessage&gt;
  &lt;/jms:connection&gt;
  </pre>
  <h2>Receiving a message</h2>
  
  <p>The &lt;jms:receive&gt; tag is used to receive messages from some destination. 
  Explicit attributes can be used to specify the connection and destination to 
  use. The JMS Message that is received is exported as a JSP attribute variable, 
  specified via the <i>var</i> attribute.</p>
  
  <pre>&lt;jms:connection var=&quot;myConn&quot; name=&quot;topicConnection&quot;/&gt;
  &lt;jms:destination var=&quot;myDest&quot; connection=&quot;$myConn&quot; name=&quot;PRICE.STOCK.IBM&quot;/&gt;
  &lt;jms:receive var=&quot;newMsg&quot; connection=&quot;$myConn&quot; destination=&quot;$myDest&quot;/&gt;    	</pre>
  <p>Or tag nesting can be used to specify the connection and destination. This 
  more nested implicit approach is simpler to read and less error prone, though 
  does result in more tag nesting.</p>
  <pre>&lt;jms:connection name=&quot;topicConnection&quot;/&gt;
    &lt;jms:receive var=&quot;newMsg&quot;&gt;    	
      &lt;jms:destination&gt;PRICE.STOCK.IBM&lt;/jms:destination&gt;
    &lt;/jms:receive&gt;
  &lt;/jms:connection&gt;
  </pre>
  <p>By default this tag will block until a message is received, which could be 
  for ever. An optional millisecond timeout value can be specified which will 
  cause the tag to return a null Message if the timeout period is reached before a 
  message is received. A timeout value of 0 will avoid any blocking and return a 
  Message if one is available or return null.</p>
  <pre>&lt;jms:connection name=&quot;topicConnection&quot;/&gt;
    &lt;jms:receive var=&quot;newMsg&quot; timeout=&quot;1000&quot;&gt;    	
      &lt;jms:destination&gt;PRICE.STOCK.IBM&lt;/jms:destination&gt;
    &lt;/jms:receive&gt;
  &lt;/jms:connection&gt;</pre>
  <h2>Summary</h2>
  <p>For a detailed look at each tag in turn along with all the attributes it 
  supports, please refer to the tag <a href="index.html#summary">summary</a> or
  <a href="index.html#reference">reference</a>.</p>
  
  </body>
  
  </html>
  
  
  1.1                  jakarta-taglibs/jmstags/examples/conf/web.xml
  
  Index: web.xml
  ===================================================================
  <?xml version="1.0"?>
  <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
  <web-app>
    <display-name>JMS Taglib</display-name>
    <description>A taglib for working with JMS.</description>
  
      <!-- Initialize the Messenger JMS connections -->
    <servlet>
      <servlet-name>InitMessenger</servlet-name>
      <servlet-class>org.apache.commons.messenger.InitMessengerServlet</servlet-class>
      <init-param>
        <param-name>config</param-name>
        <param-value>/WEB-INF/Messenger.xml</param-value>
      </init-param>
      <load-on-startup>1</load-on-startup> 
    </servlet>
  
    <welcome-file-list>
      <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>
  
    <taglib>
      <taglib-uri>http://jakarta.apache.org/taglibs/jms-1.0</taglib-uri>
      <taglib-location>/WEB-INF/jmstags.tld</taglib-location>
    </taglib>
  </web-app>
  
  
  
  1.1                  jakarta-taglibs/jmstags/examples/web/index.jsp
  
  Index: index.jsp
  ===================================================================
  <html>
  <head>
  <title>JMS JSP Taglib</title>
   <link type="text/css" href="examples.css" rel="stylesheet"> 
  </head>
  <body>
  <h1>JMS Taglib</h1>
  
  <p>Welcome to the JMS tag library which makes it easy to use JMS from within JSP.
  Here are some examples
  </p>
  
  <h2>Tools</h2>
  
  <ul>
    <li><a href="sendTool.jsp">send tool</a> allows messages to be sent to a destination</li>
    <li><a href="receiveTool.jsp">receive tool</a> allows text messages to be received from a destination</li>
  </ul>
  
  <h2>Tests</h2>
  
  <ul>
    <li><a href="test/sendMessage.jsp">send Message</a></li>
    <li><a href="test/sendMap.jsp">send MapMessage</a></li>
    <li><a href="test/sendMap2.jsp">send MapMessage #2</a> - uses a Map to specify the MapMessage entries.</li>
    <li><a href="test/sendObject.jsp">send ObjectMessage</a></li>
    <li><a href="test/sendText.jsp">send TextMessage</a></li>
    <li><a href="test/sendText2.jsp">send TextMessage #2</a> - which uses tag body content rather than attributes</li>
  </ul>
  
  
  <hr align="center" width="60%" />
  </body>
  </html>
  
  
  
  1.1                  jakarta-taglibs/jmstags/examples/web/receiveTool.jsp
  
  Index: receiveTool.jsp
  ===================================================================
  <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
  <html>
  <%@ taglib uri="http://jakarta.apache.org/taglibs/jms-1.0" prefix="jms" %>
  <head>
  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  <title>Receive Message Tool</title>
  <link rel="stylesheet" href="examples.css" type="text/css">
  </head>
  <body>
  
  <% 
      String connection = request.getParameter( "connection" );
      if ( connection == null ) {
          connection = "topic";
      }
      String destination = request.getParameter( "destination" );
      if ( destination == null ) {
          destination = "";
      }
      long timeout = -1L;
      String timeoutText = request.getParameter( "timeout" );
      if ( timeoutText != null && timeoutText.length() > 0 ) {
          try {
              timeout = Long.parseLong( timeoutText );
          }
          catch (Exception e) {
          }
      }
      else {
          timeoutText = "";
      }
  %>
  
  
  <h2>Receive JMS Message</h2>
  
  <p>Enter the details to receive</p>
  
  <form METHOD="GET" ACTION="<%= request.getRequestURI() %>">
  
  <table width="100%">
    <tr>
      <td>
        Connection name:
      </td>
      <td>
        <input type="text" name="connection" value="<%= connection %>" size="50"/>
      </td>
    </tr>
    <tr>
      <td>
        Destination: 
      </td>
      <td>
        <input type="text" name="destination" value="<%= destination %>" size="50"/>
      </td>
    </tr>
    <tr>
      <td>
        Timeout (millis): 
      </td>
      <td>
        <input type="text" name="timeout" value="<%= timeoutText %>" size="50"/>
      </td>
    </tr>
    <tr>
      <td colspan="2" align="center">
        <input type="submit" value="Get Message"/>
      </td>
    </tr>
  </table>
  
  </form>
  
  
  
  <hr />
  
  <%
      if (connection.length() > 0 && destination.length() > 0 ) {
  %>
  
  <p>Waiting for message....</p>
  
  <%
        out.flush();
  %>
  
  <jms:connection name="<%= connection %>">
    <jms:receive var="msg" timeout="<%= timeout %>">
      <jms:destination name="<%= destination %>"/>
    </jms:receive>
  </jms:connection>
  
  <p>Received the following message.</p>
  
  <p><%= pageContext.getAttribute( "msg" ) %></p>
  
  <hr />
  
  <%
      }
  %>
  
  </body>
  </html>
  
  
  
  1.1                  jakarta-taglibs/jmstags/examples/web/sendTool.jsp
  
  Index: sendTool.jsp
  ===================================================================
  <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
  <html>
  <%@ taglib uri="http://jakarta.apache.org/taglibs/jms-1.0" prefix="jms" %>
  <head>
  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  <title>Send Message Tool</title>
  <link rel="stylesheet" href="examples.css" type="text/css">
  </head>
  <body>
  
  <% 
      String connection = request.getParameter( "connection" );
      if ( connection == null ) {
          connection = "topic";
      }
      String destination = request.getParameter( "destination" );
      if ( destination == null ) {
          destination = "";
      }
      String text = request.getParameter( "text" );
      if ( text == null ) {
          text = "";
      }
  %>
  
  
  <h2>Send JMS Message</h2>
  
  <p>Enter a text message to send</p>
  
  <form METHOD="GET" ACTION="<%= request.getRequestURI() %>">
  
  <table width="100%">
    <tr>
      <td>
        Connection name:
      </td>
      <td>
        <input type="text" name="connection" value="<%= connection %>" size="50"/>
      </td>
    </tr>
    <tr>
      <td>
        Destination: 
      </td>
      <td>
        <input type="text" name="destination" value="<%= destination %>" size="50"/>
      </td>
    </tr>
    <tr>  
      <td>
        Message text: 
      </td>
      <td>
        <input type="textarea" name="text" value="<%= text %>" size="50"/>
      </td>
    </tr>
    <tr>
      <td colspan="2" align="center">
        <input type="submit" value="Send Message"/>
      </td>
    </tr>
  </table>
  
  </form>
  
  
  
  <hr />
  
  <%
      if (connection.length() > 0 && destination.length() > 0 ) {
  %>
  
  <jms:connection name="<%= connection %>">
    <jms:send>
      <jms:destination name="<%= destination %>"/>
      <jms:textMessage body="<%= text %>"/>
    </jms:send>
  </jms:connection>
  
  <p>Sent message on connection <b><%= connection %></b> and destination <b><%= destination %></b> with the following contents</p>
  
  <p><%= text %></p>
  
  <%
      }
  %>
  
  </body>
  </html>
  
  
  
  1.1                  jakarta-taglibs/jmstags/examples/web/test/sendMap.jsp
  
  Index: sendMap.jsp
  ===================================================================
  <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
  <html>
  <%@taglib uri="http://jakarta.apache.org/taglibs/jms-1.0" prefix="jms" %>
  <body>
  
  <p>About to send a JMS MapMessage</p>
  
  <hr />
  
  <%
      String pizza = "Pizza";
  %>
  
  <jms:connection name="topic">
    <jms:send>
      <jms:destination name="jms/Topic"/>
      <jms:mapMessage type="Order" correlationID="1234">
        <jms:mapEntry name="a" value="<%= pizza %>"/>
        <jms:mapEntry name="b">cheese</jms:mapEntry>
        <jms:mapEntry name="c" value="<%= new Long(1234) %>"/>
      </jms:mapMessage>
    </jms:send>
  </jms:connection>
  
  <p><b>Message sent!</b></p>
  
  </body>
  </html>
  
  
  
  
  
  1.1                  jakarta-taglibs/jmstags/examples/web/test/sendMap2.jsp
  
  Index: sendMap2.jsp
  ===================================================================
  <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
  <html>
  <%@taglib uri="http://jakarta.apache.org/taglibs/jms-1.0" prefix="jms" %>
  <%@page import="java.util.*"%>
  <body>
  
  <p>About to send a JMS MapMessage using a Map to specify the entries</p>
  
  <hr />
  
  <%
      Map entries = new HashMap();
      entries.put( "a", "pizza" );
      entries.put( "b", new Long(1234) );
      entries.put( "c", new Short((short) 45) );
  %>
  
  <jms:connection name="topic">
    <jms:send>
      <jms:destination name="jms/Topic"/>
      <jms:mapMessage type="Order2" correlationID="23456" map="<%= entries %>"/>
    </jms:send>
  </jms:connection>
  
  <p><b>Message sent!</b></p>
  
  </body>
  </html>
  
  
  
  
  
  1.1                  jakarta-taglibs/jmstags/examples/web/test/sendMessage.jsp
  
  Index: sendMessage.jsp
  ===================================================================
  <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
  <html>
  <%@taglib uri="http://jakarta.apache.org/taglibs/jms-1.0" prefix="jms" %>
  <body>
  
  <p>About to send a JMS Message</p>
  
  <hr />
  
  <%
      String topping = "Ham";
  %>
  
  <jms:connection name="topic">
    <jms:send>
      <jms:destination name="jms/Topic"/>
      <jms:message type="Pizza" correlationID="9999">
        <jms:property name="a" value="<%= topping %>"/>
        <jms:property name="b" value="<%= new Long(12345) %>"/>
        <jms:property name="c">cheese</jms:property>
      </jms:message>
    </jms:send>
  </jms:connection>
  
  <p><b>Message sent!</b></p>
  
  </body>
  </html>
  
  
  
  
  
  1.1                  jakarta-taglibs/jmstags/examples/web/test/sendObject.jsp
  
  Index: sendObject.jsp
  ===================================================================
  <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
  <html>
  <%@taglib uri="http://jakarta.apache.org/taglibs/jms-1.0" prefix="jms" %>
  <body>
  
  <p>About to send a JMS ObjectMessage</p>
  
  <hr />
  
  <jms:connection name="topic">
    <jms:send>
      <jms:destination name="jms/Topic"/>
      <jms:objectMessage body="<%= new java.util.Date() %>"  type="Date" correlationID="4321"/>
    </jms:send>
  </jms:connection>
  
  <p><b>Message sent!</b></p>
  
  </body>
  </html>
  
  
  
  
  
  1.1                  jakarta-taglibs/jmstags/examples/web/test/sendText.jsp
  
  Index: sendText.jsp
  ===================================================================
  <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
  <html>
  <%@taglib uri="http://jakarta.apache.org/taglibs/jms-1.0" prefix="jms" %>
  <body>
  
  <p>About to send a JMS text message</p>
  
  <hr />
  
  <jms:connection name="topic">
    <jms:send>
      <jms:destination name="jms/Topic"/>
      <jms:textMessage body="This is some text" type="Chat"/>
    </jms:send>
  </jms:connection>
  
  <p><b>Message sent!</b></p>
  
  </body>
  </html>
  
  
  
  
  
  1.1                  jakarta-taglibs/jmstags/examples/web/test/sendText2.jsp
  
  Index: sendText2.jsp
  ===================================================================
  <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
  <html>
  <%@taglib uri="http://jakarta.apache.org/taglibs/jms-1.0" prefix="jms" %>
  <body>
  
  <p>About to send a JMS text message using tag bodies for the text and destination name</p>
  
  <hr />
  
  <jms:connection name="topic">
    <jms:send>
      <jms:destination>jms/Topic</jms:destination>
      <jms:textMessage>This is some text</jms:textMessage>
    </jms:send>
  </jms:connection>
  
  <p><b>Message sent!</b></p>
  
  </body>
  </html>
  
  
  
  
  
  1.1                  jakarta-taglibs/jmstags/jmsimpl/Messenger.xml
  
  Index: Messenger.xml
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <manager>
  
    <!-- this example Messenger XML config file should work with J2EE SDK -->
    <!-- when running inside of a J2EE container                          -->
  
    <messenger name="topic">
      <jndi lookupName="TopicConnectionFactory">
  <!--
      <jndi lookupName="java:comp/env/TopicConnectionFactory">
  -->
        <property>
          <name>com.sun.jms.internal.java.naming.factory.initial</name>
          <value>com.sun.enterprise.naming.SerialInitContextFactory</value>
        </property>          
      </jndi>
    </messenger>
  
    <messenger name="queue">
      <jndi lookupName="QueueConnectionFactory">
  <!--
      <jndi lookupName="java:comp/env/QueueConnectionFactory">
  -->
        <property>
          <name>com.sun.jms.internal.java.naming.factory.initial</name>
          <value>com.sun.enterprise.naming.SerialInitContextFactory</value>
        </property>          
      </jndi>
    </messenger>
  
  </manager>
  
  
  
  1.1                  jakarta-taglibs/jmstags/src/org/apache/taglibs/jms/AbstractBodyTag.java
  
  Index: AbstractBodyTag.java
  ===================================================================
  /*
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  
  package org.apache.taglibs.jms;
  
  import javax.servlet.jsp.JspException;
  import javax.servlet.jsp.tagext.BodyTagSupport;
  
  /** A useful base class for BodyTags
    *
    * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
    * @version $Revision: 1.1 $
    */
  public abstract class AbstractBodyTag extends BodyTagSupport {
  
      /** Handles non-JspExceptions thrown in this instance
        */
      protected void handleException( Exception e ) throws JspException {
          if ( e instanceof JspException ) {
              throw (JspException) e;
          }
          else {
              pageContext.getServletContext().log( e.getMessage(), e );
              throw new JspException( e.getMessage() );
          }
      }
  }
  
  
  
  1.1                  jakarta-taglibs/jmstags/src/org/apache/taglibs/jms/AbstractTag.java
  
  Index: AbstractTag.java
  ===================================================================
  /*
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  
  package org.apache.taglibs.jms;
  
  import javax.servlet.jsp.JspException;
  import javax.servlet.jsp.tagext.TagSupport;
  
  /** A useful base class for Tags
    *
    * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
    * @version $Revision: 1.1 $
    */
  public class AbstractTag extends TagSupport {
  
      public AbstractTag() {
      }
      
      /** Handles non-JspExceptions thrown in this instance
        */
      protected void handleException( Exception e ) throws JspException {
          if ( e instanceof JspException ) {
              throw (JspException) e;
          }
          else {
              pageContext.getServletContext().log( e.getMessage(), e );
              throw new JspException( e.getMessage() );
          }
      }    
  }
  
  
  
  1.1                  jakarta-taglibs/jmstags/src/org/apache/taglibs/jms/ConnectionContext.java
  
  Index: ConnectionContext.java
  ===================================================================
  /*
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  
  package org.apache.taglibs.jms;
  
  import javax.jms.JMSException;
  import javax.servlet.jsp.JspException;
  
  import org.apache.commons.messenger.Messenger;
  
  /** Represents a context capable of providing a Messenger connection to use
    *
    * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
    * @version $Revision: 1.1 $
    */
  public interface ConnectionContext {
  
      public Messenger getConnection() throws JspException, JMSException;
  }    
  
  
  
  1.1                  jakarta-taglibs/jmstags/src/org/apache/taglibs/jms/ConnectionTag.java
  
  Index: ConnectionTag.java
  ===================================================================
  /*
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  
  package org.apache.taglibs.jms;
  
  import javax.jms.JMSException;
  import javax.servlet.jsp.JspException;
  
  import org.apache.commons.messenger.Messenger;
  import org.apache.commons.messenger.MessengerManager;
  
  /** Defines a JMS connection for use by other JMS tags.
    *
    * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
    * @version $Revision: 1.1 $
    */
  public class ConnectionTag extends AbstractTag implements ConnectionContext {
  
      /** The variable name to create */
      private String var;
          
      /** Stores the name of the map entry */
      private String name;
  
      /** The Messenger */
      private Messenger connection;
  
      // ConnectionContext interface
      //-------------------------------------------------------------------------                    
      public Messenger getConnection() {
          return connection;        
      }
      
      // Tag interface
      //-------------------------------------------------------------------------                    
      public int doStartTag() throws JspException {
          try {
              connection = MessengerManager.get( name );
          }
          catch (JMSException e) {
              throw new JspException( "Could not find JMS Connection named: " + name + ". Reason: " + e, e );
          }
          if ( var != null ) {
              pageContext.setAttribute( var, connection );
          }
          return EVAL_BODY_INCLUDE;
      }
      
      public void release() {
          name = null;
          var = null;
          connection = null;
      }
      
      // Properties
      //-------------------------------------------------------------------------                    
      
      /** Sets the name of the Destination
        */
      public void setName(String name) {
          this.name = name;
      }
      
      /** Sets the variable name to use for the Destination
        */
      public void setVar(String var) {
          this.var = var;
      }
  }
  
  
  
  1.1                  jakarta-taglibs/jmstags/src/org/apache/taglibs/jms/DestinationTag.java
  
  Index: DestinationTag.java
  ===================================================================
  /*
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  
  package org.apache.taglibs.jms;
  
  import javax.jms.Destination;
  import javax.jms.JMSException;
  import javax.servlet.jsp.JspException;
  import javax.servlet.jsp.tagext.BodyContent;
  
  import org.apache.commons.messenger.Messenger;
  
  /** Creates a Destination object from a String name.
    *
    * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
    * @version $Revision: 1.1 $
    */
  public class DestinationTag extends AbstractBodyTag {
  
      /** The variable name to create */
      private String var;
          
      /** Stores the name of the map entry */
      private String name;
          
      // BodyTag interface
      //-------------------------------------------------------------------------                    
      public int doStartTag() throws JspException {
          if ( name != null ) {
              exportDestination();
              return SKIP_BODY;
          }
          return EVAL_BODY_TAG;
      }
      
      public int doAfterBody() throws JspException {
          BodyContent body = getBodyContent();
          name = body.getString();
          body.clearBody();
          exportDestination();
          return EVAL_PAGE;
      }
      
      public void release() {
          name = null;
          var = null;
      }
      
      // Properties
      //-------------------------------------------------------------------------                    
      
      /** Sets the name of the Destination
        */
      public void setName(String name) {
          this.name = name;
      }
      
      /** Sets the variable name to use for the Destination
        */
      public void setVar(String var) {
          this.var = var;
      }
      
      // Implementation methods
      //-------------------------------------------------------------------------                        
      protected void exportDestination() throws JspException {
          try {
              ConnectionContext messengerTag = (ConnectionContext) findAncestorWithClass( this, ConnectionContext.class );
              if ( messengerTag == null ) {
                  throw new JspException("<jms:destination> tag must be within a <jms:connection> or <jms:send> or <jms:receive> tag");
              }
              Messenger messenger = messengerTag.getConnection();
              Destination destination = messenger.getDestination( name );
              if ( var != null ) {
                  pageContext.setAttribute( var, destination );
              }
              else {
                  MessageOperationTag tag = (MessageOperationTag) findAncestorWithClass( this, MessageOperationTag.class );
                  if ( tag == null ) {
                      throw new JspException("<jms:destination> tag must be within a <jms:send> or <jms:receive> tag or the 'var' attribute should be specified");
                  }
                  tag.setDestination( destination );
              }
          }
          catch (JMSException e) {
              throw new JspException( "Failed to create the Destination for: " + name );
          }
      }    
  }
  
  
  
  1.1                  jakarta-taglibs/jmstags/src/org/apache/taglibs/jms/MapEntryTag.java
  
  Index: MapEntryTag.java
  ===================================================================
  /*
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  
  package org.apache.taglibs.jms;
  
  import javax.jms.JMSException;
  import javax.servlet.ServletContext;
  import javax.servlet.jsp.JspException;
  import javax.servlet.jsp.tagext.BodyContent;
  
  /** Adds a map entry to the outer Map Message tag
    *
    * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
    * @version $Revision: 1.1 $
    */
  public class MapEntryTag extends AbstractBodyTag {
  
      /** Stores the name of the map entry */
      private String name;
      
      /** Stores the value of the map entry */
      private Object value;
      
      
      // BodyTag interface
      //-------------------------------------------------------------------------                    
      public int doStartTag() throws JspException {
          if ( value != null ) {
              fireAddMapEntry();
              return SKIP_BODY;
          }
          return EVAL_BODY_TAG;
      }
      
      public int doAfterBody() throws JspException {
          BodyContent body = getBodyContent();
          value = body.getString();
          body.clearBody();
          fireAddMapEntry();
          return EVAL_PAGE;
      }
      
      public void release() {
          name = null;
          value = null;
      }
      
      // Properties
      //-------------------------------------------------------------------------                    
      /** Sets the name of the HTTP header 
        */
      public void setName(String name) {
          this.name = name;
      }
      
      /** Sets the value of the HTTP header. 
        * If no value is set then the body of the tag is used
        */
      public void setValue(Object value) {
          this.value = value;
      }
      
      // Implementation methods
      //-------------------------------------------------------------------------                        
      protected void fireAddMapEntry() throws JspException {
          try {
              MapMessageTag tag = (MapMessageTag) findAncestorWithClass( this, MapMessageTag.class );
              if ( tag == null ) {
                  throw new JspException("<jms:mapEntry> tag must be within a <jms:mapMessage> tag");
              }
              tag.addEntry( name, value );
          }
          catch (JMSException e) {
              throw new JspException( "Failed to set MapMessage entry name: " + name + " value: " + value + ". Reason: " + e, e );
          }
      }
      
  }
  
  
  
  1.1                  jakarta-taglibs/jmstags/src/org/apache/taglibs/jms/MapMessageTag.java
  
  Index: MapMessageTag.java
  ===================================================================
  /*
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  
  package org.apache.taglibs.jms;
  
  import java.util.Iterator;
  import java.util.Map;
  
  import javax.jms.JMSException;
  import javax.jms.Message;
  import javax.jms.MapMessage;
  import javax.servlet.jsp.JspException;
  
  /** Creates a JMS MapMessage
    *
    * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
    * @version $Revision: 1.1 $
    */
  public class MapMessageTag extends MessageTag {
  
      public MapMessageTag() {
      }
  
      public void addEntry(String name, Object value) throws JspException, JMSException {
          MapMessage message = (MapMessage) getMessage();
          message.setObject(name, value);
      }
      
      // Properties
      //-------------------------------------------------------------------------                                
      public void setMap(Map map) throws JspException, JMSException {
          MapMessage message = (MapMessage) getMessage();
          for (Iterator iter = map.entrySet().iterator(); iter.hasNext(); ) {
              Map.Entry entry = (Map.Entry) iter.next();
              String name = entry.getKey().toString();
              Object value = entry.getValue();
              message.setObject(name, value);
          }
      }
      
      // Implementation methods
      //-------------------------------------------------------------------------                            
      protected Message createMessage() throws JspException, JMSException {
          return getConnection().createMapMessage();
      }    
  }    
  
  
  
  1.1                  jakarta-taglibs/jmstags/src/org/apache/taglibs/jms/MessageOperationTag.java
  
  Index: MessageOperationTag.java
  ===================================================================
  /*
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  
  package org.apache.taglibs.jms;
  
  import javax.jms.Destination;
  import javax.jms.JMSException;
  import javax.jms.Message;
  import javax.servlet.jsp.JspException;
  
  import org.apache.commons.messenger.Messenger;
  
  /** An abstract base class for JMS Message operation tags such as send, receive or call.
    *
    * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
    * @version $Revision: 1.1 $
    */
  public abstract class MessageOperationTag extends AbstractTag implements ConnectionContext {
  
      /** The Messenger used to access the JMS connection */
      private Messenger connection;
      
      /** The Destination */
      private Destination destination;
      
      public MessageOperationTag() {
      }
      
      // Tag interface
      //-------------------------------------------------------------------------                    
      public void release() {
          super.release();
          connection = null;
          destination = null;
      }
      
      
      // Properties
      //-------------------------------------------------------------------------                                
      public Messenger getConnection() throws JspException, JMSException {
          if ( connection == null ) {
              return findConnection();
          }
          return connection;
      }
      
      public void setConnection(Messenger connection) {
          this.connection = connection;
      }
      
      public Destination getDestination() {
          return destination;
      }
      
      public void setDestination(Destination destination) {
          this.destination = destination;
      }
  
      // Implementation methods
      //-------------------------------------------------------------------------                            
      protected Messenger findConnection() throws JspException, JMSException {
          ConnectionContext messengerTag = (ConnectionContext) findAncestorWithClass( this, ConnectionContext.class );
          if ( messengerTag == null ) {
              throw new JspException("This tag must be within a <jms:connection> tag or the 'connection' attribute should be specified");
          }
          return messengerTag.getConnection();
      }
  }    
  
  
  
  1.1                  jakarta-taglibs/jmstags/src/org/apache/taglibs/jms/MessageTag.java
  
  Index: MessageTag.java
  ===================================================================
  /*
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  
  package org.apache.taglibs.jms;
  
  import javax.jms.Destination;
  import javax.jms.JMSException;
  import javax.jms.Message;
  import javax.servlet.jsp.JspException;
  
  import org.apache.commons.messenger.Messenger;
  
  /** Creates a JMS message
    *
    * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
    * @version $Revision: 1.1 $
    */
  public class MessageTag extends AbstractTag {
  
      /** The name of the Message variable that is created */
      private String var;    
      
      /** The JMS Message created */
      private Message message;
      
      /** The Messenger used to access the JMS connection */
      private Messenger connection;
      
      public MessageTag() {
      }
      
      /** Adds a JMS property to the message */
      public void addProperty(String name, Object value) throws JspException, JMSException {
          Message message = getMessage();
          message.setObjectProperty(name, value);
      }
      
      // BodyTag interface
      //-------------------------------------------------------------------------                    
      public int doStartTag() throws JspException {
          return EVAL_BODY_INCLUDE;
      }
      
      public int doEndTag() throws JspException {
          try {
              if ( var == null ) {
                  // expose message to parent message consumer
                  SendTag tag = (SendTag) findAncestorWithClass( this, SendTag.class );
                  if ( tag == null ) {
                      throw new JspException("<jms:message> tags must either have the 'var' attribute specified or be used inside a <jms:send> tag");
                  }
                  tag.setMessage( getMessage() );            
              }
              else {
                  pageContext.setAttribute( var, getMessage() );
              }
          }
          catch (JMSException e) {
              throw new JspException( "Failed to create message: " + e, e );
          }
          return EVAL_PAGE;
      }
      
      public void release() {
          super.release();
          var = null;
          connection = null;
          message = null;
      }
      
      
      // Properties
      //-------------------------------------------------------------------------                            
      
      /** Sets the name of the variable that the message will be exported to */
      public void setVar(String var) {
          this.var = var;        
      }
      
      public Messenger getConnection() throws JspException, JMSException {
          if ( connection == null ) {
              return findConnection();
          }
          return connection;
      }
      
      public void setConnection(Messenger connection) {
          this.connection = connection;
      }
      
      public Message getMessage() throws JspException, JMSException {
          if ( message == null ) {
              message = createMessage();
          }
          return message;
      }
      
  
      // JMS related properties
      
      public void setCorrelationID(String correlationID) throws JspException, JMSException {
          getMessage().setJMSCorrelationID(correlationID);
      }
      
      public void setReplyTo(Destination destination) throws JspException, JMSException {
          getMessage().setJMSReplyTo(destination);
      }
      
      public void setType(String type) throws JspException, JMSException {
          getMessage().setJMSType(type);
      }
      
      // Implementation methods
      //-------------------------------------------------------------------------                            
      protected Messenger findConnection() throws JspException, JMSException {
          ConnectionContext messengerTag = (ConnectionContext) findAncestorWithClass( this, ConnectionContext.class );
          if ( messengerTag == null ) {
              throw new JspException("This tag must be within a <jms:connection> tag or the 'connection' attribute should be specified");
          }
          return messengerTag.getConnection();
      }
      
      protected Message createMessage() throws JspException, JMSException {
          return getConnection().createMessage();
      }    
  }    
  
  
  
  1.1                  jakarta-taglibs/jmstags/src/org/apache/taglibs/jms/ObjectMessageTag.java
  
  Index: ObjectMessageTag.java
  ===================================================================
  /*
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  
  package org.apache.taglibs.jms;
  
  import java.io.Serializable;
  
  import javax.jms.JMSException;
  import javax.jms.Message;
  import javax.servlet.jsp.JspException;
  
  /** Creates a JMS ObjectMessage
    *
    * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
    * @version $Revision: 1.1 $
    */
  public class ObjectMessageTag extends MessageTag {
  
      private Serializable body;
      
      public ObjectMessageTag() {
      }
  
      public void release() {
          super.release();
          body = null;
      }
      
      // Properties
      //-------------------------------------------------------------------------                                
      public void setBody(Serializable body) throws JMSException {
          this.body = body;
      }
      
      // Implementation methods
      //-------------------------------------------------------------------------                            
      protected Message createMessage() throws JspException, JMSException {
          return getConnection().createObjectMessage(body);
      }    
  }    
  
  
  
  1.1                  jakarta-taglibs/jmstags/src/org/apache/taglibs/jms/PropertyTag.java
  
  Index: PropertyTag.java
  ===================================================================
  /*
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  
  package org.apache.taglibs.jms;
  
  import javax.jms.JMSException;
  import javax.servlet.jsp.JspException;
  import javax.servlet.jsp.tagext.BodyContent;
  
  /** Defines a property on an outer JMS Message
    *
    * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
    * @version $Revision: 1.1 $
    */
  public class PropertyTag extends AbstractBodyTag {
  
      /** Stores the name of the property */
      private String name;
      
      /** Stores the value of the property */
      private Object value;
      
      
      // BodyTag interface
      //-------------------------------------------------------------------------                    
      public int doStartTag() throws JspException {
          if ( value != null ) {
              fireSetProperty();
              return SKIP_BODY;
          }
          return EVAL_BODY_TAG;
      }
      
      public int doAfterBody() throws JspException {
          BodyContent body = getBodyContent();
          value = body.getString();
          body.clearBody();
          fireSetProperty();
          return EVAL_PAGE;
      }
      
      public void release() {
          name = null;
          value = null;
      }
      
      // Properties
      //-------------------------------------------------------------------------                    
      /** Sets the name of the JMS property
        */
      public void setName(String name) {
          this.name = name;
      }
      
      /** Sets the value of the JMS property. 
        * If no value is set then the body of the tag is used
        */
      public void setValue(Object value) {
          this.value = value;
      }
      
      // Implementation methods
      //-------------------------------------------------------------------------                        
      protected void fireSetProperty() throws JspException {
          try {
              MessageTag tag = (MessageTag) findAncestorWithClass( this, MessageTag.class );
              if ( tag == null ) {
                  throw new JspException("<jms:property> tag must be within a <jms:message> tag");
              }
              tag.addProperty( name, value );
          }
          catch (JMSException e) {
              throw new JspException( "Failed to set Message header property name: " + name + " value: " + value + ". Reason: " + e, e );
          }
      }    
  }
  
  
  
  1.1                  jakarta-taglibs/jmstags/src/org/apache/taglibs/jms/ReceiveTag.java
  
  Index: ReceiveTag.java
  ===================================================================
  /*
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  
  package org.apache.taglibs.jms;
  
  import javax.jms.Destination;
  import javax.jms.JMSException;
  import javax.jms.Message;
  import javax.servlet.jsp.JspException;
  
  /** Receives a JMS message.
    *
    * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
    * @version $Revision: 1.1 $
    */
  public class ReceiveTag extends MessageOperationTag {
  
      private static final long DEFAULT_TIMEOUT = -1L;
      
      private long timeout = DEFAULT_TIMEOUT;
      private String var;
      
      public ReceiveTag() {
      }
      
      // Tag interface
      //-------------------------------------------------------------------------                    
      public int doStartTag() throws JspException {
          return EVAL_BODY_INCLUDE;
      }
      
      public int doEndTag() throws JspException {
          try {
              Destination destination = getDestination();
              if ( destination == null ) {
                  throw new JspException( "No destination specified. Either specify a 'destination' attribute or use a nested <jms:destination> tag" );
              }
              Message message = null;
              if ( timeout > 0 ) {
                  message = getConnection().receive( destination, timeout );
              }
              else if ( timeout == 0 ) {
                  message = getConnection().receiveNoWait( destination );
              }
              else {
                  message = getConnection().receive( destination );
              }
              onMessage( message );
          }
          catch (JMSException e) {
              throw new JspException( "Failed to receive JMS message: " + e, e );
          }
          return EVAL_PAGE;
      }
      
      public void release() {
          super.release();
          timeout = DEFAULT_TIMEOUT;
          var = null;
      }
      
      
      // Properties
      //-------------------------------------------------------------------------                                
      public String getVar() {
          return var;
      }
      
      public void setVar(String var) {
          this.var = var;
      }    
      
      public long getTimeout() {
          return timeout;
      }
      
      public void setTimeout(long timeout) {
          this.timeout = timeout;
      }
      
      // Implementation methods
      //-------------------------------------------------------------------------                            
      
      /** Processes the incoming message */
      protected void onMessage( Message message ) {
          if ( message != null ) {
              pageContext.setAttribute( var, message );
          }
          else {
              pageContext.removeAttribute( var );
          }
      }
  }    
  
  
  
  1.1                  jakarta-taglibs/jmstags/src/org/apache/taglibs/jms/SendTag.java
  
  Index: SendTag.java
  ===================================================================
  /*
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  
  package org.apache.taglibs.jms;
  
  import javax.jms.Destination;
  import javax.jms.JMSException;
  import javax.jms.Message;
  import javax.servlet.jsp.JspException;
  
  /** Sends a JMS message to some destination.
    *
    * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
    * @version $Revision: 1.1 $
    */
  public class SendTag extends MessageOperationTag {
  
      /** The JMS Message to be sent */
      private Message message;
      
      public SendTag() {
      }
          
      // TagTag interface
      //-------------------------------------------------------------------------                    
      public int doStartTag() throws JspException {
          return EVAL_BODY_INCLUDE;
      }
      
      public int doEndTag() throws JspException {
          try {
              Message message = getMessage();
              if ( message == null ) {
                  throw new JspException( "No message specified. Either specify a 'message' attribute or use a nested <jms:message> tag" );
              }
              Destination destination = getDestination();
              if ( destination == null ) {
                  throw new JspException( "No destination specified. Either specify a 'destination' attribute or use a nested <jms:destination> tag" );
              }
              getConnection().send( destination, message );
          }
          catch (JMSException e) {
              throw new JspException( "Failed to send JMS message: " + e, e );
          }
          return EVAL_PAGE;
      }
      
      public void release() {
          super.release();
          message = null;
      }
      
      
      // Properties
      //-------------------------------------------------------------------------                            
      public Message getMessage() {
          return message;
      }
      
      public void setMessage(Message message) {
          this.message = message;
      }
  }    
  
  
  
  1.1                  jakarta-taglibs/jmstags/src/org/apache/taglibs/jms/TextMessageTag.java
  
  Index: TextMessageTag.java
  ===================================================================
  /*
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  
  package org.apache.taglibs.jms;
  
  import javax.jms.JMSException;
  import javax.jms.Message;
  import javax.servlet.jsp.JspException;
  import javax.servlet.jsp.tagext.BodyContent;
  import javax.servlet.jsp.tagext.BodyTag;
  
  /** Creates a JMS TextMessage
    *
    * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
    * @version $Revision: 1.1 $
    */
  public class TextMessageTag extends MessageTag implements BodyTag {
  
      private BodyContent bodyContent;
      private String body;
      
      public TextMessageTag() {
      }
  
      // BodyTag interface
      //-------------------------------------------------------------------------                                
      public void doInitBody() {
      }
  
      public int doStartTag() {
          if ( body != null ) {
              return EVAL_BODY_INCLUDE;
          }
          return EVAL_BODY_BUFFERED;
      }
      
      public int doAfterBody() {
          return SKIP_BODY;
      }
      
      public void setBodyContent(BodyContent bodyContent) {
          this.bodyContent = bodyContent;
      }
      
      public void release() {
          super.release();
          body = null;
          bodyContent = null;
      }
      
      // Properties
      //-------------------------------------------------------------------------                                
      public void setBody(String body) throws JMSException {
          this.body = body;
      }
      
      // Implementation methods
      //-------------------------------------------------------------------------                            
      protected Message createMessage() throws JspException, JMSException {
          String text = (body != null) ? body : bodyContent.getString();
          return getConnection().createTextMessage(text);
      }    
  }    
  
  
  
  1.1                  jakarta-taglibs/jmstags/src/org/apache/taglibs/jms/package.html
  
  Index: package.html
  ===================================================================
  <html>
  <head>
  </head>
  <body>
  
    <p>JSP Custom tags for working with JMS.
    </p>
    
  </body>
  </html>
  
  
  
  1.1                  jakarta-taglibs/jmstags/xml/intro.xml
  
  Index: intro.xml
  ===================================================================
  <?xml version="1.0"?>
  <document url="./intro.xml">
  
    <properties>
      <author>James Strachan</author>
      <title>The Jakarta-Taglibs Project: JMS Tag Library</title>
    </properties>
  
    <body>
  
  
    <section name="JMS Tag Library" href="Welcome">
  
    <p>
    The JMS custom tag library contains tags which can be used to
    perform a variety of JMS related operations such as sending and receiving messages from inside JSP.
    This taglib is currently built on top of the 
    <a href="http://jakarta.apache.org/commons/messenger.html">Messenger</a> component from 
    <a href="http://jakarta.apache.org/commons/">Jakarta Commons</a>. 
    </p>
  
    </section>
  
    <section name="Documentation" href="Documentation">
  
    <p>For more information about the JMS Tag Library, look at the on-line documentation:</p>
    <ul>
    <li>View the <a href="index.html">JMS Taglib Documentation</a></li>
    </ul>
  
    <p>For information on how to use the distributions, look at the following documentation:</p>
  
    <ul>
    <li>Using the Jakarta-Taglibs <a href="http://jakarta.apache.org/taglibs/binarydist.html">Binary Distribution</a></li>
    <li>Using the Jakarta-Taglibs <a href="http://jakarta.apache.org/taglibs/sourcedist.html">Source Distribution</a></li>
    </ul>
  
    </section>
  
    <section name="Download" href="Download">
  
    <p>A binary download of the JMS Tag Library is available</p>
    <ul>
    <li>Download <a href="http://jakarta.apache.org/builds/jakarta-taglibs/nightly/projects/jms/">JMS Tag Library</a></li>
    </ul>
  
    <p>The following distributions are also available for download:</p>
    <ul>
    <li>Download <a href="http://jakarta.apache.org/builds/jakarta-taglibs/nightly/src/">Jakarta-Taglibs Source</a></li>
    <li>Download entire <a href="http://jakarta.apache.org/builds/jakarta-taglibs/nightly">Jakarta-Taglibs Distribution</a></li>
    </ul>
  
    </section>
  
    <section name="Contributors" href="Contributors">
    <p>List of contributors:</p>
  
    <ul>
    <li>James Strachan</li>
    </ul>
  
    </section>
  
    </body>
  </document>
  
  
  
  1.1                  jakarta-taglibs/jmstags/xml/jmstags.xml
  
  Index: jmstags.xml
  ===================================================================
  <?xml version="1.0" ?>
  <document url="./messenger.xml">
  <properties>
    <title>Jakarta Project: JMS Tag Library</title>
    <author>James Strachan</author>
  </properties>
  <taglib>
  
    <tlib-version>1.0</tlib-version>
    <!-- Minimum version of JSP spec required -->
    <jsp-version>1.1</jsp-version>
    <!-- jakarta-taglib name of this tag library -->
    <short-name>jms</short-name>
    <!-- URI of taglib -->
    <uri>http://jakarta.apache.org/taglibs/jms-1.0</uri>
    <!-- The name to use in titles, etc. for the taglib -->
    <display-name>JMS Tag library: Tags for working with JMS</display-name>
  
    <description>
  
    <p>
    The JMS custom tag library contains tags which can be used to
    perform a variety of JMS related operations such as sending and receiving messages from inside JSP.
    </p>
  
    <p>Please refer to the <a href="Overview.html">detailed overview</a> for more details.</p>
  
  </description> 
      
    <!-- The following elements are for JSP 1.2 tag libraries only,
         and are not used for generating documentation yet.
  
    <validator>
  
    </validator>
    <listener>
  
    </listener>
         -->
  
    <!-- The taglib-location is used to fill in the web.xml configuration
         information in the HTML doc. -->
    <taglib-location>/WEB-INF/jms.tld</taglib-location>
                     
    <!-- The prefix is used to fill in the taglib directive
         configuration information in the HTML doc. -->
    <prefix>jms</prefix>
  
  
    <requirements-info>
      This taglib is currently built on top of the 
      <a href="http://jakarta.apache.org/commons/messenger.html">Messenger</a> component from 
      <a href="http://jakarta.apache.org/commons/">Jakarta Commons</a>. 
  
      In addition a JMS implementation is required along with a servlet container
      that supports the JavaServer Pages Specification, version 1.2 or higher.  
    </requirements-info>
  
    <tagtoc name="JMS Tags">
  
      <!-- connection tag -->    
      <tag>
          <name>connection</name>
          <tag-class>org.apache.taglibs.jms.ConnectionTag</tag-class>
          <body-content>JSP</body-content>
          <description>
            Defines a JMS connection facade (Messenger instance) to be used by other JMS tags.
          </description>
          <attribute>
              <name>name</name>
              <required>true</required>
              <rtexprvalue>true</rtexprvalue>
              <description>
                The name of the Messenger connection to use
              </description>
          </attribute>
          <attribute>
              <name>var</name>
              <required>false</required>
              <rtexprvalue>true</rtexprvalue>
              <description>
                The JSP attribute variable that the JMS connection will be output as
              </description>
          </attribute>
          <restrictions>None</restrictions>
          <example><usage>
              <comment>
              </comment>
              <code><![CDATA[
  <jms:connection name="OrderBus" var="myConn"/>
  <jms:send connection="$myConn">
    <jms:destination name="INCOMING.ORDERS"/>
    <jms:message type="NewOrder"/>
  </jms:send>
  
  <jms:connection name="OrderBus">
    <jms:send>
      <jms:destination name="INCOMING.ORDERS"/>
      <jms:message type="NewOrder"/>
    </jms:send>
  </jms:connection>
  ]]></code>
          </usage></example>
      </tag>
  
      <!-- send tag -->    
      <tag>
          <name>send</name>
          <tag-class>org.apache.taglibs.jms.SendTag</tag-class>
          <body-content>JSP</body-content>
          <description>
            Sends a JMS message to some destination. 
            The message and destination can be specified via attributes or via
            child tags as shown in the examples below.
          </description>
          <attribute>
              <name>connection</name>
              <required>false</required>
              <rtexprvalue>true</rtexprvalue>
              <description>
                The JMS connection facade (Messenger instance).
              </description>
          </attribute>
          <attribute>
              <name>destination</name>
              <required>false</required>
              <rtexprvalue>true</rtexprvalue>
              <description>
                The JMS Destination to send the message to
              </description>
          </attribute>
          <attribute>
              <name>message</name>
              <required>false</required>
              <rtexprvalue>true</rtexprvalue>
              <description>
                The JMS Message to send
              </description>
          </attribute>
          <restrictions>None</restrictions>
          <example><usage>
              <comment>
              </comment>
              <code><![CDATA[
  <jms:send connection="$myConnection" destination="$myDest" message="$myMessage"/>
  
  <jms:connection name="OrderBus">
    <jms:send>
      <jms:destination name="INCOMING.ORDERS"/>
      <jms:message type="NewOrder"/>
    </jms:send>
  </jms:connection>
  ]]></code>
          </usage></example>
      </tag>
  
      <!-- receive tag -->    
      <tag>
          <name>receive</name>
          <tag-class>org.apache.taglibs.jms.ReceiveTag</tag-class>
          <body-content>JSP</body-content>
          <description>
            Receives a JMS message from a given destination blocking either forever or
            for a given timeout value until a message is received.
            The destination can be specified via an attribute or via
            a nested &lt;jms:destination&gt; tag as shown in the examples below.
          </description>
          <attribute>
              <name>var</name>
              <required>true</required>
              <rtexprvalue>true</rtexprvalue>
              <description>
                The name of the JSP scope attribute variable which gets defined 
                for the received message
              </description>
          </attribute>
          <attribute>
              <name>connection</name>
              <required>false</required>
              <rtexprvalue>true</rtexprvalue>
              <description>
                The JMS connection facade (Messenger instance).
              </description>
          </attribute>
          <attribute>
              <name>destination</name>
              <required>false</required>
              <rtexprvalue>true</rtexprvalue>
              <description>
                Defines the JMS Destination to use
              </description>
          </attribute>
          <attribute>
              <name>timeout</name>
              <required>false</required>
              <rtexprvalue>true</rtexprvalue>
              <description>
                An optional timeout value in milliseconds for which this tag will wait for a message.
                This timeout value should be greater than or equal to zero.                
  
                If no timeout value is specified then the tag to wait indefinitely until a message arrives.
  
                If a timeout value is specified and no message arrives before the timeout period expires 
                then a null message is returned.
  
                A value of 0 will cause the tag to return immedately (it is equivalent to the receiveNoWait() method in JMS and Messenger).
              </description>
          </attribute>
          <script-variable>No</script-variable>
          <restrictions>None</restrictions>
          <example><usage>
              <comment>
              </comment>
              <code><![CDATA[
  <jms:receive var="msg" connection="$myConnection" destination="$myDest" timeout="1000"/>
  
  <jms:connection name="OrderBus">
    <jms:receive var="msg">
      <jms:destination name="INCOMING.ORDERS"/>
    </jms:receive>
    <jx:expr value="$msg.text"/>
  </jms:connection>
  ]]></code>
          </usage></example>
      </tag>
  
  
      <!-- destination tag -->    
      <tag>
          <name>destination</name>
          <tag-class>org.apache.taglibs.jms.DestinationTag</tag-class>
          <body-content>JSP</body-content>
          <description>
            Defines a JMS Destination to be used by other tags. 
            The name of the destination can either be specified using the 'name' attribute
            or the body content will be taken as being the destination name.
          </description>
          <attribute>
              <name>name</name>
              <required>false</required>
              <rtexprvalue>true</rtexprvalue>
              <description>
                The name of the Destination connection to use, otherwise the body content of
                this tag will be used.
              </description>
          </attribute>
          <attribute>
              <name>var</name>
              <required>false</required>
              <rtexprvalue>true</rtexprvalue>
              <description>
                The JSP attribute variable that the JMS Destination will be output as
              </description>
          </attribute>
          <restrictions>None</restrictions>
          <example><usage>
              <comment>
              </comment>
              <code><![CDATA[
  <jms:destination var="myDest" connection="$myConn" name="SOME.WHERE"/>
  
  <jms:connection name="Prices">
    <jms:destination var="myDest2" name="FOO.BAR.PRICES"/>
  </jms:connection>
  
  <jms:connection name="OrderBus">
    <jms:send>
      <jms:destination name="INCOMING.ORDERS"/>
      <jms:message type="NewOrder"/>
    </jms:send>
  </jms:connection>
  
  <jms:connection name="OrderBus">
    <jms:send>
      <jms:destination>INCOMING.ORDERS</jms:destination>
      <jms:message type="NewOrder"/>
    </jms:send>
  </jms:connection>
  ]]></code>
          </usage></example>
      </tag>
  
  
      <!-- message tag -->    
      <tag>
          <name>message</name>
          <tag-class>org.apache.taglibs.jms.MessageTag</tag-class>
          <body-content>JSP</body-content>
          <description>
            Creates a JMS Message.
          </description>
          <attribute>
              <name>var</name>
              <required>false</required>
              <rtexprvalue>true</rtexprvalue>
              <description>
                The name of the JSP attribute variable that the message will be exported as.
              </description>
          </attribute>
          <attribute>
              <name>connection</name>
              <required>false</required>
              <rtexprvalue>true</rtexprvalue>
              <description>
                The JMS connection facade (Messenger instance).
              </description>
          </attribute>
          <attribute>
              <name>correlationID</name>
              <required>false</required>
              <rtexprvalue>true</rtexprvalue>
              <description>
                The JMS Correlation ID that is to be associated with this message
              </description>
          </attribute>
          <attribute>
              <name>replyTo</name>
              <required>false</required>
              <rtexprvalue>true</rtexprvalue>
              <description>
                The JMS Destination that should be used for replies to this message
              </description>
          </attribute>
          <attribute>
              <name>type</name>
              <required>false</required>
              <rtexprvalue>true</rtexprvalue>
              <description>
                The type of the JMS message. A JMS message can be given a type name to use which maybe used by the
                JMS provider to implement a message type repository.
              </description>
          </attribute>
          <script-variable>No</script-variable>
          <restrictions>None</restrictions>
          <example><usage>
              <comment>
              </comment>
              <code><![CDATA[
  <jms:message var="msg2" connection="$myConn" replyTo="$someDest"/>
  
  <jms:connection name="PurchaseOrders">
    <jms:message var="msg">
      <jms:property name="location" value="London"/>
      <jms:property name="country">England</jms:property>
    </jms:message>
  </jms:connection>
  
  <jms:connection name="PurchaseOrders">
    <jms:message var="msg" type="NewPurchaseOrder" correlationID="1234" replyTo="$myInbox"/>
  </jms:connection>
  ]]></code>
          </usage></example>
      </tag>
  
  
      <!-- mapMessage tag -->    
      <tag>
          <name>mapMessage</name>
          <tag-class>org.apache.taglibs.jms.MapMessageTag</tag-class>
          <body-content>JSP</body-content>
          <description>
            Creates a JMS MapMessage. This tag may contain other &lt;jms:mapEntry&gt; tags or the body
            may be specified via the 'map' attribute.
          </description>
          <attribute>
              <name>var</name>
              <required>false</required>
              <rtexprvalue>true</rtexprvalue>
              <description>
                The name of the JSP attribute variable that the message will be exported as.
              </description>
          </attribute>
          <attribute>
              <name>connection</name>
              <required>false</required>
              <rtexprvalue>true</rtexprvalue>
              <description>
                The JMS connection facade (Messenger instance).
              </description>
          </attribute>
          <attribute>
              <name>correlationID</name>
              <required>false</required>
              <rtexprvalue>true</rtexprvalue>
              <description>
                The JMS Correlation ID that is to be associated with this message
              </description>
          </attribute>
          <attribute>
              <name>replyTo</name>
              <required>false</required>
              <rtexprvalue>true</rtexprvalue>
              <description>
                The JMS Destination that should be used for replies to this message
              </description>
          </attribute>
          <attribute>
              <name>type</name>
              <required>false</required>
              <rtexprvalue>true</rtexprvalue>
              <description>
                The type of the JMS message. A JMS message can be given a type name to use which maybe used by the
                JMS provider to implement a message type repository.
              </description>
          </attribute>
          <attribute>
              <name>map</name>
              <required>false</required>
              <rtexprvalue>true</rtexprvalue>
              <description>
                Specifies a Map of String keys and primitive values to be used as the body of the message.
              </description>
          </attribute>
          <script-variable>No</script-variable>
          <restrictions>None</restrictions>
          <example><usage>
              <comment>
              </comment>
              <code><![CDATA[
  <jms:mapMessage var="msg2" connection="$myConn" map="$myEntries"/>
  
  <jms:connection name="PurchaseOrders">
    <jms:send>
      <jms:destination name="NEW.ORDERS"/>    
      <jms:mapMessage>
        <jms:mapEntry name="x" value="$foo/>
        <jms:mapEntry name="y">some text</jms:mapEntry>
      </jms:mapMessage>
    </jms:send>
  </jms:connection>
  ]]></code>
          </usage></example>
      </tag>
  
      <!-- objectMessage tag -->    
      <tag>
          <name>objectMessage</name>
          <tag-class>org.apache.taglibs.jms.ObjectMessageTag</tag-class>
          <body-content>JSP</body-content>
          <description>
            Creates a JMS ObjectMessage.
          </description>
          <attribute>
              <name>var</name>
              <required>false</required>
              <rtexprvalue>true</rtexprvalue>
              <description>
                The name of the JSP attribute variable that the message will be exported as.
              </description>
          </attribute>
          <attribute>
              <name>connection</name>
              <required>false</required>
              <rtexprvalue>true</rtexprvalue>
              <description>
                The JMS connection facade (Messenger instance).
              </description>
          </attribute>
          <attribute>
              <name>correlationID</name>
              <required>false</required>
              <rtexprvalue>true</rtexprvalue>
              <description>
                The JMS Correlation ID that is to be associated with this message
              </description>
          </attribute>
          <attribute>
              <name>replyTo</name>
              <required>false</required>
              <rtexprvalue>true</rtexprvalue>
              <description>
                The JMS Destination that should be used for replies to this message
              </description>
          </attribute>
          <attribute>
              <name>type</name>
              <required>false</required>
              <rtexprvalue>true</rtexprvalue>
              <description>
                The type of the JMS message. A JMS message can be given a type name to use which maybe used by the
                JMS provider to implement a message type repository.
              </description>
          </attribute>
          <attribute>
              <name>body</name>
              <required>false</required>
              <rtexprvalue>true</rtexprvalue>
              <description>
                The Serializable object used as the body of this JMS ObjectMessage.
              </description>
          </attribute>
          <script-variable>No</script-variable>
          <restrictions>None</restrictions>
          <example><usage>
              <comment>
              </comment>
              <code><![CDATA[
  <jms:objectMessage var="msg2" connection="$myConn" body="$foo"/>
  
  <jms:connection name="PurchaseOrders">
    <jms:send>
      <jms:destination name="NEW.ORDERS"/>    
      <jms:objectMessage body="$foo"/>
    </jms:send>
  </jms:connection>
  ]]></code>
          </usage></example>
      </tag>
  
  
      <!-- textMessage tag -->    
      <tag>
          <name>textMessage</name>
          <tag-class>org.apache.taglibs.jms.TextMessageTag</tag-class>
          <body-content>JSP</body-content>
          <description>
            Creates a JMS TextMessage. The text body of the message can be specified via the 'body' attribute or via the content of this tag.
          </description>
          <attribute>
              <name>var</name>
              <required>false</required>
              <rtexprvalue>true</rtexprvalue>
              <description>
                The name of the JSP attribute variable that the message will be exported as.
              </description>
          </attribute>
          <attribute>
              <name>connection</name>
              <required>false</required>
              <rtexprvalue>true</rtexprvalue>
              <description>
                The JMS connection facade (Messenger instance).
              </description>
          </attribute>
          <attribute>
              <name>correlationID</name>
              <required>false</required>
              <rtexprvalue>true</rtexprvalue>
              <description>
                The JMS Correlation ID that is to be associated with this message
              </description>
          </attribute>
          <attribute>
              <name>replyTo</name>
              <required>false</required>
              <rtexprvalue>true</rtexprvalue>
              <description>
                The JMS Destination that should be used for replies to this message
              </description>
          </attribute>
          <attribute>
              <name>type</name>
              <required>false</required>
              <rtexprvalue>true</rtexprvalue>
              <description>
                The type of the JMS message. A JMS message can be given a type name to use which maybe used by the
                JMS provider to implement a message type repository.
              </description>
          </attribute>
          <attribute>
              <name>body</name>
              <required>false</required>
              <rtexprvalue>true</rtexprvalue>
              <description>
                The String used as the body of this JMS TextMessage.
              </description>
          </attribute>
          <script-variable>No</script-variable>
          <restrictions>None</restrictions>
          <example><usage>
              <comment>
              </comment>
              <code><![CDATA[
  <jms:textMessage var="msg2" connection="$myConn" body="this is some text"/>
  
  <jms:connection name="PurchaseOrders">
    <jms:send>
      <jms:destination name="NEW.ORDERS"/>    
      <jms:textMessage>
        this is some text
      </jms:textMessage>
    </jms:send>
  </jms:connection>
  ]]></code>
          </usage></example>
      </tag>
  
  
      <!-- property tag -->    
      <tag>
          <name>property</name>
          <tag-class>org.apache.taglibs.jms.PropertyTag</tag-class>
          <body-content>JSP</body-content>
          <description>
            Defines a JMS header property which is added to the outer &lt;jms:message&gt; tag.
            The value of the header can be specified via the value attribute 
            otherwise the tags body is used as the value.
          </description>
          <attribute>
              <name>name</name>
              <required>true</required>
              <rtexprvalue>true</rtexprvalue>
              <description>
                Defines the name of the header to set.
              </description>
          </attribute>
          <attribute>
              <name>value</name>
              <required>false</required>
              <rtexprvalue>true</rtexprvalue>
              <description>
                Defines the value of the header. If this attribute is not specified then
                the body of this tag is used instead.
              </description>
          </attribute>
          <script-variable>No</script-variable>
          <restrictions>None</restrictions>
          <example><usage>
              <comment>
              </comment>
              <code><![CDATA[
  <jms:message var="msg">
    <jms:property name="location" value="London"/>
    <jms:property name="country">England</jms:property>
  </jms:message>
  ]]></code>
          </usage></example>
      </tag>
  
      <!-- mapEntry tag -->    
      <tag>
          <name>mapEntry</name>
          <tag-class>org.apache.taglibs.jms.MapEntryTag</tag-class>
          <body-content>JSP</body-content>
          <description>
            Defines an entry in a JMS MapMessage.
          </description>
          <attribute>
              <name>name</name>
              <required>true</required>
              <rtexprvalue>true</rtexprvalue>
              <description>
                Defines the name of the entry.
              </description>
          </attribute>
          <attribute>
              <name>value</name>
              <required>false</required>
              <rtexprvalue>true</rtexprvalue>
              <description>
                Defines the value of the entry. If this attribute is not specified then
                the body of this tag is used instead.
              </description>
          </attribute>
          <script-variable>No</script-variable>
          <restrictions>Should only be used within a &lt;jms:mapMessage&gt; tag</restrictions>
          <example><usage>
              <comment>
              </comment>
              <code><![CDATA[
  <jms:mapMessage var="msg">
    <jms:mapEntry name="x" value="$foo"/>
    <jms:mapEntry name="y">someText</jms:mapEntry>
  </jms:message>
  ]]></code>
          </usage></example>
      </tag>
  
    </tagtoc>
  </taglib>
  
  
  
  <revision release="Initial version" date="20/01/2002">
    <description>Initial check into CVS.
    </description>
  </revision>
  
  </document>
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>