if (protocol.equals(Protocol.RIAP)) {
// Let's dispatch it
final LocalReference cr = new LocalReference(request
.getResourceRef());
final Component component = getComponent();
if (component != null) {
if (cr.getRiapAuthorityType() == LocalReference.RIAP_COMPONENT) {
// This causes the baseRef of the resource reference to be
// set as if it had actually arrived from a server
// connector.
request.getResourceRef().setBaseRef(
request.getResourceRef().getHostIdentifier());
// Ask the private internal route to handle the call
component.getInternalRouter().handle(request, response);
} else if (cr.getRiapAuthorityType() == LocalReference.RIAP_HOST) {
VirtualHost host = null;
VirtualHost currentHost = null;
final Integer hostHashCode = VirtualHost.getCurrent();
// Lookup the virtual host
for (final Iterator<VirtualHost> hostIter = getComponent()
.getHosts().iterator(); (host == null)
&& hostIter.hasNext();) {
currentHost = hostIter.next();
if (currentHost.hashCode() == hostHashCode) {
host = currentHost;
}
}
if ((host == null) && (component.getDefaultHost() != null)) {
if (component.getDefaultHost().hashCode() == hostHashCode) {
host = component.getDefaultHost();
}
}
if (host != null) {
// This causes the baseRef of the resource reference to