Jumpi v1.2.0

org.jumpi.impl.servlet.jmsbridge
Class HttpJmsBridgeServlet

java.lang.Object
  |
  +--javax.servlet.GenericServlet
        |
        +--javax.servlet.http.HttpServlet
              |
              +--org.jumpi.impl.servlet.jmsbridge.HttpJmsBridgeServlet
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class HttpJmsBridgeServlet
extends javax.servlet.http.HttpServlet

A HTTP to JMS Bridge Servlet. HTTP requests are converted into JMS requests and the synchronous reply to the JMS requests are returned as the HTTP synchronous response. The Servlet handles both HTTP GET and POST requests. The HTTP request content type must be 'application/x-www-form-urlencoded' or 'plain/text' where each line donates a new key or value. HTTP request parameters and values form a Hashtable of key value pairs which are sent via Jumpi. The parameter 'jms.queue.name' provided by the HTTP requestor is used as the Destination Queue for the request. This enables a calling client to determine the queue for sending the request to dynamically. Backend services can be provided on different JMS Queues. The JMS response expected is a also a Hashtable of key-value String pairs. The response is provided as a HTTP plain text response, where each key and value are line separated.

See Also:
Serialized Form

Field Summary
static java.lang.String PROPERTY_APPLICATION_CLASSNAME
          The property indicating the classname of embedded applications.
static java.lang.String PROPERTY_CACHE_GET_TIMEOUT
          The maximum time in millis that a servlet Thread will wait to get a Jumpi instance to use for the request from the cache.
static java.lang.String PROPERTY_CACHE_SIZE
          The number of concurrent Jumpi instances availible to servlet Threads.
static java.lang.String PROPERTY_DEBUG
          The property indicating whether to provide debug output.
static java.lang.String PROPERTY_JMS_QUEUE_NAME
          The property indicating which JMS queue to use for the request.
static java.lang.String PROPERTY_JMS_TTL
          The property indicating how long the TTL of the request is.
 
Constructor Summary
HttpJmsBridgeServlet()
           
 
Method Summary
 void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Service a HTTP GET request.
 void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Service a HTTP POST request.
protected  void doWork(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           Service either a HTTP GET or POST request.
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROPERTY_CACHE_SIZE

public static final java.lang.String PROPERTY_CACHE_SIZE
The number of concurrent Jumpi instances availible to servlet Threads. Value: cache.size.

See Also:
Constant Field Values

PROPERTY_CACHE_GET_TIMEOUT

public static final java.lang.String PROPERTY_CACHE_GET_TIMEOUT
The maximum time in millis that a servlet Thread will wait to get a Jumpi instance to use for the request from the cache. Value: cache.get.timeout.

See Also:
Constant Field Values

PROPERTY_JMS_QUEUE_NAME

public static final java.lang.String PROPERTY_JMS_QUEUE_NAME
The property indicating which JMS queue to use for the request. Value: jms.queue.name.

See Also:
Constant Field Values

PROPERTY_JMS_TTL

public static final java.lang.String PROPERTY_JMS_TTL
The property indicating how long the TTL of the request is. Value: jms.ttl.

See Also:
Constant Field Values

PROPERTY_APPLICATION_CLASSNAME

public static final java.lang.String PROPERTY_APPLICATION_CLASSNAME
The property indicating the classname of embedded applications. Value: application.classname.

See Also:
Constant Field Values

PROPERTY_DEBUG

public static final java.lang.String PROPERTY_DEBUG
The property indicating whether to provide debug output. Value: debug.

See Also:
Constant Field Values
Constructor Detail

HttpJmsBridgeServlet

public HttpJmsBridgeServlet()
Method Detail

doGet

public void doGet(javax.servlet.http.HttpServletRequest request,
                  javax.servlet.http.HttpServletResponse response)
           throws java.io.IOException,
                  javax.servlet.ServletException
Service a HTTP GET request.

Overrides:
doGet in class javax.servlet.http.HttpServlet
Parameters:
request - the HTTP request.
response - the HTTP response.
Throws:
java.io.IOException - if any IO related failure occurs.
javax.servlet.ServletException - if any failure condition occurs.
See Also:
doWork(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)

doPost

public void doPost(javax.servlet.http.HttpServletRequest request,
                   javax.servlet.http.HttpServletResponse response)
            throws java.io.IOException,
                   javax.servlet.ServletException
Service a HTTP POST request.

Overrides:
doPost in class javax.servlet.http.HttpServlet
Parameters:
request - the HTTP request.
response - the HTTP response.
Throws:
java.io.IOException - if any IO related failure occurs.
javax.servlet.ServletException - if any failure condition occurs.
See Also:
doWork(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)

doWork

protected void doWork(javax.servlet.http.HttpServletRequest request,
                      javax.servlet.http.HttpServletResponse response)
               throws java.io.IOException,
                      javax.servlet.ServletException

Service either a HTTP GET or POST request. Any parameters are decoded into a Hashtable and sent via Jumpi's JMS to a JMS replyer-like replyer application. The response is synchronously received and the response Hashtable's key-value pairs are provided in the response as line separated plain text.

A cache of Jumpi instances is established on the first call.

Parameters:
request - the HTTP request.
response - the HTTP response.
Throws:
java.io.IOException - if any IO related failure occurs.
javax.servlet.ServletException - if any failure condition occurs.

Jumpi v1.2.0

Copyright 2003, Peter Jonathan Klauser.