View Javadoc

1   /*
2    * Copyright 2005-2007 The Kuali Foundation
3    * 
4    * 
5    * Licensed under the Educational Community License, Version 2.0 (the "License"); you may not use this file except in
6    * compliance with the License. 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 distributed under the License is distributed on an "AS
11   * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific
12   * language governing permissions and limitations under the License.
13   */
14  package org.kuali.rice.ksb.messaging.servlet;
15  
16  import javax.servlet.http.HttpServletRequest;
17  import javax.xml.namespace.QName;
18  
19  import org.kuali.rice.ksb.messaging.serviceexporters.ServiceExportManager;
20  import org.kuali.rice.ksb.service.KSBServiceLocator;
21  import org.springframework.web.servlet.HandlerMapping;
22  import org.springframework.web.servlet.handler.AbstractHandlerMapping;
23  
24  /**
25   * A {@link HandlerMapping} which handles incoming HTTP requests from the bus.
26   * 
27   * @author Kuali Rice Team (rice.collab@kuali.org)
28   */
29  public class KSBHttpInvokerHandler extends AbstractHandlerMapping {
30  
31      protected Object getHandlerInternal(HttpServletRequest request) throws Exception {
32          QName serviceName = getServiceNameFromRequest(request);
33          ServiceExportManager serviceExportManager = KSBServiceLocator.getServiceExportManager();
34          return serviceExportManager.getService(serviceName);
35      }
36  
37      public QName getServiceNameFromRequest(HttpServletRequest request) {   	    	
38      	return KSBServiceLocator.getServiceExportManager().getServiceName(request.getRequestURL().toString()); 
39      }
40      
41  }