Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions src/main/java/io/cryostat/reports/PresignedFormData.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,16 @@
*/
package io.cryostat.reports;

import java.net.URI;

import jakarta.ws.rs.core.MediaType;
import org.jboss.resteasy.reactive.PartType;
import org.jboss.resteasy.reactive.RestForm;

public class PresignedFormData {
@RestForm
@PartType(MediaType.TEXT_PLAIN)
public String path;

@RestForm
@PartType(MediaType.TEXT_PLAIN)
public String query;
public URI uri;

@RestForm
@PartType(MediaType.TEXT_PLAIN)
Expand Down
22 changes: 2 additions & 20 deletions src/main/java/io/cryostat/reports/ReportResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URI;
import java.net.URISyntaxException;
import java.nio.file.Files;
import java.nio.file.StandardCopyOption;
Expand Down Expand Up @@ -66,7 +65,6 @@
import jakarta.ws.rs.ServerErrorException;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.Response;
import jakarta.ws.rs.core.UriBuilder;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.Pair;
import org.eclipse.microprofile.config.inject.ConfigProperty;
Expand All @@ -87,9 +85,6 @@ public class ReportResource {
@ConfigProperty(name = "io.cryostat.reports.timeout", defaultValue = "29000")
String timeoutMs;

@ConfigProperty(name = "cryostat.storage.base-uri")
Optional<String> storageBase;

@ConfigProperty(name = "cryostat.storage.auth-method")
Optional<String> storageAuthMethod;

Expand Down Expand Up @@ -154,21 +149,8 @@ public String getReportFromPresigned(RoutingContext ctx, @BeanParam PresignedFor
long timeout = TimeUnit.MILLISECONDS.toNanos(Long.parseLong(timeoutMs));
long start = System.nanoTime();

if (storageBase.isEmpty()) {
logger.error(
"Configuration property \"cryostat.storage.base-uri\" is unset, cannot handle"
+ " presigned report requests!");
throw new ServerErrorException(Response.Status.BAD_GATEWAY);
}

UriBuilder uriBuilder =
UriBuilder.newInstance()
.uri(new URI(storageBase.get()))
.path(form.path)
.replaceQuery(form.query);
URI downloadUri = uriBuilder.build();
logger.debugv("Attempting to download presigned recording from {0}", downloadUri);
HttpURLConnection httpConn = (HttpURLConnection) downloadUri.toURL().openConnection();
logger.debugv("Attempting to download presigned recording from {0}", form.uri);
HttpURLConnection httpConn = (HttpURLConnection) form.uri.toURL().openConnection();
httpConn.setRequestMethod("GET");
if (httpConn instanceof HttpsURLConnection) {
HttpsURLConnection httpsConn = (HttpsURLConnection) httpConn;
Expand Down
1 change: 0 additions & 1 deletion src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ quarkus.native.additional-build-args =\
-H:ResourceConfigurationFiles=resource-config.json,\
-H:ReflectionConfigurationFiles=reflect-config.json

cryostat.storage.base-uri=
cryostat.storage.auth-method=
cryostat.storage.auth=
cryostat.storage.tls-version=TLSv1.2
Expand Down
Loading