From f5da60c3399bfc00da7da9eb480370c87543c9c6 Mon Sep 17 00:00:00 2001 From: Stephan Fuhrmann Date: Sun, 7 Jan 2024 18:45:18 +0100 Subject: [PATCH] Javadoc --- .../java/de/sfuhrm/radiobrowser4j/RestImpl.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/radiobrowser4j/src/main/java/de/sfuhrm/radiobrowser4j/RestImpl.java b/radiobrowser4j/src/main/java/de/sfuhrm/radiobrowser4j/RestImpl.java index 6b8a2b4e..647a64cc 100644 --- a/radiobrowser4j/src/main/java/de/sfuhrm/radiobrowser4j/RestImpl.java +++ b/radiobrowser4j/src/main/java/de/sfuhrm/radiobrowser4j/RestImpl.java @@ -78,6 +78,11 @@ static String paths(String...components) { return Arrays.stream(components).collect(Collectors.joining("/")); } + /** Sends a GET request to the remote server. + * @param path the path on the web server. + * @param resultClass the result class to retrieve. + * @return an instance of the result class. + * */ T get(String path, Class resultClass) { WebTarget webTarget = client.target(endpoint); return webTarget.path(path) @@ -87,6 +92,16 @@ T get(String path, Class resultClass) { .get(resultClass); } + /** Sends a POST request to the remote server. The + * body gets transferred as + * "application/x-www-form-urlencoded" encoded data. + * @param path the path on the web server. + * @param requestParams the request parameters to send as the POST body in + * "application/x-www-form-urlencoded" encoding. + * @param resultClass the expected resulting class wrapped in a generic type. + * @return the resulting type. + * @throws RadioBrowserException if the sever sent a non-OK response. + * */ T post(String path, Map requestParams, GenericType resultClass) { Entity
entity = Entity.form( new MultivaluedHashMap<>(requestParams));