本文整理了Java中org.restlet.data.Reference.getRelativeRef
方法的一些代码示例,展示了Reference.getRelativeRef
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Reference.getRelativeRef
方法的具体详情如下:
包路径:org.restlet.data.Reference
类名称:Reference
方法名:getRelativeRef
[英]Returns the current reference as a relative reference to the current base reference. This method should only be invoked for absolute references, otherwise an IllegalArgumentException will be raised.
[中]将当前引用作为当前基本引用的相对引用返回。只能对绝对引用调用此方法,否则将引发IllegalArgumentException。
代码示例来源:origin: org.restlet/org.restlet
/**
* Returns the current reference as a relative reference to the current base
* reference. This method should only be invoked for absolute references,
* otherwise an IllegalArgumentException will be raised.
*
* @return The current reference as a relative reference to the current base
* reference.
* @see #getRelativeRef(Reference)
*/
public Reference getRelativeRef() {
return getRelativeRef(getBaseRef());
}
代码示例来源:origin: org.restlet.osgi/org.restlet
/**
* Returns the current reference as a relative reference to the current base
* reference. This method should only be invoked for absolute references,
* otherwise an IllegalArgumentException will be raised.
*
* @return The current reference as a relative reference to the current base
* reference.
* @see #getRelativeRef(Reference)
*/
public Reference getRelativeRef() {
return getRelativeRef(getBaseRef());
}
代码示例来源:origin: DeviceConnect/DeviceConnect-Android
/**
* Returns the current reference as a relative reference to the current base
* reference. This method should only be invoked for absolute references,
* otherwise an IllegalArgumentException will be raised.
*
* @return The current reference as a relative reference to the current base
* reference.
* @see #getRelativeRef(Reference)
*/
public Reference getRelativeRef() {
return getRelativeRef(getBaseRef());
}
代码示例来源:origin: apache/helix
private String getZKPath() {
String relativeRef = getRequest().getResourceRef().getRelativeRef().toString();
if (relativeRef.equals(".")) {
relativeRef = "";
}
// strip off trailing "/"
while (relativeRef.endsWith("/")) {
relativeRef = relativeRef.substring(0, relativeRef.length() - 1);
}
return "/" + relativeRef;
}
代码示例来源:origin: apache/helix
private String getZKPath() {
String relativeRef = getRequest().getResourceRef().getRelativeRef().toString();
if (relativeRef.equals(".")) {
relativeRef = "";
}
// strip off trailing "/"
while (relativeRef.endsWith("/")) {
relativeRef = relativeRef.substring(0, relativeRef.length() - 1);
}
return "/" + relativeRef;
}
代码示例来源:origin: org.restlet.jee/org.restlet.ext.jaxrs
/**
* Creates an unmodifiable List of {@link PathSegment}s.
*
* @param decode
* indicates, if the values should be decoded or not
* @return
*/
private List<PathSegment> createPathSegments(boolean decode) {
List<String> segmentsEnc;
segmentsEnc = this.referenceOriginal.getRelativeRef().getSegments();
final int l = segmentsEnc.size();
final List<PathSegment> pathSegments = new ArrayList<PathSegment>(l);
for (int i = 0; i < l; i++) {
final String segmentEnc = segmentsEnc.get(i);
pathSegments.add(new PathSegmentImpl(segmentEnc, decode, i));
}
return Collections.unmodifiableList(pathSegments);
}
代码示例来源:origin: org.restlet.jee/org.restlet.ext.jaxrs
/**
* Get the path of the current request relative to the base URI as a string.
*
* @param decode
* controls whether sequences of escaped octets are decoded
* (true) or not (false).
* @return the relative URI path.
* @see UriInfo#getPath(boolean)
*/
public String getPath(boolean decode) {
final String path = this.referenceOriginal.getRelativeRef().toString(
true, true);
if (!decode) {
return path;
}
return Reference.decode(path);
}
代码示例来源:origin: DeviceConnect/DeviceConnect-Android
/**
* Returns a representation of the list in "text/html" format.
*
* @return A representation of the list in "text/html" format.
*/
public Representation getWebRepresentation() {
// Create a simple HTML list
final StringBuilder sb = new StringBuilder();
sb.append("<html><body style=\"font-family: sans-serif;\">\n");
if (getIdentifier() != null) {
sb.append("<h2>Listing of \"" + getIdentifier().getPath()
+ "\"</h2>\n");
final Reference parentRef = getIdentifier().getParentRef();
if (!parentRef.equals(getIdentifier())) {
sb.append("<a href=\"" + parentRef + "\">..</a><br>\n");
}
} else {
sb.append("<h2>List of references</h2>\n");
}
for (final Reference ref : this) {
sb.append("<a href=\"" + ref.toString() + "\">"
+ ref.getRelativeRef(getIdentifier()) + "</a><br>\n");
}
sb.append("</body></html>\n");
return new StringRepresentation(sb.toString(), MediaType.TEXT_HTML);
}
代码示例来源:origin: org.restlet.osgi/org.restlet
/**
* Returns a representation of the list in "text/html" format.
*
* @return A representation of the list in "text/html" format.
*/
public Representation getWebRepresentation() {
// Create a simple HTML list
final StringBuilder sb = new StringBuilder();
sb.append("<html><body style=\"font-family: sans-serif;\">\n");
if (getIdentifier() != null) {
sb.append("<h2>Listing of \"" + getIdentifier().getPath()
+ "\"</h2>\n");
final Reference parentRef = getIdentifier().getParentRef();
if (!parentRef.equals(getIdentifier())) {
sb.append("<a href=\"" + parentRef + "\">..</a><br>\n");
}
} else {
sb.append("<h2>List of references</h2>\n");
}
for (final Reference ref : this) {
sb.append("<a href=\"" + ref.toString() + "\">"
+ ref.getRelativeRef(getIdentifier()) + "</a><br>\n");
}
sb.append("</body></html>\n");
return new StringRepresentation(sb.toString(), MediaType.TEXT_HTML);
}
代码示例来源:origin: org.restlet/org.restlet
/**
* Returns a representation of the list in "text/html" format.
*
* @return A representation of the list in "text/html" format.
*/
public Representation getWebRepresentation() {
// Create a simple HTML list
final StringBuilder sb = new StringBuilder();
sb.append("<html><body>\n");
if (getIdentifier() != null) {
sb.append("<h2>Listing of \"" + getIdentifier().getPath()
+ "\"</h2>\n");
final Reference parentRef = getIdentifier().getParentRef();
if (!parentRef.equals(getIdentifier())) {
sb.append("<a href=\"" + parentRef + "\">..</a><br>\n");
}
} else {
sb.append("<h2>List of references</h2>\n");
}
for (final Reference ref : this) {
sb.append("<a href=\"" + ref.toString() + "\">"
+ ref.getRelativeRef(getIdentifier()) + "</a><br>\n");
}
sb.append("</body></html>\n");
return new StringRepresentation(sb.toString(), MediaType.TEXT_HTML);
}
代码示例来源:origin: org.restlet.jee/org.restlet.ext.jaxrs
/**
* Creates a RESTEasy URI info object.
*
* @return A RESTEasy URI info object.
*/
protected ResteasyUriInfo createUriInfo() {
try {
return new ResteasyUriInfo(getRequest().getResourceRef()
.getBaseRef().toUri(), new URI(getRequest()
.getResourceRef().getRelativeRef().toString()));
} catch (URISyntaxException e) {
Context.getCurrentLogger().log(Level.WARNING,
"Unable to parse the URI.", e);
return null;
}
}
代码示例来源:origin: org.apache.polygene.libraries/org.apache.polygene.library.rest-server
.equals( "riap" ) ? ref.getRelativeRef( new Reference( "riap://application/" ) )
.getSegments() : ref.getRelativeRef().getSegments();
代码示例来源:origin: org.qi4j.library/org.qi4j.library.rest-server
.equals( "riap" ) ? ref.getRelativeRef( new Reference( "riap://application/" ) )
.getSegments() : ref.getRelativeRef().getSegments();
代码示例来源:origin: apache/attic-polygene-java
.equals( "riap" ) ? ref.getRelativeRef( new Reference( "riap://application/" ) )
.getSegments() : ref.getRelativeRef().getSegments();
内容来源于网络,如有侵权,请联系作者删除!