/** * Invoke the request using <code>GET</code> method and receive the response entity {@link InputStream} back. * @return the response payload {@link InputStream}, or an empty stream for empty responses * @throws HttpClientInvocationException Internal invocation failure (for example, an I/O error on communication * channel or expected and actual payload type mismatch) * @throws UnsuccessfulResponseException In case the status code of the response returned by the server is not a * successful type status code, i.e. it is not a <code>2xx</code> status code */ @Override default InputStream getForStream() { return invokeForEntity(HttpMethod.GET, null, ResponseType.of(InputStream.class)) .orElse(new ByteArrayInputStream(new byte[0])); }
/** * Invoke the request using <code>PATCH</code> method with given <code>entity</code> request payload and receive * the response entity payload back. * @param <T> Response entity type * @param entity Request payload * @param responseType Expected response payload type * @return the response payload of expected type as the result of the request invocation, or an empty Optional * if not present (empty response entity) * @throws HttpClientInvocationException Internal invocation failure (for example, an I/O error on communication * channel or expected and actual payload type mismatch) * @throws UnsuccessfulResponseException In case the status code of the response returned by the server is not a * successful type status code, i.e. it is not a <code>2xx</code> status code */ @Override default <T> Optional<T> patchForEntity(RequestEntity<?> entity, ResponseType<T> responseType) { return invokeForEntity(HttpMethod.PATCH, entity, responseType); }
/** * Invoke the request using <code>PUT</code> method with given <code>entity</code> request entity payload and * receive the response payload back. * @param <T> Response entity type * @param entity Request payload * @param responseType Expected response payload type * @return the response payload of expected type as the result of the request invocation, or an empty Optional * if not present (empty response entity) * @throws HttpClientInvocationException Internal invocation failure (for example, an I/O error on communication * channel or expected and actual payload type mismatch) * @throws UnsuccessfulResponseException In case the status code of the response returned by the server is not a * successful type status code, i.e. it is not a <code>2xx</code> status code */ @Override default <T> Optional<T> putForEntity(RequestEntity<?> entity, ResponseType<T> responseType) { return invokeForEntity(HttpMethod.PUT, entity, responseType); }
/** * Invoke the request using <code>PUT</code> method with given <code>entity</code> request payload and receive * the response entity payload back. * @param <T> Response entity type * @param entity Request payload * @param responseType Expected response payload type * @return the response payload of expected type as the result of the request invocation, or an empty Optional * if not present (empty response entity) * @throws HttpClientInvocationException Internal invocation failure (for example, an I/O error on communication * channel or expected and actual payload type mismatch) * @throws UnsuccessfulResponseException In case the status code of the response returned by the server is not a * successful type status code, i.e. it is not a <code>2xx</code> status code */ @Override default <T> Optional<T> putForEntity(RequestEntity<?> entity, Class<T> responseType) { return invokeForEntity(HttpMethod.PUT, entity, ResponseType.of(responseType)); }
/** * Invoke the request using <code>POST</code> method with given <code>entity</code> request payload and receive * the response payload back. * @param <T> Response type * @param entity Request payload * @param responseType Expected response payload type * @return the response payload of expected type as the result of the request invocation, or an empty Optional * if not present (empty response entity) * @throws HttpClientInvocationException Internal invocation failure (for example, an I/O error on communication * channel or expected and actual payload type mismatch) * @throws UnsuccessfulResponseException In case the status code of the response returned by the server is not a * successful type status code, i.e. it is not a <code>2xx</code> status code */ @Override default <T> Optional<T> postForEntity(RequestEntity<?> entity, Class<T> responseType) { return invokeForEntity(HttpMethod.POST, entity, ResponseType.of(responseType)); }
/** * Invoke the request using <code>OPTIONS</code> method and receive the response entity payload of given generic * type back. * @param <T> Response entity type * @param responseType Response payload generic type representation * @return the response payload of expected type as the result of the request invocation, or an empty Optional * if not present (empty response entity) * @throws HttpClientInvocationException Internal invocation failure (for example, an I/O error on communication * channel or expected and actual payload type mismatch) * @throws UnsuccessfulResponseException In case the status code of the response returned by the server is not a * successful type status code, i.e. it is not a <code>2xx</code> status code */ @Override default <T> Optional<T> optionsForEntity(ResponseType<T> responseType) { return invokeForEntity(HttpMethod.OPTIONS, null, responseType); }
/** * Invoke the request using <code>POST</code> method with given <code>entity</code> request payload and receive * the response payload back. * @param <T> Response type * @param entity Request payload * @param responseType Expected response payload type * @return the response payload of expected type as the result of the request invocation, or an empty Optional * if not present (empty response entity) * @throws HttpClientInvocationException Internal invocation failure (for example, an I/O error on communication * channel or expected and actual payload type mismatch) * @throws UnsuccessfulResponseException In case the status code of the response returned by the server is not a * successful type status code, i.e. it is not a <code>2xx</code> status code */ @Override default <T> Optional<T> postForEntity(RequestEntity<?> entity, ResponseType<T> responseType) { return invokeForEntity(HttpMethod.POST, entity, responseType); }
/** * Invoke the request using <code>DELETE</code> method and receive the response entity payload of given generic * type back. * @param <T> Response entity type * @param responseType Response payload generic type representation * @return the response payload of expected type as the result of the request invocation, or an empty Optional * if not present (empty response entity) * @throws HttpClientInvocationException Internal invocation failure (for example, an I/O error on communication * channel or expected and actual payload type mismatch) * @throws UnsuccessfulResponseException In case the status code of the response returned by the server is not a * successful type status code, i.e. it is not a <code>2xx</code> status code */ @Override default <T> Optional<T> deleteForEntity(ResponseType<T> responseType) { return invokeForEntity(HttpMethod.DELETE, null, responseType); }
/** * Invoke the request using <code>OPTIONS</code> method and receive the response entity payload back. * @param <T> Response entity type * @param responseType Expected response payload type * @return the response payload of expected type as the result of the request invocation, or an empty Optional * if not present (empty response entity) * @throws HttpClientInvocationException Internal invocation failure (for example, an I/O error on communication * channel or expected and actual payload type mismatch) * @throws UnsuccessfulResponseException In case the status code of the response returned by the server is not a * successful type status code, i.e. it is not a <code>2xx</code> status code */ @Override default <T> Optional<T> optionsForEntity(Class<T> responseType) { return invokeForEntity(HttpMethod.OPTIONS, null, ResponseType.of(responseType)); }
/** * Invoke the request using <code>PATCH</code> method with given <code>entity</code> request payload and receive * the response entity payload back. * @param <T> Response entity type * @param entity Request payload * @param responseType Expected response payload type * @return the response payload of expected type as the result of the request invocation, or an empty Optional * if not present (empty response entity) * @throws HttpClientInvocationException Internal invocation failure (for example, an I/O error on communication * channel or expected and actual payload type mismatch) * @throws UnsuccessfulResponseException In case the status code of the response returned by the server is not a * successful type status code, i.e. it is not a <code>2xx</code> status code */ @Override default <T> Optional<T> patchForEntity(RequestEntity<?> entity, Class<T> responseType) { return invokeForEntity(HttpMethod.PATCH, entity, ResponseType.of(responseType)); }
/** * Invoke the request using <code>TRACE</code> method and receive the response entity payload of given generic * type back. * @param <T> Response entity type * @param responseType Response payload generic type representation * @return the response payload of expected type as the result of the request invocation, or an empty Optional * if not present (empty response entity) * @throws HttpClientInvocationException Internal invocation failure (for example, an I/O error on communication * channel or expected and actual payload type mismatch) * @throws UnsuccessfulResponseException In case the status code of the response returned by the server is not a * successful type status code, i.e. it is not a <code>2xx</code> status code */ @Override default <T> Optional<T> traceForEntity(ResponseType<T> responseType) { return invokeForEntity(HttpMethod.TRACE, null, responseType); }
/** * Invoke the request using <code>GET</code> method and receive the response entity payload of given generic * type back. * @param <T> Response entity type * @param responseType Response payload generic type representation * @return the response payload of expected type as the result of the request invocation, or an empty Optional * if not present (empty response entity) * @throws HttpClientInvocationException Internal invocation failure (for example, an I/O error on communication * channel or expected and actual payload type mismatch) * @throws UnsuccessfulResponseException In case the status code of the response returned by the server is not a * successful type status code, i.e. it is not a <code>2xx</code> status code */ @Override default <T> Optional<T> getForEntity(ResponseType<T> responseType) { return invokeForEntity(HttpMethod.GET, null, responseType); }
/** * Invoke the request using <code>TRACE</code> method and receive the response entity payload back. * @param <T> Response entity type * @param responseType Expected response payload type * @return the response payload of expected type as the result of the request invocation, or an empty Optional * if not present (empty response entity) * @throws HttpClientInvocationException Internal invocation failure (for example, an I/O error on communication * channel or expected and actual payload type mismatch) * @throws UnsuccessfulResponseException In case the status code of the response returned by the server is not a * successful type status code, i.e. it is not a <code>2xx</code> status code */ @Override default <T> Optional<T> traceForEntity(Class<T> responseType) { return invokeForEntity(HttpMethod.TRACE, null, ResponseType.of(responseType)); }
/** * Invoke the request using <code>DELETE</code> method and receive the response entity payload back. * @param <T> Response entity type * @param responseType Expected response payload type * @return the response payload of expected type as the result of the request invocation, or an empty Optional * if not present (empty response entity) * @throws HttpClientInvocationException Internal invocation failure (for example, an I/O error on communication * channel or expected and actual payload type mismatch) * @throws UnsuccessfulResponseException In case the status code of the response returned by the server is not a * successful type status code, i.e. it is not a <code>2xx</code> status code */ @Override default <T> Optional<T> deleteForEntity(Class<T> responseType) { return invokeForEntity(HttpMethod.DELETE, null, ResponseType.of(responseType)); }
/** * Invoke the request using <code>GET</code> method and receive the response entity payload back. * @param <T> Response entity type * @param responseType Expected response payload type * @return the response payload of expected type as the result of the request invocation, or an empty Optional * if not present (empty response entity) * @throws HttpClientInvocationException Internal invocation failure (for example, an I/O error on communication * channel or expected and actual payload type mismatch) * @throws UnsuccessfulResponseException In case the status code of the response returned by the server is not a * successful type status code, i.e. it is not a <code>2xx</code> status code */ @Override default <T> Optional<T> getForEntity(Class<T> responseType) { return invokeForEntity(HttpMethod.GET, null, ResponseType.of(responseType)); }