本文整理了Java中org.restlet.data.Protocol.getDefaultPort()
方法的一些代码示例,展示了Protocol.getDefaultPort()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Protocol.getDefaultPort()
方法的具体详情如下:
包路径:org.restlet.data.Protocol
类名称:Protocol
方法名:getDefaultPort
[英]Returns the default port number.
[中]返回默认端口号。
代码示例来源:origin: DeviceConnect/DeviceConnect-Android
/**
* 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());
}
代码示例来源:origin: org.restlet/org.restlet
/**
* 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());
}
代码示例来源:origin: org.restlet.osgi/org.restlet
/**
* 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());
}
代码示例来源:origin: org.restlet.osgi/org.restlet
/**
* 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());
}
代码示例来源:origin: org.restlet/org.restlet
/**
* 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);
}
代码示例来源:origin: org.restlet/org.restlet
/**
* 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);
}
代码示例来源:origin: org.restlet.osgi/org.restlet
/**
* 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);
}
代码示例来源:origin: org.restlet.osgi/org.restlet
/**
* 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);
}
代码示例来源:origin: org.restlet.osgi/org.restlet
/**
* 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);
}
代码示例来源:origin: org.restlet.osgi/org.restlet
/**
* 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);
}
代码示例来源:origin: DeviceConnect/DeviceConnect-Android
/**
* 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);
}
代码示例来源:origin: org.restlet.osgi/org.restlet
/**
* 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;
}
代码示例来源:origin: org.restlet/org.restlet
/**
* 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);
}
代码示例来源:origin: org.restlet.osgi/org.restlet
/**
* 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;
}
代码示例来源:origin: org.restlet/org.restlet
/**
* 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;
}
代码示例来源:origin: org.restlet.osgi/org.restlet
/**
* 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;
}
代码示例来源:origin: DeviceConnect/DeviceConnect-Android
/**
* 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;
}
代码示例来源:origin: org.restlet.jee/org.restlet.ext.wadl
for (Server server : component.getServers()) {
if (server.getProtocols().contains(protocol)
&& (server.getPort() == protocol.getDefaultPort())) {
exists = true;
代码示例来源:origin: org.restlet.osgi/org.restlet
sb.append(httpCall.getHostDomain());
if ((httpCall.getHostPort() != -1)
&& (httpCall.getHostPort() != httpCall.getProtocol().getDefaultPort())) {
sb.append(':').append(httpCall.getHostPort());
代码示例来源:origin: org.restlet.osgi/org.restlet
.getDefaultPort();
.getSchemeProtocol() != null) {
resourcePortValue = request.getResourceRef()
.getSchemeProtocol().getDefaultPort();
serverPortValue = request.getProtocol().getDefaultPort();
内容来源于网络,如有侵权,请联系作者删除!