本文整理了Java中org.restlet.data.Reference.isRelative
方法的一些代码示例,展示了Reference.isRelative
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Reference.isRelative
方法的具体详情如下:
包路径:org.restlet.data.Reference
类名称:Reference
方法名:isRelative
[英]Indicates if the reference is relative.
[中]指示引用是否是相对的。
代码示例来源:origin: org.restlet.osgi/org.restlet
/**
* Indicates if the identifier is hierarchical.
*
* @return True if the identifier is hierarchical, false if it is opaque.
*/
public boolean isHierarchical() {
return isRelative() || (getSchemeSpecificPart().charAt(0) == '/');
}
代码示例来源:origin: org.restlet/org.restlet
/**
* Returns the relative part of relative references, without the query and
* fragment. If the reference is absolute, then null is returned.<br>
* Note that no URI decoding is done by this method.
*
* @return The relative part.
*/
public String getRelativePart() {
return isRelative() ? toString(false, false) : null;
}
代码示例来源:origin: org.restlet/org.restlet
/**
* Indicates if the identifier is hierarchical.
*
* @return True if the identifier is hierarchical, false if it is opaque.
*/
public boolean isHierarchical() {
return isRelative() || (getSchemeSpecificPart().charAt(0) == '/');
}
代码示例来源:origin: org.restlet.osgi/org.restlet
/**
* Returns the relative part of relative references, without the query and
* fragment. If the reference is absolute, then null is returned.<br>
* Note that no URI decoding is done by this method.
*
* @return The relative part.
*/
public String getRelativePart() {
return isRelative() ? toString(false, false) : null;
}
代码示例来源:origin: DeviceConnect/DeviceConnect-Android
/**
* Returns the relative part of relative references, without the query and
* fragment. If the reference is absolute, then null is returned.<br>
* Note that no URI decoding is done by this method.
*
* @return The relative part.
*/
public String getRelativePart() {
return isRelative() ? toString(false, false) : null;
}
代码示例来源:origin: DeviceConnect/DeviceConnect-Android
/**
* Indicates if the identifier is hierarchical.
*
* @return True if the identifier is hierarchical, false if it is opaque.
*/
public boolean isHierarchical() {
return isRelative() || (getSchemeSpecificPart().charAt(0) == '/');
}
代码示例来源:origin: org.restlet.osgi/org.restlet
/**
* Returns the authority component for hierarchical identifiers. Includes
* the user info, host name and the host port number.<br>
* Note that no URI decoding is done by this method.
*
* @return The authority component for hierarchical identifiers.
*/
public String getAuthority() {
final String part = isRelative() ? getRelativePart()
: getSchemeSpecificPart();
if ((part != null) && part.startsWith("//")) {
int index = part.indexOf('/', 2);
if (index != -1) {
return part.substring(2, index);
}
index = part.indexOf('?');
if (index != -1) {
return part.substring(2, index);
}
return part.substring(2);
}
return null;
}
代码示例来源:origin: org.restlet/org.restlet
/**
* Returns the authority component for hierarchical identifiers. Includes
* the user info, host name and the host port number.<br>
* Note that no URI decoding is done by this method.
*
* @return The authority component for hierarchical identifiers.
*/
public String getAuthority() {
final String part = isRelative() ? getRelativePart()
: getSchemeSpecificPart();
if ((part != null) && part.startsWith("//")) {
int index = part.indexOf('/', 2);
if (index != -1) {
return part.substring(2, index);
}
index = part.indexOf('?');
if (index != -1) {
return part.substring(2, index);
}
return part.substring(2);
}
return null;
}
代码示例来源:origin: DeviceConnect/DeviceConnect-Android
/**
* Returns the authority component for hierarchical identifiers. Includes
* the user info, host name and the host port number.<br>
* Note that no URI decoding is done by this method.
*
* @return The authority component for hierarchical identifiers.
*/
public String getAuthority() {
final String part = isRelative() ? getRelativePart()
: getSchemeSpecificPart();
if ((part != null) && part.startsWith("//")) {
int index = part.indexOf('/', 2);
if (index != -1) {
return part.substring(2, index);
}
index = part.indexOf('?');
if (index != -1) {
return part.substring(2, index);
}
return part.substring(2);
}
return null;
}
代码示例来源:origin: DeviceConnect/DeviceConnect-Android
String part = isRelative() ? getRelativePart()
: getSchemeSpecificPart();
代码示例来源:origin: org.restlet.osgi/org.restlet
String part = isRelative() ? getRelativePart()
: getSchemeSpecificPart();
代码示例来源:origin: org.restlet/org.restlet
final String oldPart = isRelative() ? getRelativePart()
: getSchemeSpecificPart();
String newPart;
代码示例来源:origin: org.restlet.osgi/org.restlet
final String oldPart = isRelative() ? getRelativePart()
: getSchemeSpecificPart();
String newPart;
代码示例来源:origin: DeviceConnect/DeviceConnect-Android
final String oldPart = isRelative() ? getRelativePart()
: getSchemeSpecificPart();
String newPart;
代码示例来源:origin: apache/attic-polygene-java
HandlerCommand query( Link link, Object queryRequest, ResponseHandler handler, ResponseHandler processingErrorHandler )
{
if (handler == null)
handler = queryHandlers.get( link.rel().get() );
if (handler == null)
throw new IllegalArgumentException( "No handler set for relation "+link.rel().get() );
if (processingErrorHandler == null)
processingErrorHandler = processingErrorHandlers.get( link.rel().get() );
Reference linkRef = new Reference(link.href().get());
if (linkRef.isRelative())
linkRef = new Reference( reference.toUri().toString() + link.href().get() );
return invokeQuery( linkRef, queryRequest, handler, processingErrorHandler );
}
代码示例来源:origin: org.restlet.osgi/org.restlet
/**
* Returns the child resource defined by its URI relatively to the current
* resource. The child resource is defined in the sense of hierarchical
* URIs. If the resource URI is not hierarchical, then an exception is
* thrown.
*
* @param relativeRef
* The URI reference of the child resource relatively to the
* current resource seen as the parent resource.
* @return The child resource.
* @throws ResourceException
*/
public ClientResource getChild(Reference relativeRef)
throws ResourceException {
ClientResource result = null;
if ((relativeRef != null) && relativeRef.isRelative()) {
result = new ClientResource(this);
result.setReference(new Reference(getReference().getTargetRef(),
relativeRef).getTargetRef());
} else {
doError(Status.CLIENT_ERROR_BAD_REQUEST, "The child URI is not relative.");
}
return result;
}
代码示例来源:origin: org.restlet.osgi/org.restlet
/**
* Returns the target reference to redirect to by automatically resolving
* URI template variables found using the {@link Template} class using the
* request and response as data models.
*
* @param request
* The request to handle.
* @param response
* The response to update.
* @return The target reference to redirect to.
*/
protected Reference getTargetRef(Request request, Response response) {
// Create the template
Template rt = new Template(this.targetTemplate);
rt.setLogger(getLogger());
// Return the formatted target URI
if (new Reference(this.targetTemplate).isRelative()) {
// Be sure to keep the resource's base reference.
return new Reference(request.getResourceRef(), rt.format(request,
response));
}
return new Reference(rt.format(request, response));
}
代码示例来源:origin: org.restlet.android/org.restlet.ext.atom
/**
* Returns the feed representation.
*
* @return The feed representation.
* @throws Exception
*/
public Feed getFeed() throws Exception {
final Reference feedRef = getHref();
if (feedRef.isRelative()) {
feedRef.setBaseRef(getWorkspace().getService().getReference());
}
final Request request = new Request(Method.GET, feedRef.getTargetRef());
final Response response = getWorkspace().getService()
.getClientDispatcher().handle(request);
if (response.getStatus().equals(Status.SUCCESS_OK)) {
return new Feed(response.getEntity());
}
throw new Exception(
"Couldn't get the feed representation. Status returned: "
+ response.getStatus());
}
代码示例来源:origin: org.restlet.jee/org.restlet.ext.atom
/**
* Returns the feed representation.
*
* @return The feed representation.
* @throws Exception
*/
public Feed getFeed() throws Exception {
final Reference feedRef = getHref();
if (feedRef.isRelative()) {
feedRef.setBaseRef(getWorkspace().getService().getReference());
}
final Request request = new Request(Method.GET, feedRef.getTargetRef());
final Response response = getWorkspace().getService()
.getClientDispatcher().handle(request);
if (response.getStatus().equals(Status.SUCCESS_OK)) {
return new Feed(response.getEntity());
}
throw new Exception(
"Couldn't get the feed representation. Status returned: "
+ response.getStatus());
}
代码示例来源:origin: org.restlet/org.restlet.ext.atom
/**
* Returns the feed representation.
*
* @return The feed representation.
* @throws Exception
*/
public Feed getFeed() throws Exception {
final Reference feedRef = getHref();
if (feedRef.isRelative()) {
feedRef.setBaseRef(getWorkspace().getService().getReference());
}
final Request request = new Request(Method.GET, feedRef.getTargetRef());
final Response response = getWorkspace().getService()
.getClientDispatcher().handle(request);
if (response.getStatus().equals(Status.SUCCESS_OK)) {
return new Feed(response.getEntity());
} else {
throw new Exception(
"Couldn't get the feed representation. Status returned: "
+ response.getStatus().getDescription());
}
}
内容来源于网络,如有侵权,请联系作者删除!