org.restlet.data.Request.setResourceRef()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(4.0k)|赞(0)|评价(0)|浏览(305)

本文整理了Java中org.restlet.data.Request.setResourceRef方法的一些代码示例,展示了Request.setResourceRef的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Request.setResourceRef方法的具体详情如下:
包路径:org.restlet.data.Request
类名称:Request
方法名:setResourceRef

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/org.restlet

  1. /**
  2. * Sets the target resource reference using an URI string. Note that the URI
  3. * can be either absolute or relative to the context's base reference.
  4. *
  5. * @param resourceUri
  6. * The resource URI.
  7. */
  8. @Override
  9. public void setResourceRef(String resourceUri) {
  10. getWrappedRequest().setResourceRef(resourceUri);
  11. }

代码示例来源:origin: org.restlet/org.restlet

  1. /**
  2. * Sets the target resource reference. If the reference is relative, it will
  3. * be resolved as an absolute reference. Also, the context's base reference
  4. * will be reset. Finally, the reference will be normalized to ensure a
  5. * consistent handling of the call.
  6. *
  7. * @param resourceRef
  8. * The resource reference.
  9. */
  10. @Override
  11. public void setResourceRef(Reference resourceRef) {
  12. getWrappedRequest().setResourceRef(resourceRef);
  13. }

代码示例来源:origin: org.restlet/org.restlet

  1. /**
  2. * Constructor.
  3. *
  4. * @param method
  5. * The call's method.
  6. * @param resourceRef
  7. * The resource reference.
  8. * @param entity
  9. * The entity.
  10. */
  11. public Request(Method method, Reference resourceRef, Representation entity) {
  12. super(entity);
  13. setMethod(method);
  14. setResourceRef(resourceRef);
  15. }

代码示例来源:origin: org.restlet/org.restlet

  1. /**
  2. * Sets the target resource reference using an URI string. Note that the URI
  3. * can be either absolute or relative to the context's base reference.
  4. *
  5. * @param resourceUri
  6. * The resource URI.
  7. * @see #setResourceRef(Reference)
  8. */
  9. public void setResourceRef(String resourceUri) {
  10. if (getResourceRef() != null) {
  11. // Allow usage of URIs relative to the current base reference
  12. setResourceRef(new Reference(getResourceRef().getBaseRef(),
  13. resourceUri));
  14. } else {
  15. setResourceRef(new Reference(resourceUri));
  16. }
  17. }

代码示例来源:origin: org.geoserver.extension/monitor-core

  1. void setKVP(Request req, String... kvp) {
  2. Reference ref = new Reference();
  3. StringBuffer sb = new StringBuffer();
  4. for (int i = 0; i < kvp.length; i += 2) {
  5. sb.append(kvp[i]).append("=").append(kvp[i+1]).append("&");
  6. }
  7. sb.setLength(sb.length()-1);
  8. ref.setQuery(sb.toString());
  9. req.setResourceRef(ref);
  10. }

代码示例来源:origin: uk.org.mygrid.remotetaverna/taverna-rest-client

  1. private Request makeRequest(Reference uri, MediaType accepts) {
  2. Request request = new Request();
  3. logger.debug("Making new request for " + uri + " -- " + uri.getTargetRef());
  4. request.setResourceRef(uri.getTargetRef());
  5. if (accepts != null) {
  6. request.getClientInfo().getAcceptedMediaTypes().add(
  7. new Preference<MediaType>(accepts));
  8. }
  9. if (baseURI.isParent(uri) && username != null) {
  10. logger.debug("Authenticating as " + username);
  11. ChallengeResponse challengeResponse =
  12. new ChallengeResponse(ChallengeScheme.HTTP_BASIC, username,
  13. password);
  14. request.setChallengeResponse(challengeResponse);
  15. } else {
  16. logger.warn("Not supplying credentials for out-of-site URI " + uri);
  17. }
  18. return request;
  19. }

代码示例来源:origin: org.sonatype.nexus/nexus-rest-client-java

  1. public Response sendRequest( Method method, String url, Representation representation )
  2. {
  3. this.logger.debug( "Method: " + method.getName() + " url: " + url );
  4. Request request = new Request();
  5. request.setResourceRef( url );
  6. request.setMethod( method );
  7. if ( !Method.GET.equals( method ) && !Method.DELETE.equals( method ) )
  8. {
  9. request.setEntity( representation );
  10. }
  11. request.setChallengeResponse( this.challenge );
  12. return this.restClient.handle( request );
  13. }

代码示例来源:origin: org.sonatype.nexus/nexus-test-utils

  1. request.setResourceRef( url.toString() );
  2. request.setMethod( method );

代码示例来源:origin: org.sonatype.nexus/nexus-test-harness-launcher

  1. request.setResourceRef(url.toString());
  2. request.setMethod(method);

代码示例来源:origin: org.restlet/org.restlet

  1. request.setResourceRef(targetRef);
  2. request.getAttributes().remove("org.restlet.http.headers");
  3. getContext().getClientDispatcher().handle(request, response);

代码示例来源:origin: org.sonatype.nexus/nexus-test-harness-base

  1. request.setResourceRef( url.toString() );
  2. request.setMethod( method );

相关文章