Clover coverage report - ActiveSOAP - 1.0-SNAPSHOT
Coverage timestamp: Wed May 18 2005 17:30:15 BST
file stats: LOC: 61   Methods: 2
NCLOC: 32   Classes: 1
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover
 
 Source file Conditionals Statements Methods TOTAL
EndpointServlet.java 50% 60% 100% 64.3%
coverage coverage
 1   
 /** 
 2   
  * 
 3   
  * Copyright 2004 Protique Ltd
 4   
  * 
 5   
  * Licensed under the Apache License, Version 2.0 (the "License"); 
 6   
  * you may not use this file except in compliance with the License. 
 7   
  * You may obtain a copy of the License at 
 8   
  * 
 9   
  * http://www.apache.org/licenses/LICENSE-2.0
 10   
  * 
 11   
  * Unless required by applicable law or agreed to in writing, software
 12   
  * distributed under the License is distributed on an "AS IS" BASIS, 
 13   
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
 14   
  * See the License for the specific language governing permissions and 
 15   
  * limitations under the License. 
 16   
  * 
 17   
  **/
 18   
 package org.codehaus.activesoap.transport.http;
 19   
 
 20   
 import org.codehaus.activesoap.RestService;
 21   
 
 22   
 import javax.servlet.ServletException;
 23   
 import javax.servlet.http.HttpServlet;
 24   
 import javax.servlet.http.HttpServletRequest;
 25   
 import javax.servlet.http.HttpServletResponse;
 26   
 import java.io.IOException;
 27   
 
 28   
 /**
 29   
  * A Servlet for a REST or SOAP endpoint where some XML is HTTP POSTed and the response is returned.
 30   
  *
 31   
  * @version $Revision: 1.1 $
 32   
  */
 33   
 public class EndpointServlet extends HttpServlet {
 34   
 
 35   
     public static final String SERVICE_ATTRIBUTE = "org.codehaus.activesoap.Service";
 36   
 
 37  8
     protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
 38  8
         response.setContentType("application/soap+xml");
 39  8
         try {
 40  8
             getRestService().invoke(request.getReader(), response.getWriter());
 41   
         }
 42   
         catch (ServletException e) {
 43  0
             throw e;
 44   
         }
 45   
         catch (IOException e) {
 46  0
             throw e;
 47   
         }
 48   
         catch (Exception e) {
 49  0
             throw new ServletException("Failed to process SOAP request: " + e, e);
 50   
         }
 51   
     }
 52   
 
 53  8
     public RestService getRestService() throws ServletException {
 54  8
         RestService service = (RestService) getServletContext().getAttribute(SERVICE_ATTRIBUTE);
 55  8
         if (service == null) {
 56  0
             throw new ServletException("No attribute available for '" + SERVICE_ATTRIBUTE + "'");
 57   
         }
 58  8
         return service;
 59   
     }
 60   
 }
 61