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

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

本文整理了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

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

/**
 * Constructor.
 * 
 * @param method
 *            The call's method.
 * @param resourceRef
 *            The resource reference.
 * @param entity
 *            The entity.
 */
public Request(Method method, Reference resourceRef, Representation entity) {
  super(entity);
  setMethod(method);
  setResourceRef(resourceRef);
}

代码示例来源:origin: org.restlet/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.geoserver.extension/monitor-core

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

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

private Request makeRequest(Reference uri, MediaType accepts) {
  Request request = new Request();
  logger.debug("Making new request for " + uri + " -- " + uri.getTargetRef());
  request.setResourceRef(uri.getTargetRef());
  if (accepts != null) {
    request.getClientInfo().getAcceptedMediaTypes().add(
      new Preference<MediaType>(accepts));
  }
  if (baseURI.isParent(uri) && username != null) {
    logger.debug("Authenticating as " + username);
    ChallengeResponse challengeResponse =
      new ChallengeResponse(ChallengeScheme.HTTP_BASIC, username,
        password);
    request.setChallengeResponse(challengeResponse);
  } else {
    logger.warn("Not supplying credentials for out-of-site URI " + uri);
  }
  return request;
}

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

public Response sendRequest( Method method, String url, Representation representation )
{
  this.logger.debug( "Method: " + method.getName() + " url: " + url );
  Request request = new Request();
  request.setResourceRef( url );
  request.setMethod( method );
  if ( !Method.GET.equals( method ) && !Method.DELETE.equals( method ) )
  {
    request.setEntity( representation );
  }
  request.setChallengeResponse( this.challenge );
  return this.restClient.handle( request );
}

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

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

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

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

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

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

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

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

相关文章