/** * Creates a request with the GET method. * * @param uri URI * @return {@code this} */ public static <T> Builder get(String uri) { return new Builder(GET, uri); }
/** * Creates an HTTP response builder with a status of 200 OK and empty body. * * @return a new builder */ public static Builder response() { return new Builder(); }
/** * Creates a request with the PUT method. * * @param uri URI * @return {@code this} */ public static Builder put(String uri) { return new Builder(PUT, uri); }
/** * Enables Keep-Alive. * * @return {@code this} */ public Builder enableKeepAlive() { return header(CONNECTION, KEEP_ALIVE); }
/** * Enables Keep-Alive. * * @return {@code this} */ public Builder enableKeepAlive() { return header(CONNECTION, KEEP_ALIVE); }
/** * Returns the value of the {@code 'Content-Type'} header. * * @return content-type if present */ default Optional<String> contentType() { return header(CONTENT_TYPE); }
/** * Returns the value of the {@code 'Content-Type'} header. * * @return content-type if present */ default Optional<String> contentType() { return header(CONTENT_TYPE); }
/** * Return a new {@link Builder} that will inherit properties from this request. * This allows a new request to be made that will be identical to this one except for the properties * overridden by the builder methods. * * @return new builder based on this request */ public Builder newBuilder() { return new Builder(this); }
/** * Creates a request with the POST method. * * @param uri URI * @return {@code this} */ public static Builder post(String uri) { return new Builder(POST, uri); }
/** * Creates an HTTP response builder with a given status and empty body. * * @param status response status * @return a new builder */ public static Builder response(HttpResponseStatus status) { return new Builder(status); }
/** * Creates a request with the HEAD method. * * @param uri URI * @return {@code this} */ public static <T> Builder head(String uri) { return new Builder(HEAD, uri); }
/** * Creates a request with the PATCH method. * * @param uri URI * @return {@code this} */ public static Builder patch(String uri) { return new Builder(PATCH, uri); }
/** * Creates a request with the PUT method. * * @param uri URI * @return {@code this} */ public static <T> Builder put(String uri) { return new Builder(PUT, uri); }
/** * Return a new {@link Builder} that will inherit properties from this request. * This allows a new request to be made that will be identical to this one except for the properties * overridden by the builder methods. * * @return new builder based on this request */ public Builder newBuilder() { return new Builder(this); }
/** * Creates a request with the PATCH method. * * @param uri URI * @return {@code this} */ public static <T> Builder patch(String uri) { return new Builder(PATCH, uri); }