本文整理了Java中org.restlet.Request.setResourceRef
方法的一些代码示例,展示了Request.setResourceRef
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Request.setResourceRef
方法的具体详情如下:
包路径:org.restlet.Request
类名称:Request
方法名:setResourceRef
[英]Sets the target resource reference using an URI string. Note that the URI can be either absolute or relative to the context's base reference.
[中]使用URI字符串设置目标资源引用。请注意,URI可以是绝对的,也可以是相对于上下文的基引用的。
代码示例来源:origin: org.restlet.osgi/org.restlet
/**
* Sets the target resource reference. If the reference is relative, it will
* be resolved as an absolute reference. Also, the context's base reference
* will be reset. Finally, the reference will be normalized to ensure a
* consistent handling of the call.
*
* @param resourceRef
* The resource reference.
*/
@Override
public void setResourceRef(Reference resourceRef) {
getWrappedRequest().setResourceRef(resourceRef);
}
代码示例来源:origin: org.restlet.osgi/org.restlet
/**
* Sets the target resource reference using an URI string. Note that the URI
* can be either absolute or relative to the context's base reference.
*
* @param resourceUri
* The resource URI.
*/
@Override
public void setResourceRef(String resourceUri) {
getWrappedRequest().setResourceRef(resourceUri);
}
代码示例来源:origin: org.restlet.osgi/org.restlet
/**
* Sets the resource's reference using an URI string. Note that the URI can
* be either absolute or relative to the context's base reference.
*
* @param uri
* The resource URI.
* @see Request#setResourceRef(String)
*/
public void setReference(String uri) {
getRequest().setResourceRef(uri);
}
代码示例来源:origin: org.restlet.osgi/org.restlet
/**
* Sets the resource's reference. If the reference is relative, it will be
* resolved as an absolute reference. Also, the context's base reference
* will be reset. Finally, the reference will be normalized to ensure a
* consistent handling of the call.
*
* @param reference
* The resource reference.
* @see Request#setResourceRef(Reference)
*/
public void setReference(Reference reference) {
getRequest().setResourceRef(reference);
}
代码示例来源:origin: org.restlet.jee/org.restlet.ext.jaxrs
@Override
public void setRequestUri(URI uri) throws IllegalStateException {
getRequest().setResourceRef(new Reference(uri));
}
代码示例来源:origin: org.restlet.jee/org.restlet.ext.jaxrs
@Override
public void setRequestUri(URI baseUri, URI requestUri)
throws IllegalStateException {
getRequest().setResourceRef(new Reference(baseUri, requestUri));
}
代码示例来源:origin: org.restlet.osgi/org.restlet
/**
* Sets the target resource reference using an URI string. Note that the URI
* can be either absolute or relative to the context's base reference.
*
* @param resourceUri
* The resource URI.
* @see #setResourceRef(Reference)
*/
public void setResourceRef(String resourceUri) {
if (getResourceRef() != null) {
// Allow usage of URIs relative to the current base reference
setResourceRef(new Reference(getResourceRef().getBaseRef(),
resourceUri));
} else {
setResourceRef(new Reference(resourceUri));
}
}
代码示例来源:origin: org.restlet.osgi/org.restlet
request.setResourceRef(newTargetRef);
handle(request, response, references, 0, next);
代码示例来源:origin: org.restlet.osgi/org.restlet
request.setResourceRef(targetRef);
rewrite(request);
next.handle(request, response);
request.setResourceRef(resourceRef);
代码示例来源:origin: org.restlet.osgi/org.restlet
/**
* Handles the call after resolving any URI template on the request's target
* resource reference.
*
* @param request
* The request to handle.
* @param response
* The response to update.
*/
public int beforeHandle(Request request, Response response) {
// Associate the response to the current thread
Protocol protocol = request.getProtocol();
if (protocol == null) {
throw new UnsupportedOperationException(
"Unable to determine the protocol to use for this call.");
}
String targetUri = request.getResourceRef().toString(true, false);
if (targetUri.contains("{")) {
// Template URI detected, create the template
Template template = new Template(targetUri);
// Set the formatted target URI
request.setResourceRef(template.format(request, response));
}
request.setOriginalRef(ReferenceUtils.getOriginalRef(request.getResourceRef(), request.getHeaders()));
return CONTINUE;
}
代码示例来源:origin: org.restlet.osgi/org.restlet
@Override
public Representation put(Representation entity) throws ResourceException {
if (!this.directory.isModifiable()) {
setStatus(Status.CLIENT_ERROR_METHOD_NOT_ALLOWED, "The directory is not modifiable.");
return null;
}
// Transfer of PUT calls is only allowed if the readOnly flag is not set.
Request contextRequest = new Request(Method.PUT, this.targetUri);
// Add support of partial PUT calls.
contextRequest.getRanges().addAll(getRanges());
contextRequest.setEntity(entity);
Response contextResponse = new Response(contextRequest);
contextRequest.setResourceRef(this.targetUri);
getClientDispatcher().handle(contextRequest, contextResponse);
setStatus(contextResponse.getStatus());
return null;
}
代码示例来源:origin: DeviceConnect/DeviceConnect-Android
request.setResourceRef(requestReference);
Response response = new Response(request);
LoginPageServerResource.init(request, response);
代码示例来源:origin: org.restlet.jse/org.restlet.example
request.setResourceRef(targetRef);
SipRequest r = new SipRequest((SipRequest) request);
代码示例来源:origin: org.restlet.osgi/org.restlet
contextRequest.setResourceRef(this.targetUri);
getClientDispatcher().handle(contextRequest, contextResponse);
} else if (this.uniqueReference != null) {
contextRequest.setResourceRef(this.uniqueReference);
getClientDispatcher().handle(contextRequest, contextResponse);
setStatus(contextResponse.getStatus());
代码示例来源:origin: org.restlet.jse/org.restlet.example
response.getAttributes().remove(
HeaderConstants.ATTRIBUTE_HEADERS);
request.setResourceRef(resourceRef);
代码示例来源:origin: org.restlet.jee/org.restlet.ext.wadl
request.setResourceRef(rr);
代码示例来源:origin: org.restlet.jse/org.restlet.example
/**
* Unit test for virtual hosts.
*
* @throws Exception
*/
public void testVirtualHost() throws Exception {
// Instantiate our Restlet component
MailServerComponent component = new MailServerComponent();
// Prepare a mock HTTP call
Request request = new Request();
request.setMethod(Method.GET);
request.setResourceRef("http://www.rmep.org/accounts/");
request.setHostRef("http://www.rmep.org");
Response response = new Response(request);
response.getServerInfo().setAddress("1.2.3.10");
response.getServerInfo().setPort(80);
component.handle(request, response);
// Test if response was successful
assertTrue(response.getStatus().isSuccess());
}
代码示例来源:origin: DeviceConnect/DeviceConnect-Android
request.setOriginalRef(new Reference(DUMMY_ORIGINAL_REF));
Response response = new Response(request);
request.setResourceRef(new Reference(DUMMY_REFERENCE));
内容来源于网络,如有侵权,请联系作者删除!