/** * 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); }
/** * 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); }
/** * 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); }
/** * 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)); } }
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); }
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; }
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 ); }
request.setResourceRef( url.toString() ); request.setMethod( method );
request.setResourceRef(url.toString()); request.setMethod(method);
request.setResourceRef(targetRef); request.getAttributes().remove("org.restlet.http.headers"); getContext().getClientDispatcher().handle(request, response);
request.setResourceRef( url.toString() ); request.setMethod( method );