1 16 package org.apache.axis2.engine; 17 18 import org.apache.axis2.addressing.EndpointReference; 19 import org.apache.axis2.context.MessageContext; 20 import org.apache.axis2.description.HandlerDescription; 21 import org.apache.axis2.description.OperationDescription; 22 import org.apache.axis2.description.ServiceDescription; 23 import org.apache.axis2.util.Utils; 24 25 import javax.xml.namespace.QName ; 26 27 30 public class RequestURIBasedDispatcher extends AbstractDispatcher { 31 34 public static final QName NAME = 35 new QName ("http://axis.ws.apache.org", "RequestURIBasedDispatcher"); 36 QName serviceName = null; 37 QName operatoinName = null; 38 39 42 public RequestURIBasedDispatcher() { 43 init(new HandlerDescription(NAME)); 44 } 45 46 public OperationDescription findOperation( 47 ServiceDescription service, 48 MessageContext messageContext) 49 throws AxisFault { 50 if (operatoinName != null) { 51 OperationDescription axisOp = service.getOperation(operatoinName); 52 return axisOp; 53 } 54 return null; 55 56 } 57 58 61 public ServiceDescription findService(MessageContext messageContext) throws AxisFault { 62 EndpointReference toEPR = messageContext.getTo(); 63 if (toEPR != null) { 64 String filePart = toEPR.getAddress(); 65 String [] values = Utils.parseRequestURLForServiceAndOperation(filePart); 66 if (values[1] != null) { 67 operatoinName = new QName (values[1]); 68 } 69 if (values[0] != null) { 70 serviceName = new QName (values[0]); 71 AxisConfiguration registry = 72 messageContext.getSystemContext().getAxisConfiguration(); 73 return registry.getService(serviceName); 74 } 75 } 76 return null; 77 } 78 } 79 | Popular Tags |