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.apache.log4j.Logger;
20  import org.kuali.rice.core.resourceloader.GlobalResourceLoader;
21  import org.kuali.rice.ksb.messaging.RemotedServiceRegistry;
22  import org.kuali.rice.ksb.service.KSBServiceLocator;
23  import org.springframework.web.servlet.HandlerMapping;
24  import org.springframework.web.servlet.handler.AbstractHandlerMapping;
25  import org.springframework.web.util.UrlPathHelper;
26  
27  
28  /**
29   * A {@link HandlerMapping} which handles incoming HTTP requests from the bus.
30   * 
31   * @author Kuali Rice Team (rice.collab@kuali.org)
32   */
33  public class KSBHttpInvokerHandler extends AbstractHandlerMapping {
34  
35      private static final Logger LOG = Logger.getLogger(KSBHttpInvokerHandler.class);
36  
37      private UrlPathHelper urlPathHelper = new UrlPathHelper();
38  
39      protected Object getHandlerInternal(HttpServletRequest request) throws Exception {
40          QName serviceName = getServiceNameFromRequest(request);
41          return ((RemotedServiceRegistry) GlobalResourceLoader.getService("enServiceInvoker")).getService(serviceName);
42      }
43  
44      public QName getServiceNameFromRequest(HttpServletRequest request) {   	    	
45      	return KSBServiceLocator.getServiceDeployer().getServiceName(request.getRequestURL().toString()); 
46      }
47  }