Skip to content

Commit

Permalink
use relative redirect paths
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewazores committed Jan 25, 2024
1 parent 63f3146 commit 1d482fb
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/main/java/io/cryostat/discovery/CustomDiscovery.java
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ Response doV2Create(
public Response delete(@RestPath URI connectUrl) throws URISyntaxException {
Target target = Target.getTargetByConnectUrl(connectUrl);
return Response.status(RestResponse.Status.PERMANENT_REDIRECT)
.location(URI.create(String.format("/api/v3/targets/%d", target.id)))
.location(URI.create(String.format("api/v3/targets/%d", target.id)))
.build();
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/io/cryostat/discovery/Discovery.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ void onStart(@Observes StartupEvent evt) {
@RolesAllowed("read")
public Response getv21() {
return Response.status(RestResponse.Status.PERMANENT_REDIRECT)
.location(URI.create("/api/v3/discovery"))
.location(URI.create("api/v3/discovery"))
.build();
}

Expand Down
5 changes: 2 additions & 3 deletions src/main/java/io/cryostat/events/EventTemplates.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ public class EventTemplates {
public Response listTemplatesV1(@RestPath URI connectUrl) throws Exception {
Target target = Target.getTargetByConnectUrl(connectUrl);
return Response.status(RestResponse.Status.PERMANENT_REDIRECT)
.location(
URI.create(String.format("/api/v3/targets/%d/event_templates", target.id)))
.location(URI.create(String.format("api/v3/targets/%d/event_templates", target.id)))
.build();
}

Expand All @@ -71,7 +70,7 @@ public Response getTargetTemplateV1(
.location(
URI.create(
String.format(
"/api/v3/targets/%d/event_templates/%s/%s",
"api/v3/targets/%d/event_templates/%s/%s",
target.id, templateName, templateType)))
.build();
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/io/cryostat/events/Events.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public Response listEventsV1(@RestPath URI connectUrl, @RestQuery String q) thro
.location(
URI.create(
String.format(
"/api/v3/targets/%d/events%s",
"api/v3/targets/%d/events%s",
target.id, q == null ? "" : "?q=" + q)))
.build();
}
Expand Down
16 changes: 8 additions & 8 deletions src/main/java/io/cryostat/recordings/Recordings.java
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ public List<LinkedRecordingDescriptor> listForTarget(@RestPath long id) throws E
public Response listForTargetByUrl(@RestPath URI connectUrl) throws Exception {
Target target = Target.getTargetByConnectUrl(connectUrl);
return Response.status(RestResponse.Status.PERMANENT_REDIRECT)
.location(URI.create(String.format("/api/v3/targets/%d/recordings", target.id)))
.location(URI.create(String.format("api/v3/targets/%d/recordings", target.id)))
.build();
}

Expand Down Expand Up @@ -501,7 +501,7 @@ public Response patchV1(@RestPath URI connectUrl, @RestPath String recordingName
.location(
URI.create(
String.format(
"/api/v3/targets/%d/recordings/%s",
"api/v3/targets/%d/recordings/%s",
target.id, recording.get().getId())))
.build();
}
Expand Down Expand Up @@ -683,7 +683,7 @@ public Response createRecordingV1(@RestPath URI connectUrl) throws Exception {
.location(
URI.create(
String.format(
"/api/v3/targets/%d/recordings",
"api/v3/targets/%d/recordings",
Target.getTargetByConnectUrl(connectUrl).id)))
.build();
}
Expand All @@ -709,7 +709,7 @@ public Response deleteRecordingV1(@RestPath URI connectUrl, @RestPath String rec
.location(
URI.create(
String.format(
"/api/v3/targets/%d/recordings/%d", target.id, remoteId)))
"api/v3/targets/%d/recordings/%d", target.id, remoteId)))
.build();
}

Expand Down Expand Up @@ -816,7 +816,7 @@ public Response uploadToGrafanaV1(@RestPath URI connectUrl, @RestPath String rec
.location(
URI.create(
String.format(
"/api/v3/targets/%d/recordings/%d/upload",
"api/v3/targets/%d/recordings/%d/upload",
target.id, remoteId)))
.build();
}
Expand Down Expand Up @@ -860,7 +860,7 @@ public Response getRecordingOptionsV1(@RestPath URI connectUrl) throws Exception
Target target = Target.getTargetByConnectUrl(connectUrl);
return Response.status(RestResponse.Status.PERMANENT_REDIRECT)
.location(
URI.create(String.format("/api/v3/targets/%d/recordingOptions", target.id)))
URI.create(String.format("api/v3/targets/%d/recordingOptions", target.id)))
.build();
}

Expand All @@ -887,7 +887,7 @@ public Response patchRecordingOptionsV1(@RestPath URI connectUrl) {
Target target = Target.getTargetByConnectUrl(connectUrl);
return Response.status(RestResponse.Status.PERMANENT_REDIRECT)
.location(
URI.create(String.format("/api/v3/targets/%d/recordingOptions", target.id)))
URI.create(String.format("api/v3/targets/%d/recordingOptions", target.id)))
.build();
}

Expand Down Expand Up @@ -981,7 +981,7 @@ public Response createAndRedirectPresignedDownload(@RestPath long id) throws Exc
.location(
URI.create(
String.format(
"/api/v3/download/%s?f=%s",
"api/v3/download/%s?f=%s",
encodedKey,
base64Url.encodeAsString(
savename.getBytes(StandardCharsets.UTF_8)))))
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/io/cryostat/reports/Reports.java
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public Response getV1(@RestPath String recordingName) {
.location(
URI.create(
String.format(
"/api/v3/reports/%s", entry.getKey(), entry.getValue())))
"api/v3/reports/%s", entry.getKey(), entry.getValue())))
.build();
}

Expand Down Expand Up @@ -145,7 +145,7 @@ public Response getActiveV1(@RestPath String targetId, @RestPath String recordin
.location(
URI.create(
String.format(
"/api/v3/targets/%d/reports/%d",
"api/v3/targets/%d/reports/%d",
target.id, recording.remoteId)))
.build();
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/io/cryostat/targets/Targets.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class Targets {
@RolesAllowed("read")
public Response listV1() {
return Response.status(RestResponse.Status.PERMANENT_REDIRECT)
.location(URI.create("/api/v3/targets"))
.location(URI.create("api/v3/targets"))
.build();
}

Expand Down

0 comments on commit 1d482fb

Please sign in to comment.