public static VirtualHostImpl findVirtualHost(String endpointPid,
                                                  RequestHelper helper) {
        // defer retrieval of headers until we need them:
        // if we don't have virtual hosts to select from, we don't care what the
        // headers are, there is only one answer.
        AlternateHostSelector selector = alternateHostSelector.get();
        if (selector == null) {
            VirtualHostConfig defHostCfg = defaultHost.get();
            if (defHostCfg != null) {
                return defHostCfg.getVirtualHost();
            }

            return null;
        }

        // Now that we know we have virtual hosts to choose from, do the evaluation of http headers
        // to figure out what the requested host/port were..
        return selector.findVirtualHost(endpointPid, helper.getRequestedHost(), helper.getRequestedPort());
    }
public static VirtualHostImpl findVirtualHost ( String endpointPid , RequestHelper helper ) { AlternateHostSelector selector = alternateHostSelector . get ( ) ; if ( selector == null ) { VirtualHostConfig defHostCfg = defaultHost . get ( ) ; if ( defHostCfg != null ) { return defHostCfg . getVirtualHost ( ) ; } return null ; } return selector . findVirtualHost ( endpointPid , helper . getRequestedHost ( ) , helper . getRequestedPort ( ) ) ; }
Find the virtual host that should be used for the given host/port..

@param endpointPid The endpoint the request came in on
@param helper a RequestHelper allows deferred processing of request header information.

@return the VirtualHostImpl that should service the request