本文整理了Java中org.restlet.data.Reference.getHostIdentifier
方法的一些代码示例,展示了Reference.getHostIdentifier
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Reference.getHostIdentifier
方法的具体详情如下:
包路径:org.restlet.data.Reference
类名称:Reference
方法名:getHostIdentifier
[英]Returns the host identifier. Includes the scheme, the 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 host identifier.
*
* @param decode
* Indicates if the result should be decoded using the
* {@link #decode(String)} method.
* @return The optionnally decoded host identifier.
* @see #getHostIdentifier()
*/
public String getHostIdentifier(boolean decode) {
return decode ? decode(getHostIdentifier()) : getHostIdentifier();
}
代码示例来源:origin: DeviceConnect/DeviceConnect-Android
/**
* Returns the optionnally decoded host identifier.
*
* @param decode
* Indicates if the result should be decoded using the
* {@link #decode(String)} method.
* @return The optionnally decoded host identifier.
* @see #getHostIdentifier()
*/
public String getHostIdentifier(boolean decode) {
return decode ? decode(getHostIdentifier()) : getHostIdentifier();
}
代码示例来源:origin: org.restlet.osgi/org.restlet
/**
* Returns the optionnally decoded host identifier.
*
* @param decode
* Indicates if the result should be decoded using the {@link #decode(String)} method.
* @return The optionnally decoded host identifier.
* @see #getHostIdentifier()
*/
public String getHostIdentifier(boolean decode) {
return decode ? decode(getHostIdentifier()) : getHostIdentifier();
}
代码示例来源:origin: org.restlet/org.restlet
/**
* Returns the parent reference of a hierarchical reference. The last slash
* of the path will be considered as the end of the parent path.
*
* @return The parent reference of a hierarchical reference.
*/
public Reference getParentRef() {
Reference result = null;
if (isHierarchical()) {
String parentRef = null;
String path = getPath();
if (!path.equals("/") && !path.equals("")) {
if (path.endsWith("/")) {
path = path.substring(0, path.length() - 1);
}
parentRef = getHostIdentifier()
+ path.substring(0, path.lastIndexOf('/') + 1);
} else {
parentRef = this.internalRef;
}
result = new Reference(parentRef);
}
return result;
}
代码示例来源:origin: org.restlet.osgi/org.restlet
/**
* Returns the parent reference of a hierarchical reference. The last slash
* of the path will be considered as the end of the parent path.
*
* @return The parent reference of a hierarchical reference.
*/
public Reference getParentRef() {
Reference result = null;
if (isHierarchical()) {
String parentRef = null;
String path = getPath();
if (!path.equals("/") && !path.equals("")) {
if (path.endsWith("/")) {
path = path.substring(0, path.length() - 1);
}
if (isAbsolute()) {
parentRef = getHostIdentifier()
+ path.substring(0, path.lastIndexOf('/') + 1);
} else {
parentRef = path.substring(0, path.lastIndexOf('/') + 1);
}
} else {
parentRef = this.internalRef;
}
result = new Reference(parentRef);
}
return result;
}
代码示例来源:origin: DeviceConnect/DeviceConnect-Android
/**
* Returns the parent reference of a hierarchical reference. The last slash
* of the path will be considered as the end of the parent path.
*
* @return The parent reference of a hierarchical reference.
*/
public Reference getParentRef() {
Reference result = null;
if (isHierarchical()) {
String parentRef = null;
String path = getPath();
if (!path.equals("/") && !path.equals("")) {
if (path.endsWith("/")) {
path = path.substring(0, path.length() - 1);
}
if (isAbsolute()) {
parentRef = getHostIdentifier()
+ path.substring(0, path.lastIndexOf('/') + 1);
} else {
parentRef = path.substring(0, path.lastIndexOf('/') + 1);
}
} else {
parentRef = this.internalRef;
}
result = new Reference(parentRef);
}
return result;
}
代码示例来源:origin: org.restlet.osgi/org.restlet
@Override
public int beforeHandle(Request request, Response response) {
int result = super.beforeHandle(request, response);
// This causes the baseRef of the resource reference to be set
// as if it had actually arrived from a server connector.
request.getResourceRef().setBaseRef(
request.getResourceRef().getHostIdentifier());
return result;
}
代码示例来源:origin: org.restlet/org.restlet
result = reference.getFragment();
} else if (partName.equals("h")) {
result = reference.getHostIdentifier();
} else if (partName.equals("i")) {
result = reference.getIdentifier();
代码示例来源:origin: org.sonatype.nexus.plugins/nexus-yum-repository-plugin
try {
repoUrl =
new URL(request.getResourceRef().getHostIdentifier() + "/"
+ join(segments.subList(0, yumIndex + segmentsAfterPrefix + 1), "/"));
代码示例来源:origin: org.restlet.osgi/org.restlet
throw new IllegalArgumentException(
"The base reference must have an absolute hierarchical path component");
} else if (!getHostIdentifier().equals(base.getHostIdentifier())) {
result = this;
} else {
代码示例来源:origin: org.restlet/org.restlet
throw new IllegalArgumentException(
"The base reference must have an absolute hierarchical path component");
} else if (!getHostIdentifier().equals(base.getHostIdentifier())) {
result = this;
} else {
代码示例来源:origin: DeviceConnect/DeviceConnect-Android
throw new IllegalArgumentException(
"The base reference must have an absolute hierarchical path component");
} else if (!getHostIdentifier().equals(base.getHostIdentifier())) {
result = this;
} else {
代码示例来源:origin: org.restlet.osgi/org.restlet
return reference.getFragment();
case "h":
return reference.getHostIdentifier();
case "i":
return reference.getIdentifier();
代码示例来源:origin: net.fortytwo.sesametools/linked-data-server
@Get
public Representation get(final Variant variant) {
selfURI = this.getRequest().getResourceRef().toString();
int i = selfURI.lastIndexOf(".");
if (i > 0) {
format = RDFFormat.matchFileName(selfURI, null);
}
if (!format.isPresent()) {
webResourceCategory = WebResourceCategory.NON_INFORMATION_RESOURCE;
getVariants().addAll(RDFMediaTypes.getRDFVariants());
} else {
webResourceCategory = WebResourceCategory.INFORMATION_RESOURCE;
getVariants().add(RDFMediaTypes.findVariant(format.get()));
hostIdentifier = this.getRequest().getResourceRef().getHostIdentifier();
baseRef = this.getRequest().getResourceRef().getBaseRef().toString();
subjectResourceURI = selfURI.substring(0, i);
typeSpecificId = subjectResourceURI.substring(baseRef.length());
datasetURI = LinkedDataServer.getInstance().getDatasetURI();
sail = LinkedDataServer.getInstance().getSail();
}
MediaType type = variant.getMediaType();
switch (webResourceCategory) {
case INFORMATION_RESOURCE:
return representInformationResource();
case NON_INFORMATION_RESOURCE:
return representNonInformationResource(type);
default:
throw new IllegalStateException("no such resource type: " + webResourceCategory);
}
}
代码示例来源:origin: joshsh/sesametools
@Get
public Representation get(final Variant variant) {
selfURI = this.getRequest().getResourceRef().toString();
int i = selfURI.lastIndexOf(".");
if (i > 0) {
format = RDFFormat.matchFileName(selfURI, null);
}
if (!format.isPresent()) {
webResourceCategory = WebResourceCategory.NON_INFORMATION_RESOURCE;
getVariants().addAll(RDFMediaTypes.getRDFVariants());
} else {
webResourceCategory = WebResourceCategory.INFORMATION_RESOURCE;
getVariants().add(RDFMediaTypes.findVariant(format.get()));
hostIdentifier = this.getRequest().getResourceRef().getHostIdentifier();
baseRef = this.getRequest().getResourceRef().getBaseRef().toString();
subjectResourceURI = selfURI.substring(0, i);
typeSpecificId = subjectResourceURI.substring(baseRef.length());
datasetURI = LinkedDataServer.getInstance().getDatasetURI();
sail = LinkedDataServer.getInstance().getSail();
}
MediaType type = variant.getMediaType();
switch (webResourceCategory) {
case INFORMATION_RESOURCE:
return representInformationResource();
case NON_INFORMATION_RESOURCE:
return representNonInformationResource(type);
default:
throw new IllegalStateException("no such resource type: " + webResourceCategory);
}
}
代码示例来源:origin: org.restlet.osgi/org.restlet
request.getResourceRef().getHostIdentifier());
request.getResourceRef().getHostIdentifier());
代码示例来源:origin: org.restlet.osgi/org.restlet
/**
* Allows filtering before processing by the next Restlet. Set the base
* reference.
*
* @param request
* The request to handle.
* @param response
* The response to update.
* @return The continuation status.
*/
@Override
protected int beforeHandle(Request request, Response response) {
if (request.getHostRef() == null) {
request.getResourceRef().setBaseRef(
request.getResourceRef().getHostIdentifier());
} else {
request.getResourceRef().setBaseRef(request.getHostRef());
}
if (request.isLoggable() && getLogger().isLoggable(Level.FINE)) {
getLogger().fine(
"Base URI: \"" + request.getResourceRef().getBaseRef()
+ "\". Remaining part: \""
+ request.getResourceRef().getRemainingPart()
+ "\"");
}
return CONTINUE;
}
代码示例来源:origin: org.restlet.osgi/org.restlet
.getChild();
request.getResourceRef().setBaseRef(
request.getResourceRef().getHostIdentifier());
application.getInboundRoot().handle(request, response);
内容来源于网络,如有侵权,请联系作者删除!