Clover coverage report - ActiveSOAP - 1.0-SNAPSHOT
Coverage timestamp: Wed May 18 2005 17:30:15 BST
file stats: LOC: 69   Methods: 4
NCLOC: 35   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
HttpTransportConnector.java - 85.7% 75% 83.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   
 import org.codehaus.activesoap.transport.TransportConnector;
 22   
 import org.mortbay.http.HttpContext;
 23   
 import org.mortbay.http.SocketListener;
 24   
 import org.mortbay.jetty.Server;
 25   
 import org.mortbay.jetty.servlet.ServletHandler;
 26   
 
 27   
 import java.net.UnknownHostException;
 28   
 
 29   
 
 30   
 /**
 31   
  * An embedded Servlet engine to implement a HTTP transport connector
 32   
  *
 33   
  * @version $Revision: 1.3 $
 34   
  */
 35   
 public class HttpTransportConnector extends TransportConnector {
 36   
 
 37   
     private SocketListener listener = new SocketListener();
 38   
     private Server server = new Server();
 39   
     private RestService service;
 40   
 
 41  8
     public HttpTransportConnector(String host, int port, RestService service) throws UnknownHostException {
 42  8
         listener = new SocketListener();
 43  8
         listener.setHost(host);
 44  8
         listener.setPort(port);
 45  8
         this.service = service;
 46   
     }
 47   
 
 48  0
     public HttpTransportConnector(SocketListener listener, RestService service) {
 49  0
         this.listener = listener;
 50  0
         this.service = service;
 51   
     }
 52   
 
 53  8
     public void start() throws Exception {
 54  8
         server.addListener(listener);
 55   
 
 56  8
         HttpContext context = server.addContext("/");
 57  8
         ServletHandler handler = new ServletHandler();
 58  8
         handler.addServlet("soapServlet", "/*", EndpointServlet.class.getName());
 59  8
         context.addHandler(handler);
 60  8
         context.setAttribute("org.codehaus.activesoap.Service", service);
 61  8
         server.start();
 62   
     }
 63   
 
 64  6
     public void stop() throws Exception {
 65  6
         server.stop();
 66   
     }
 67   
 
 68   
 }
 69