本文整理了Java中org.restlet.data.Reference.getAuthority
方法的一些代码示例,展示了Reference.getAuthority
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Reference.getAuthority
方法的具体详情如下:
包路径:org.restlet.data.Reference
类名称:Reference
方法名:getAuthority
[英]Returns the authority component for hierarchical identifiers. Includes the user info, host name and the host port number.
Note that no URI decoding is done by this method.
[中]返回分层标识符的权限组件。包括用户信息、主机名和主机端口号。
请注意,此方法不会执行URI解码。
代码示例来源:origin: org.restlet/org.restlet
/**
* Returns the optionnally decoded authority component.
*
* @param decode
* Indicates if the result should be decoded using the
* {@link #decode(String)} method.
* @return The optionnally decoded authority component.
* @see #getAuthority()
*/
public String getAuthority(boolean decode) {
return decode ? decode(getAuthority()) : getAuthority();
}
代码示例来源:origin: org.restlet.osgi/org.restlet
/**
* Returns the optionnally decoded authority component.
*
* @param decode
* Indicates if the result should be decoded using the {@link #decode(String)} method.
* @return The optionnally decoded authority component.
* @see #getAuthority()
*/
public String getAuthority(boolean decode) {
return decode ? decode(getAuthority()) : getAuthority();
}
代码示例来源:origin: DeviceConnect/DeviceConnect-Android
/**
* Returns the optionnally decoded authority component.
*
* @param decode
* Indicates if the result should be decoded using the
* {@link #decode(String)} method.
* @return The optionnally decoded authority component.
* @see #getAuthority()
*/
public String getAuthority(boolean decode) {
return decode ? decode(getAuthority()) : getAuthority();
}
代码示例来源:origin: org.restlet/org.restlet
/**
* Returns the user info component for server based hierarchical
* identifiers.<br>
* Note that no URI decoding is done by this method.
*
* @return The user info component for server based hierarchical
* identifiers.
*/
public String getUserInfo() {
String result = null;
final String authority = getAuthority();
if (authority != null) {
final int index = authority.indexOf('@');
if (index != -1) {
result = authority.substring(0, index);
}
}
return result;
}
代码示例来源:origin: org.restlet.osgi/org.restlet
/**
* Returns the user info component for server based hierarchical
* identifiers.<br>
* Note that no URI decoding is done by this method.
*
* @return The user info component for server based hierarchical
* identifiers.
*/
public String getUserInfo() {
String result = null;
final String authority = getAuthority();
if (authority != null) {
final int index = authority.indexOf('@');
if (index != -1) {
result = authority.substring(0, index);
}
}
return result;
}
代码示例来源:origin: org.restlet.osgi/org.restlet
/**
* Returns the host identifier. Includes the scheme, the host name and the
* host port number.<br>
* Note that no URI decoding is done by this method.
*
* @return The host identifier.
*/
public String getHostIdentifier() {
final StringBuilder result = new StringBuilder();
result.append(getScheme()).append("://").append(getAuthority());
return result.toString();
}
代码示例来源:origin: DeviceConnect/DeviceConnect-Android
/**
* Returns the user info component for server based hierarchical
* identifiers.<br>
* Note that no URI decoding is done by this method.
*
* @return The user info component for server based hierarchical
* identifiers.
*/
public String getUserInfo() {
String result = null;
final String authority = getAuthority();
if (authority != null) {
final int index = authority.indexOf('@');
if (index != -1) {
result = authority.substring(0, index);
}
}
return result;
}
代码示例来源:origin: org.restlet/org.restlet
/**
* Returns the host identifier. Includes the scheme, the host name and the
* host port number.<br>
* Note that no URI decoding is done by this method.
*
* @return The host identifier.
*/
public String getHostIdentifier() {
final StringBuilder result = new StringBuilder();
result.append(getScheme()).append("://").append(getAuthority());
return result.toString();
}
代码示例来源:origin: DeviceConnect/DeviceConnect-Android
/**
* Returns the host identifier. Includes the scheme, the host name and the
* host port number.<br>
* Note that no URI decoding is done by this method.
*
* @return The host identifier.
*/
public String getHostIdentifier() {
final StringBuilder result = new StringBuilder();
result.append(getScheme()).append("://").append(getAuthority());
return result.toString();
}
代码示例来源:origin: org.restlet.osgi/org.restlet
/**
* Sets the user info component for server based hierarchical identifiers.
*
* @param userInfo
* The user info component for server based hierarchical
* identifiers.
* @throws IllegalArgumentException
* If the autority part has not been defined.
*/
public void setUserInfo(String userInfo) {
final String authority = getAuthority();
if (authority != null) {
final int index = authority.indexOf('@');
final String newUserInfo = (userInfo == null) ? "" : userInfo + '@';
if (index != -1) {
setAuthority(newUserInfo + authority.substring(index + 1));
} else {
setAuthority(newUserInfo + authority);
}
} else {
throw new IllegalArgumentException(
"No authority defined, please define a host name first");
}
}
代码示例来源:origin: org.restlet.osgi/org.restlet
/**
* Sets the optional port number for server based hierarchical identifiers.
*
* @param port
* The optional port number for server based hierarchical
* identifiers.
* @throws IllegalArgumentException
* If the autority has not been defined.
*/
public void setHostPort(Integer port) {
final String authority = getAuthority();
if (authority != null) {
// We must prevent the case where the userinfo part contains ':'
// and the case of IPV6 addresses
int indexUI = authority.indexOf('@'); // user info
int indexIPV6 = authority.indexOf(']'); // IPV6
int index = authority.indexOf(':', (indexIPV6 == -1) ? indexUI
: indexIPV6);
String newPort = (port == null) ? "" : ":" + port;
if (index != -1) {
setAuthority(authority.substring(0, index) + newPort);
} else {
setAuthority(authority + newPort);
}
} else {
throw new IllegalArgumentException(
"No authority defined, please define a host name first");
}
}
代码示例来源:origin: DeviceConnect/DeviceConnect-Android
/**
* Sets the user info component for server based hierarchical identifiers.
*
* @param userInfo
* The user info component for server based hierarchical
* identifiers.
* @throws IllegalArgumentException
* If the autority part has not been defined.
*/
public void setUserInfo(String userInfo) {
final String authority = getAuthority();
if (authority != null) {
final int index = authority.indexOf('@');
final String newUserInfo = (userInfo == null) ? "" : userInfo + '@';
if (index != -1) {
setAuthority(newUserInfo + authority.substring(index + 1));
} else {
setAuthority(newUserInfo + authority);
}
} else {
throw new IllegalArgumentException(
"No authority defined, please define a host name first");
}
}
代码示例来源:origin: org.restlet/org.restlet
/**
* Returns the optional port number for server based hierarchical
* identifiers.
*
* @return The optional port number for server based hierarchical
* identifiers or -1 if the port number does not exist.
*/
public int getHostPort() {
int result = -1;
final String authority = getAuthority();
if (authority != null) {
final int index1 = authority.indexOf('@');
// We must prevent the case where the userinfo part contains ':'
final int index = authority.indexOf(':',
(index1 == -1 ? 0 : index1));
if (index != -1) {
try {
result = Integer.parseInt(authority.substring(index + 1));
} catch (NumberFormatException nfe) {
Context.getCurrentLogger().log(
Level.WARNING,
"Can't parse hostPort : [hostRef,requestUri]=["
+ getBaseRef() + "," + this.internalRef
+ "]");
}
}
}
return result;
}
代码示例来源:origin: org.restlet/org.restlet
/**
* Sets the user info component for server based hierarchical identifiers.
*
* @param userInfo
* The user info component for server based hierarchical
* identifiers.
* @throws IllegalArgumentException
* If the autority part has not been defined.
*/
public void setUserInfo(String userInfo) {
final String authority = getAuthority();
if (authority != null) {
final int index = authority.indexOf('@');
final String newUserInfo = (userInfo == null) ? "" : userInfo + '@';
if (index != -1) {
setAuthority(newUserInfo + authority.substring(index + 1));
} else {
setAuthority(newUserInfo + authority);
}
} else {
throw new IllegalArgumentException(
"No authority defined, please define a host name first");
}
}
代码示例来源:origin: DeviceConnect/DeviceConnect-Android
final String authority = getAuthority();
代码示例来源:origin: org.restlet/org.restlet
/**
* Sets the optional port number for server based hierarchical identifiers.
*
* @param port
* The optional port number for server based hierarchical
* identifiers.
* @throws IllegalArgumentException
* If the autority has not been defined.
*/
public void setHostPort(Integer port) {
final String authority = getAuthority();
if (authority != null) {
final int index1 = authority.indexOf('@');
// We must prevent the case where the userinfo part contains ':'
final int index = authority.indexOf(':',
(index1 == -1 ? 0 : index1));
final String newPort = (port == null) ? "" : ":" + port;
if (index != -1) {
setAuthority(authority.substring(0, index) + newPort);
} else {
setAuthority(authority + newPort);
}
} else {
throw new IllegalArgumentException(
"No authority defined, please define a host name first");
}
}
代码示例来源:origin: org.restlet.osgi/org.restlet
final String authority = getAuthority();
代码示例来源:origin: DeviceConnect/DeviceConnect-Android
/**
* Sets the optional port number for server based hierarchical identifiers.
*
* @param port
* The optional port number for server based hierarchical
* identifiers.
* @throws IllegalArgumentException
* If the autority has not been defined.
*/
public void setHostPort(Integer port) {
final String authority = getAuthority();
if (authority != null) {
// We must prevent the case where the userinfo part contains ':'
// and the case of IPV6 addresses
int indexUI = authority.indexOf('@'); // user info
int indexIPV6 = authority.indexOf(']'); // IPV6
int index = authority.indexOf(':', (indexIPV6 == -1) ? indexUI
: indexIPV6);
String newPort = (port == null) ? "" : ":" + port;
if (index != -1) {
setAuthority(authority.substring(0, index) + newPort);
} else {
setAuthority(authority + newPort);
}
} else {
throw new IllegalArgumentException(
"No authority defined, please define a host name first");
}
}
代码示例来源:origin: org.restlet.osgi/org.restlet.ext.osgi
@Override
protected void handleLocal(Request request, Response response,
String decodedPath) {
String scheme = request.getResourceRef().getScheme();
if (scheme.equalsIgnoreCase(Protocol.OBAP.getSchemeName())) {
Bundle bundle = BUNDLE_CACHE.get(request.getResourceRef()
.getAuthority());
getLogger().fine(
"Look for bundle "
+ request.getResourceRef().getAuthority());
handleBundle(request, response, bundle);
} else {
throw new IllegalArgumentException(
"Protocol \""
+ scheme
+ "\" not supported by the connector. Only OBAP is supported.");
}
}
代码示例来源:origin: org.restlet/org.restlet
result = reference.getAuthority();
} else if (partName.startsWith("b")) {
result = getReferenceContent(partName.substring(1),
内容来源于网络,如有侵权,请联系作者删除!