protected MessageReceiver getTargetReceiver(MuleMessage message, ImmutableEndpoint endpoint) throws ConnectException { String path = (String) message.getProperty(HttpConnector.HTTP_REQUEST_PROPERTY); int i = path.indexOf('?'); if (i > -1) { path = path.substring(0, i); } StringBuffer requestUri = new StringBuffer(80); if (path.indexOf("://") == -1) { requestUri.append(endpoint.getProtocol()).append("://"); requestUri.append(endpoint.getEndpointURI().getHost()); requestUri.append(':').append(endpoint.getEndpointURI().getPort()); if (!"/".equals(path)) { requestUri.append(path); } } String uriStr = requestUri.toString(); // first check that there is a receiver on the root address if (logger.isTraceEnabled()) { logger.trace( "Looking up receiver on connector: " + connector.getName() + " with URI key: " + requestUri.toString()); } MessageReceiver receiver = connector.lookupReceiver(uriStr); // If no receiver on the root and there is a request path, look up the // received based on the root plus request path if (receiver == null && !"/".equals(path)) { if (logger.isDebugEnabled()) { logger.debug( "Secondary lookup of receiver on connector: " + connector.getName() + " with URI key: " + requestUri.toString()); } if (receiver == null) { receiver = findReceiverByStem(connector.getReceivers(), uriStr); } if (receiver == null && logger.isWarnEnabled()) { logger.warn( "No receiver found with secondary lookup on connector: " + connector.getName() + " with URI key: " + requestUri.toString()); logger.warn( "Receivers on connector are: " + MapUtils.toString(connector.getReceivers(), true)); } } return receiver; }
public String getProtocol() { return endpoint.getProtocol(); }