/** * Used when following links ( * {@link RestfulClient#follow(LinkRepresentation)}). */ public ClientRequestConfigurer configureArgs(final JsonRepresentation requestArgs) { if (clientRequest.getHttpMethod() == null) { throw new IllegalStateException("Must set up http method first"); } getHttpMethod().setUpArgs(this, requestArgs); return this; }
/** * Used when creating a request with arguments to execute. * * <p> * Typical flow is: * <ul> * <li> {@link RestfulClient#createRequest(RestfulHttpMethod, String)} * <li> {@link RestfulRequest#withArg(RequestParameter, Object)} for each arg * <li> {@link RestfulRequest#execute()} - which calls this method. * </ul> */ public ClientRequestConfigurer configureArgs(final Map<RequestParameter<?>, Object> args) { if (clientRequest.getHttpMethod() == null) { throw new IllegalStateException("Must set up http method first"); } final JsonRepresentation argsAsMap = JsonRepresentation.newMap(); for (final RequestParameter<?> requestParam : args.keySet()) { put(args, requestParam, argsAsMap); } getHttpMethod().setUpArgs(this, argsAsMap); return this; }
private void setsUpQueryString(final RestfulHttpMethod httpMethod) throws UnsupportedEncodingException { context.checking(new Expectations() { { one(requestConfigurer).setHttpMethod(httpMethod); one(requestConfigurer).queryString(repr); } }); httpMethod.setUpArgs(requestConfigurer, repr); }
private void setsUpBody(final RestfulHttpMethod httpMethod) throws UnsupportedEncodingException { context.checking(new Expectations() { { one(requestConfigurer).setHttpMethod(httpMethod); one(requestConfigurer).body(repr); } }); httpMethod.setUpArgs(requestConfigurer, repr); }
private void setsUpQueryString(final RestfulHttpMethod httpMethod) throws UnsupportedEncodingException { context.checking(new Expectations() { { one(requestConfigurer).setHttpMethod(httpMethod); one(requestConfigurer).queryString(repr); } }); httpMethod.setUpArgs(requestConfigurer, repr); }
private void setsUpBody(final RestfulHttpMethod httpMethod) throws UnsupportedEncodingException { context.checking(new Expectations() { { one(requestConfigurer).setHttpMethod(httpMethod); one(requestConfigurer).body(repr); } }); httpMethod.setUpArgs(requestConfigurer, repr); }