Coverage Report - org.kuali.rice.ksb.messaging.servlet.CXFServletControllerAdapter
 
Classes in this File Line Coverage Branch Coverage Complexity
CXFServletControllerAdapter
0%
0/8
N/A
1
 
 1  
 /**
 2  
  * Copyright 2005-2011 The Kuali Foundation
 3  
  *
 4  
  * Licensed under the Educational Community License, Version 2.0 (the "License");
 5  
  * you may not use this file except in compliance with the License.
 6  
  * You may obtain a copy of the License at
 7  
  *
 8  
  * http://www.opensource.org/licenses/ecl2.php
 9  
  *
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13  
  * See the License for the specific language governing permissions and
 14  
  * limitations under the License.
 15  
  */
 16  
 package org.kuali.rice.ksb.messaging.servlet;
 17  
 
 18  
 import javax.servlet.http.HttpServletRequest;
 19  
 import javax.servlet.http.HttpServletResponse;
 20  
 
 21  
 import org.apache.cxf.BusFactory;
 22  
 import org.apache.cxf.transport.servlet.ServletController;
 23  
 import org.kuali.rice.ksb.service.KSBServiceLocator;
 24  
 import org.springframework.web.servlet.ModelAndView;
 25  
 import org.springframework.web.servlet.mvc.Controller;
 26  
 
 27  
 /**
 28  
  * An adapter for the {@link ServletController} so that it conforms to Springs MVC {@link Controller} interface. 
 29  
  * 
 30  
  * 
 31  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 32  
  *
 33  
  */
 34  0
 public class CXFServletControllerAdapter implements Controller{
 35  
 
 36  
         private ServletController controller;
 37  
                 
 38  
         /**
 39  
          * This method invokes the cxf servlet controller
 40  
          * 
 41  
          * @see org.springframework.web.servlet.mvc.Controller#handleRequest(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
 42  
          */
 43  
         public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
 44  
                                                 
 45  
         try {
 46  0
                     BusFactory.setThreadDefaultBus(KSBServiceLocator.getCXFBus());
 47  0
             controller.invoke(request, response);
 48  
         } finally {
 49  0
             BusFactory.setThreadDefaultBus(null);
 50  0
         }
 51  
 
 52  0
                 return null;
 53  
         }
 54  
                 
 55  
         public void setController(ServletController controller){
 56  0
                 this.controller = controller;
 57  0
         }
 58  
 }