{
_invocationKey.init(isSecure(),
host, getServerPort(),
uri, uriLength);
Invocation invocation = _server.getInvocation(_invocationKey);
if (invocation != null)
return invocation.getRequestInvocation(_requestFacade);
invocation = _server.createInvocation();
invocation.setSecure(isSecure());
if (host != null) {
String hostName = host.toString().toLowerCase();
invocation.setHost(hostName);
invocation.setPort(getServerPort());
// Default host name if the host doesn't have a canonical
// name
int p = hostName.lastIndexOf(':');
int q = hostName.lastIndexOf(']');
if (p > 0 && q < p)
invocation.setHostName(hostName.substring(0, p));
else
invocation.setHostName(hostName);
}
return buildInvocation(invocation, uri, uriLength);
}