/** * Returns the endPoints matching the specified host and port. * @param hostAndPort host and port location. * @return URI[] if matched, null otherwise. */ public URI[] getEndPoints(String hostAndPort) { // get list of matching endpoints associated with service, // having the specified host and port configuration String port; Vector matchedEndpoints = new Vector(); for (int i = 0; i < endPoints.length; i++) { // PB: If the endpoint does not contain a port number, then default it to "80" port = (endPoints[i].getPort() == -1) ? "80" : String.valueOf(endPoints[i].getPort()); if (hostAndPort.equals(endPoints[i].getHost() + ":" + port)) { matchedEndpoints.add(endPoints[i]); } } return (URI[]) matchedEndpoints.toArray(new URI[0]); }
/** * Returns the endPoints matching the specified host and port. * @param hostAndPort host and port location. * @return URI[] if matched, null otherwise. */ public URI[] getEndPoints(String hostAndPort) { // get list of matching endpoints associated with service, // having the specified host and port configuration String port; Vector matchedEndpoints = new Vector(); for (int i = 0; i < endPoints.length; i++) { // PB: If the endpoint does not contain a port number, then default it to "80" port = (endPoints[i].getPort() == -1) ? "80" : String.valueOf(endPoints[i].getPort()); if (hostAndPort.equals(endPoints[i].getHost() + ":" + port)) { matchedEndpoints.add(endPoints[i]); } } return (URI[]) matchedEndpoints.toArray(new URI[0]); }
/** * Returns true if the hostAndPort matches at least one context endpoint. * @param hostAndPortString a host and port location. * @return true if the hostAndPort matches at least one context endpoint. * @throws WSIException if given hostandPort String does not convert to URI. */ public boolean hasHostAndPort(String hostAndPortString) throws WSIException { URI hostAndPort; try { hostAndPort = new URI(hostAndPortString); } catch (Exception e) { throw new WSIException( "Could not convert string to URI: " + hostAndPortString); } String host = hostAndPort.getHost(); int port = hostAndPort.getPort(); for (int i = 0; i < this.endPoints.length; i++) { if (this.endPoints[i].getHost().equals(host) && this.endPoints[i].getPort() == port) { return true; } } return false; // for now }
/** * Returns true if the hostAndPort matches at least one context endpoint. * @param hostAndPortString a host and port location. * @return true if the hostAndPort matches at least one context endpoint. * @throws WSIException if given hostandPort String does not convert to URI. */ public boolean hasHostAndPort(String hostAndPortString) throws WSIException { URI hostAndPort; try { hostAndPort = new URI(hostAndPortString); } catch (Exception e) { throw new WSIException( "Could not convert string to URI: " + hostAndPortString); } String host = hostAndPort.getHost(); int port = hostAndPort.getPort(); for (int i = 0; i < this.endPoints.length; i++) { if (this.endPoints[i].getHost().equals(host) && this.endPoints[i].getPort() == port) { return true; } } return false; // for now }
/** * Initialize all fields of this URI from another URI. * * @param p_other the URI to copy (cannot be null) */ private void initialize(URI p_other) { m_scheme = p_other.getScheme(); m_userinfo = p_other.getUserinfo(); m_host = p_other.getHost(); m_port = p_other.getPort(); m_regAuthority = p_other.getRegBasedAuthority(); m_path = p_other.getPath(); m_queryString = p_other.getQueryString(); m_fragment = p_other.getFragment(); }