Coverage Report - org.apache.commons.messagelet.Messagelet
 
Classes in this File Line Coverage Branch Coverage Complexity
Messagelet
0%
0/11
N/A
3
 
 1  
 /*
 2  
  * Copyright (C) The Apache Software Foundation. All rights reserved.
 3  
  *
 4  
  * This software is published under the terms of the Apache Software License
 5  
  * version 1.1, a copy of which has been included with this distribution in
 6  
  * the LICENSE file.
 7  
  * 
 8  
  * $Id: Messagelet.java 155459 2005-02-26 13:24:44Z dirkv $
 9  
  */
 10  
 package org.apache.commons.messagelet;
 11  
 
 12  
 import java.io.IOException;
 13  
 
 14  
 import javax.jms.JMSException;
 15  
 import javax.servlet.GenericServlet;
 16  
 import javax.servlet.ServletException;
 17  
 import javax.servlet.ServletRequest;
 18  
 import javax.servlet.ServletResponse;
 19  
 
 20  
 /** <p><code>Messengerlet</code> the base class for a servlet which processes 
 21  
   * JMS messages via a MessageletRequest and MessageletResponse.</p>
 22  
   *
 23  
   * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
 24  
   * @version $Revision: 155459 $
 25  
   */
 26  0
 public abstract class Messagelet extends GenericServlet {
 27  
 
 28  
     public abstract void service( MessageletRequest request, MessageletResponse response ) 
 29  
         throws IOException, JMSException, ServletException;
 30  
     
 31  
     
 32  
     public void service( ServletRequest req, ServletResponse res ) throws ServletException, IOException {
 33  
         MessageletRequest request;
 34  
         MessageletResponse response;
 35  
         
 36  
     try {
 37  0
         request = (MessageletRequest) req;
 38  0
         response = (MessageletResponse) res;
 39  
             
 40  
     } 
 41  0
         catch (ClassCastException e) {
 42  0
         throw new ServletException("non-Message request or response");
 43  0
     }
 44  
         
 45  
         try {
 46  0
             service(request, response);
 47  
         }
 48  0
         catch (JMSException e) {
 49  0
             throw new ServletException(e);
 50  0
         }
 51  0
     }
 52  
 }