/** * Create an HTTP POST builder with the given url. * @param url the URL * @return the created builder */ public static BodyBuilder post(URI url) { return method(HttpMethod.POST, url); }
/** * Create an HTTP PATCH builder with the given url. * @param url the URL * @return the created builder */ public static BodyBuilder patch(URI url) { return method(HttpMethod.PATCH, url); }
/** * Create an HTTP GET builder with the given url. * @param url the URL * @return the created builder */ public static HeadersBuilder<?> get(URI url) { return method(HttpMethod.GET, url); }
/** * Create an HTTP HEAD builder with the given url. * @param url the URL * @return the created builder */ public static HeadersBuilder<?> head(URI url) { return method(HttpMethod.HEAD, url); }
/** * Create an HTTP PUT builder with the given url. * @param url the URL * @return the created builder */ public static BodyBuilder put(URI url) { return method(HttpMethod.PUT, url); }
/** * Create an HTTP DELETE builder with the given url. * @param url the URL * @return the created builder */ public static HeadersBuilder<?> delete(URI url) { return method(HttpMethod.DELETE, url); }
/** * Creates an HTTP OPTIONS builder with the given url. * @param url the URL * @return the created builder */ public static HeadersBuilder<?> options(URI url) { return method(HttpMethod.OPTIONS, url); }
/** * Create an HTTP PATCH builder with the given url. * @param url the URL * @return the created builder */ public static BodyBuilder patch(URI url) { return method(HttpMethod.PATCH, url); }
/** * Create an HTTP GET builder with the given url. * @param url the URL * @return the created builder */ public static HeadersBuilder<?> get(URI url) { return method(HttpMethod.GET, url); }
/** * Create an HTTP HEAD builder with the given url. * @param url the URL * @return the created builder */ public static HeadersBuilder<?> head(URI url) { return method(HttpMethod.HEAD, url); }
/** * Create an HTTP POST builder with the given url. * @param url the URL * @return the created builder */ public static BodyBuilder post(URI url) { return method(HttpMethod.POST, url); }
/** * Create an HTTP DELETE builder with the given url. * @param url the URL * @return the created builder */ public static HeadersBuilder<?> delete(URI url) { return method(HttpMethod.DELETE, url); }
/** * Creates an HTTP OPTIONS builder with the given url. * @param url the URL * @return the created builder */ public static HeadersBuilder<?> options(URI url) { return method(HttpMethod.OPTIONS, url); }
/** * Create an HTTP PUT builder with the given url. * @param url the URL * @return the created builder */ public static BodyBuilder put(URI url) { return method(HttpMethod.PUT, url); }
final BodyBuilder requestBuilder = RequestEntity.method(method, builder.build().toUri()); if(accept != null) { requestBuilder.accept(accept.toArray(new MediaType[accept.size()]));
@Test public void normal() throws URISyntaxException { String headerName = "My-Custom-Header"; String headerValue = "HeaderValue"; URI url = new URI("http://example.com"); Integer entity = 42; RequestEntity<Object> requestEntity = RequestEntity.method(HttpMethod.GET, url) .header(headerName, headerValue).body(entity); assertNotNull(requestEntity); assertEquals(HttpMethod.GET, requestEntity.getMethod()); assertTrue(requestEntity.getHeaders().containsKey(headerName)); assertEquals(headerValue, requestEntity.getHeaders().getFirst(headerName)); assertEquals(entity, requestEntity.getBody()); }
/** * Create an HTTP HEAD builder with the given url. * @param url the URL * @return the created builder */ public static HeadersBuilder<?> head(URI url) { return method(HttpMethod.HEAD, url); }
/** * Creates an HTTP OPTIONS builder with the given url. * @param url the URL * @return the created builder */ public static HeadersBuilder<?> options(URI url) { return method(HttpMethod.OPTIONS, url); }
/** * Create an HTTP PUT builder with the given url. * @param url the URL * @return the created builder */ public static BodyBuilder put(URI url) { return method(HttpMethod.PUT, url); }
/** * Create an HTTP PATCH builder with the given url. * @param url the URL * @return the created builder */ public static BodyBuilder patch(URI url) { return method(HttpMethod.PATCH, url); }