/** * Constructor for a protocol and host name. Uses the default port for the * given protocol. * * @param protocol * Protocol/scheme to use * @param hostName * The host name or IP address. */ public Reference(Protocol protocol, String hostName) { this(protocol, hostName, protocol.getDefaultPort()); }
/** * Constructor for a protocol and host name. Uses the default port for the * given protocol. * * @param protocol * Protocol/scheme to use * @param hostName * The host name or IP address. */ public Reference(Protocol protocol, String hostName) { this(protocol, hostName, protocol.getDefaultPort()); }
/** * Constructor for a protocol and host name. Uses the default port for the * given protocol. * * @param protocol * Protocol/scheme to use * @param hostName * The host name or IP address. */ public Reference(Protocol protocol, String hostName) { this(protocol, hostName, protocol.getDefaultPort()); }
/** * Constructor. Note that it uses the protocol's default port. * * @param context * The parent context. * @param protocol * The connector protocol. */ public Server(Context context, Protocol protocol) { this(context, protocol, (protocol == null) ? -1 : protocol .getDefaultPort()); }
/** * Constructor using the protocol's default port. * * @param context * The context. * @param protocol * The connector protocol. * @param target * The target Restlet. */ public Server(Context context, Protocol protocol, Restlet target) { this(context, protocol, null, (protocol == null) ? -1 : protocol .getDefaultPort(), target); }
/** * Constructor using the protocol's default port. * * @param protocol * The connector protocol. * @param address * The listening IP address (useful if multiple IP addresses * available). You can also use a domain name as an alias for the * IP address to listen to. * @param target * The target Restlet. */ public Server(Protocol protocol, String address, Restlet target) { this(null, protocol, address, protocol.getDefaultPort(), target); }
/** * Constructor using the protocol's default port. * * @param protocol * The connector protocol. * @param address * The listening IP address (useful if multiple IP addresses * available). You can also use a domain name as an alias for the * IP address to listen to. */ public Server(Protocol protocol, String address) { this((Context) null, protocol, address, protocol.getDefaultPort(), null); }
/** * Constructor using the protocol's default port. * * @param context * The context. * @param protocol * The connector protocol. * @param next * The next Restlet. */ public Server(Context context, Protocol protocol, Restlet next) { this(context, protocol, null, (protocol == null) ? -1 : protocol .getDefaultPort(), next); }
/** * Constructor using the protocol's default port. * * @param protocol * The connector protocol. * @param address * The listening IP address (useful if multiple IP addresses * available). You can also use a domain name as an alias for the * IP address to listen to. * @param next * The next Restlet. */ public Server(Protocol protocol, String address, Restlet next) { this((Context) null, protocol, address, protocol.getDefaultPort(), next); }
/** * Creates a reference string from its parts. * * @param scheme * The scheme ("http", "https" or "ftp"). * @param hostName * The host name or IP address. * @param hostPort * The host port (default ports are correctly ignored). * @param path * The path component for hierarchical identifiers. * @param query * The optional query component for hierarchical identifiers. * @param fragment * The optional fragment identifier. * @return The reference as String. */ public static String toString(String scheme, String hostName, Integer hostPort, String path, String query, String fragment) { String host = hostName; // Appends the host port number if (hostPort != null) { final int defaultPort = Protocol.valueOf(scheme).getDefaultPort(); if (hostPort != defaultPort) { host = hostName + ':' + hostPort; } } return toString(scheme, host, path, query, fragment); }
/** * Creates a reference string from its parts. * * @param scheme * The scheme ("http", "https" or "ftp"). * @param hostName * The host name or IP address. * @param hostPort * The host port (default ports are correctly ignored). * @param path * The path component for hierarchical identifiers. * @param query * The optional query component for hierarchical identifiers. * @param fragment * The optional fragment identifier. * @return The reference as String. */ public static String toString(String scheme, String hostName, Integer hostPort, String path, String query, String fragment) { String host = hostName; // Appends the host port number if (hostPort != null) { final int defaultPort = Protocol.valueOf(scheme).getDefaultPort(); if (hostPort != defaultPort) { host = hostName + ':' + hostPort; } } return toString(scheme, host, path, query, fragment); }
/** * Adds a new server connector in the map supporting the given protocol. * * @param protocol * The connector protocol. * @return The added server. */ public Server add(Protocol protocol) { Server result = new Server(protocol, null, protocol.getDefaultPort(), getNext()); add(result); return result; }
/** * Creates a reference string from its parts. * * @param scheme * The scheme ("http", "https" or "ftp"). * @param hostName * The host name or IP address. * @param hostPort * The host port (default ports are correctly ignored). * @param path * The path component for hierarchical identifiers. * @param query * The optional query component for hierarchical identifiers. * @param fragment * The optional fragment identifier. * @return The reference as String. */ public static String toString(String scheme, String hostName, Integer hostPort, String path, String query, String fragment) { String host = hostName; // Appends the host port number if (hostPort != null) { final int defaultPort = Protocol.valueOf(scheme).getDefaultPort(); if (hostPort != defaultPort) { host = hostName + ':' + hostPort; } } return toString(scheme, host, path, query, fragment); }
/** * Parses the "host" header to set the server host and port properties. */ private void parseHost() { String host = getRequestHeaders().getFirstValue( HeaderConstants.HEADER_HOST, true); if (host != null) { // Take care of IPV6 addresses int colonIndex = host.indexOf(':', host.indexOf(']')); if (colonIndex != -1) { super.setHostDomain(host.substring(0, colonIndex)); super.setHostPort(Integer.valueOf(host .substring(colonIndex + 1))); } else { super.setHostDomain(host); super.setHostPort(getProtocol().getDefaultPort()); } } else { getLogger().info( "Couldn't find the mandatory \"Host\" HTTP header."); } this.hostParsed = true; }
/** * Adds a new server connector in the map supporting the given protocol. * * @param protocol * The connector protocol. * @return The added server. */ public Server add(Protocol protocol) { Server result = new Server(protocol, null, protocol.getDefaultPort(), getTarget()); result.setContext(getContext().createChildContext()); add(result); return result; }
/** * Creates the protocol associated to a URI scheme name. If an existing * constant exists then it is returned, otherwise a new instance is created. * * @param name * The scheme name. * @param version * The version number. * @return The associated protocol. */ public static Protocol valueOf(String name, String version) { Protocol result = valueOf(name); if (!version.equals(result.getVersion())) { result = new Protocol(result.getSchemeName(), result.getName(), result.getTechnicalName(), result.getDescription(), result.getDefaultPort(), result.isConfidential(), version); } return result; }
/** * Creates the protocol associated to a URI scheme name. If an existing * constant exists then it is returned, otherwise a new instance is created. * * @param name * The scheme name. * @param version * The version number. * @return The associated protocol. */ public static Protocol valueOf(String name, String version) { Protocol result = valueOf(name); if (!version.equals(result.getVersion())) { result = new Protocol(result.getSchemeName(), result.getName(), result.getTechnicalName(), result.getDescription(), result.getDefaultPort(), result.isConfidential(), version); } return result; }
for (Server server : component.getServers()) { if (server.getProtocols().contains(protocol) && (server.getPort() == protocol.getDefaultPort())) { exists = true;
sb.append(httpCall.getHostDomain()); if ((httpCall.getHostPort() != -1) && (httpCall.getHostPort() != httpCall.getProtocol().getDefaultPort())) { sb.append(':').append(httpCall.getHostPort());
.getDefaultPort(); .getSchemeProtocol() != null) { resourcePortValue = request.getResourceRef() .getSchemeProtocol().getDefaultPort(); serverPortValue = request.getProtocol().getDefaultPort();