|
|
|
@@ -42,7 +42,7 @@ public class RestApiClient implements IRestAPI{
|
|
|
|
* @param controllerName Name des aufzurufenden Controllers
|
|
|
|
* @param controllerName Name des aufzurufenden Controllers
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void get(String controllerName) {
|
|
|
|
public String get(String controllerName) {
|
|
|
|
URI apiUri = URI.create(String.format("%s/%s", urlBase, controllerName));
|
|
|
|
URI apiUri = URI.create(String.format("%s/%s", urlBase, controllerName));
|
|
|
|
|
|
|
|
|
|
|
|
HttpRequest httpRequest = HttpRequest.newBuilder()
|
|
|
|
HttpRequest httpRequest = HttpRequest.newBuilder()
|
|
|
|
@@ -57,8 +57,10 @@ public class RestApiClient implements IRestAPI{
|
|
|
|
// Print the response status code and body
|
|
|
|
// Print the response status code and body
|
|
|
|
System.out.println("Status Code: " + httpResponse.statusCode());
|
|
|
|
System.out.println("Status Code: " + httpResponse.statusCode());
|
|
|
|
System.out.println("Response Body: " + httpResponse.body());
|
|
|
|
System.out.println("Response Body: " + httpResponse.body());
|
|
|
|
|
|
|
|
return httpResponse.body();
|
|
|
|
} catch (Exception e) {
|
|
|
|
} catch (Exception e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
e.printStackTrace();
|
|
|
|
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -69,7 +71,7 @@ public class RestApiClient implements IRestAPI{
|
|
|
|
* @param id Id der Aufzurufenden Zeile
|
|
|
|
* @param id Id der Aufzurufenden Zeile
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void get(String controllerName, int id) {
|
|
|
|
public String get(String controllerName, int id) {
|
|
|
|
URI apiUri = URI.create(String.format("%s/%s/%s", urlBase, controllerName, id));
|
|
|
|
URI apiUri = URI.create(String.format("%s/%s/%s", urlBase, controllerName, id));
|
|
|
|
|
|
|
|
|
|
|
|
HttpRequest httpRequest = HttpRequest.newBuilder()
|
|
|
|
HttpRequest httpRequest = HttpRequest.newBuilder()
|
|
|
|
@@ -84,9 +86,12 @@ public class RestApiClient implements IRestAPI{
|
|
|
|
// Print the response status code and body
|
|
|
|
// Print the response status code and body
|
|
|
|
System.out.println("Status Code: " + httpResponse.statusCode() + httpResponse.body());
|
|
|
|
System.out.println("Status Code: " + httpResponse.statusCode() + httpResponse.body());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return httpResponse.body();
|
|
|
|
|
|
|
|
|
|
|
|
//System.out.println("Response Body: " + test);
|
|
|
|
//System.out.println("Response Body: " + test);
|
|
|
|
} catch (Exception e) {
|
|
|
|
} catch (Exception e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
e.printStackTrace();
|
|
|
|
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -98,7 +103,7 @@ public class RestApiClient implements IRestAPI{
|
|
|
|
* @param bezahlt TODO Warum ist das hier?
|
|
|
|
* @param bezahlt TODO Warum ist das hier?
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void get(String controllerName, int id, boolean bezahlt) {
|
|
|
|
public String get(String controllerName, int id, boolean bezahlt) {
|
|
|
|
URI apiUri = URI.create(String.format("%s/%s?%s&%s", urlBase, controllerName, id, bezahlt));
|
|
|
|
URI apiUri = URI.create(String.format("%s/%s?%s&%s", urlBase, controllerName, id, bezahlt));
|
|
|
|
|
|
|
|
|
|
|
|
HttpRequest httpRequest = HttpRequest.newBuilder()
|
|
|
|
HttpRequest httpRequest = HttpRequest.newBuilder()
|
|
|
|
@@ -113,8 +118,10 @@ public class RestApiClient implements IRestAPI{
|
|
|
|
// Print the response status code and body
|
|
|
|
// Print the response status code and body
|
|
|
|
System.out.println("Status Code: " + httpResponse.statusCode());
|
|
|
|
System.out.println("Status Code: " + httpResponse.statusCode());
|
|
|
|
System.out.println("Response Body: " + httpResponse.body());
|
|
|
|
System.out.println("Response Body: " + httpResponse.body());
|
|
|
|
|
|
|
|
return httpResponse.body();
|
|
|
|
} catch (Exception e) {
|
|
|
|
} catch (Exception e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
e.printStackTrace();
|
|
|
|
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|