|
@@ -5,7 +5,6 @@ import java.io.File;
|
|
|
import java.io.FileInputStream;
|
|
|
import java.io.FileReader;
|
|
|
import java.io.IOException;
|
|
|
-import java.io.InputStreamReader;
|
|
|
import java.net.URI;
|
|
|
import java.net.URISyntaxException;
|
|
|
import java.security.KeyManagementException;
|
|
@@ -29,7 +28,7 @@ import jakarta.annotation.PostConstruct;
|
|
|
import jakarta.enterprise.context.ApplicationScoped;
|
|
|
import jakarta.ws.rs.POST;
|
|
|
import jakarta.ws.rs.Path;
|
|
|
-import jakarta.ws.rs.client.ClientResponseContext;
|
|
|
+import jakarta.ws.rs.core.Response;
|
|
|
|
|
|
@ApplicationScoped
|
|
|
@Path("/jobs")
|
|
@@ -131,7 +130,7 @@ public class Activator {
|
|
|
@POST
|
|
|
public String createJob(JobDescription job) {
|
|
|
LOG.info("Sending request: " + this.apiserver.get());
|
|
|
- ClientResponseContext response = k8s.createJob(
|
|
|
+ Response response = k8s.createJob(
|
|
|
"Bearer " + token.get(),
|
|
|
job.getNamespace(),
|
|
|
new Job(job.getNamespace(),
|
|
@@ -141,7 +140,7 @@ public class Activator {
|
|
|
// Log response next. Real status might be in X-Original-Status though.
|
|
|
int status = 0;
|
|
|
if (response.getHeaders().containsKey("X-Original-Status")) {
|
|
|
- status = Integer.valueOf(response.getHeaders().get("X-Original-Status").get(0));
|
|
|
+ status = Integer.valueOf(response.getHeaders().getFirst("X-Original-Status").toString());
|
|
|
} else {
|
|
|
status = response.getStatus();
|
|
|
}
|
|
@@ -151,13 +150,10 @@ public class Activator {
|
|
|
LOG.info(k + ": " + v);
|
|
|
});
|
|
|
|
|
|
- // Aggregate the body.
|
|
|
- StringBuffer body = new StringBuffer();
|
|
|
- BufferedReader br = new BufferedReader(new InputStreamReader(response.getEntityStream()));
|
|
|
- br.lines().forEach((l) -> body.append(l));
|
|
|
+ // Log the body.
|
|
|
+ String body = response.getEntity().toString();
|
|
|
+ LOG.debug("Response Body: " + body);
|
|
|
|
|
|
- LOG.debug("Response Body: " + body.toString());
|
|
|
-
|
|
|
- return body.toString();
|
|
|
+ return body;
|
|
|
}
|
|
|
}
|