protected void setupRequestMessage(HttpServletRequest request,
MuleMessage requestMessage,
MessageReceiver receiver)
{
EndpointURI uri = receiver.getEndpointURI();
String reqUri = request.getRequestURI();
requestMessage.setProperty(HttpConnector.HTTP_REQUEST_PATH_PROPERTY, reqUri, PropertyScope.INBOUND);
String queryString = request.getQueryString();
if (queryString != null)
{
reqUri += "?" + queryString;
}
requestMessage.setProperty(HttpConnector.HTTP_REQUEST_PROPERTY, reqUri, PropertyScope.INBOUND);
String path;
if ("servlet".equals(uri.getScheme()))
{
path = HttpConnector.normalizeUrl(request.getContextPath());
if ("/".equals(path))
{
path = HttpConnector.normalizeUrl(request.getServletPath());
}
else
{
path = path + HttpConnector.normalizeUrl(request.getServletPath());
}
String pathPart2 = uri.getAddress();
if (!path.endsWith("/"))
{
// "/foo" + "bar"
path = path + HttpConnector.normalizeUrl(pathPart2);
}
else if (pathPart2.startsWith("/"))
{
// "/foo/" + "/bar"
path = path + pathPart2.substring(1);
}
else
{
// "/foo/" + "bar"
path = path + pathPart2;
}
}
else
{
// The Jetty transport has normal paths
path = HttpConnector.normalizeUrl(uri.getPath());
}
requestMessage.setProperty(HttpConnector.HTTP_CONTEXT_PATH_PROPERTY, path, PropertyScope.INBOUND);
// Call this to keep API compatability