@Test void testNoBaseURL() throws Exception { final TrellisHttpResource matcher = new TrellisHttpResource(mockBundler, singletonMap(ACL, PreferAccessControl), null); when(mockUriInfo.getPathParameters()).thenReturn(new MultivaluedHashMap<>(singletonMap("path", "resource"))); when(mockUriInfo.getPath()).thenReturn("resource"); when(mockUriInfo.getBaseUri()).thenReturn(new URI("http: when(mockUriInfo.getQueryParameters()).thenReturn(new MultivaluedHashMap<>()); when(mockHttpHeaders.getRequestHeaders()).thenReturn(new MultivaluedHashMap<>()); when(mockTrellisRequest.getAcceptableMediaTypes()).thenReturn(singletonList(WILDCARD_TYPE)); try (final Response res = matcher.getResourceHeaders(mockRequest, mockUriInfo, mockHttpHeaders) .toCompletableFuture().join()) { assertTrue(getLinks(res).stream().anyMatch(l -> l.getRel().equals("self") && l.getUri().toString().startsWith("http: "Missing rel=self header with correct prefix!"); } }
@HEAD @Timed @Operation(summary = "Get the headers for a linked data resource") @APIResponse(description = "The headers for a linked data resource") public CompletionStage<Response> getResourceHeaders(@Context final Request request, @Context final UriInfo uriInfo, @Context final HttpHeaders headers) { return fetchResource(new TrellisRequest(request, uriInfo, headers)) .thenApply(ResponseBuilder::build).exceptionally(this::handleException); }
TrellisHttpResource { @HEAD @Timed @Operation(summary = "Get the headers for a linked data resource") @APIResponse(description = "The headers for a linked data resource") public CompletionStage<Response> getResourceHeaders(@Context final Request request, @Context final UriInfo uriInfo, @Context final HttpHeaders headers) { return fetchResource(new TrellisRequest(request, uriInfo, headers)) .thenApply(ResponseBuilder::build).exceptionally(this::handleException); } }
TrellisHttpResource { @HEAD @Timed @Operation(summary = "Get the headers for a linked data resource") @APIResponse(description = "The headers for a linked data resource") public CompletionStage<Response> getResourceHeaders(@Context final Request request, @Context final UriInfo uriInfo, @Context final HttpHeaders headers) { return fetchResource(new TrellisRequest(request, uriInfo, headers)) .thenApply(ResponseBuilder::build).exceptionally(this::handleException); } @Inject  TrellisHttpResource(final ServiceBundler trellis);  TrellisHttpResource(); private  TrellisHttpResource(final ServiceBundler trellis, final Config config);  TrellisHttpResource(final ServiceBundler trellis, final Map<String, IRI> extensions, final String baseUrl); private  TrellisHttpResource(final ServiceBundler trellis, final Map<String, IRI> extensions, final String baseUrl,
            final Config config); }
TrellisHttpResource { @HEAD @Timed @Operation(summary = "Get the headers for a linked data resource") @APIResponse(description = "The headers for a linked data resource") public CompletionStage<Response> getResourceHeaders(@Context final Request request, @Context final UriInfo uriInfo, @Context final HttpHeaders headers) { return fetchResource(new TrellisRequest(request, uriInfo, headers)) .thenApply(ResponseBuilder::build).exceptionally(this::handleException); } @Inject  TrellisHttpResource(final ServiceBundler trellis);  TrellisHttpResource(); private  TrellisHttpResource(final ServiceBundler trellis, final Config config);  TrellisHttpResource(final ServiceBundler trellis, final Map<String, IRI> extensions, final String baseUrl); private  TrellisHttpResource(final ServiceBundler trellis, final Map<String, IRI> extensions, final String baseUrl,
            final Config config); @PostConstruct void initialize(); @GET @Timed @Operation(summary = "Get a linked data resource") @APIResponses( value = { @APIResponse( responseCode = "404", description = "Missing resource"), @APIResponse( responseCode = "200", description = "The linked data resource, serialized as Turtle", content = @Content(mediaType = "text/turtle")), @APIResponse( responseCode = "200", description = "The linked data resource, serialized as JSON-LD", content = @Content(mediaType = "application/ld+json"))}) CompletionStage<Response> getResource(@Context final Request request, @Context final UriInfo uriInfo,
            @Context final HttpHeaders headers); @HEAD @Timed @Operation(summary = "Get the headers for a linked data resource") @APIResponse(description = "The headers for a linked data resource") CompletionStage<Response> getResourceHeaders(@Context final Request request, @Context final UriInfo uriInfo,
            @Context final HttpHeaders headers); @OPTIONS @Timed @Operation(summary = "Get the interaction options for a linked data resource") @APIResponse(description = "The interaction options for a linked data resource") CompletionStage<Response> options(@Context final Request request, @Context final UriInfo uriInfo,
            @Context final HttpHeaders headers); @PATCH @Timed @Operation(summary = "Update a linked data resource") CompletionStage<Response> updateResource(@Context final Request request, @Context final UriInfo uriInfo,
            @Context final HttpHeaders headers, @Context final SecurityContext secContext,
            @RequestBody(description = "The update request for RDF resources, typically as SPARQL-Update",
                         required = true,
                         content = @Content(mediaType = "application/sparql-update")) final String body); @DELETE @Timed @Operation(summary = "Delete a linked data resource") CompletionStage<Response> deleteResource(@Context final Request request, @Context final UriInfo uriInfo,
            @Context final HttpHeaders headers, @Context final SecurityContext secContext); @POST @Timed @Operation(summary = "Create a linked data resource") CompletionStage<Response> createResource(@Context final Request request, @Context final UriInfo uriInfo,
            @Context final HttpHeaders headers, @Context final SecurityContext secContext,
            @RequestBody(description = "The new resource") final InputStream body); @PUT @Timed @Operation(summary = "Create or update a linked data resource") CompletionStage<Response> setResource(@Context final Request request, @Context final UriInfo uriInfo,
            @Context final HttpHeaders headers, @Context final SecurityContext secContext,
            @RequestBody(description = "The updated resource") final InputStream body); }
TrellisHttpResource { @HEAD @Timed @Operation(summary = "Get the headers for a linked data resource") @APIResponse(description = "The headers for a linked data resource") public CompletionStage<Response> getResourceHeaders(@Context final Request request, @Context final UriInfo uriInfo, @Context final HttpHeaders headers) { return fetchResource(new TrellisRequest(request, uriInfo, headers)) .thenApply(ResponseBuilder::build).exceptionally(this::handleException); } @Inject  TrellisHttpResource(final ServiceBundler trellis);  TrellisHttpResource(); private  TrellisHttpResource(final ServiceBundler trellis, final Config config);  TrellisHttpResource(final ServiceBundler trellis, final Map<String, IRI> extensions, final String baseUrl); private  TrellisHttpResource(final ServiceBundler trellis, final Map<String, IRI> extensions, final String baseUrl,
            final Config config); @PostConstruct void initialize(); @GET @Timed @Operation(summary = "Get a linked data resource") @APIResponses( value = { @APIResponse( responseCode = "404", description = "Missing resource"), @APIResponse( responseCode = "200", description = "The linked data resource, serialized as Turtle", content = @Content(mediaType = "text/turtle")), @APIResponse( responseCode = "200", description = "The linked data resource, serialized as JSON-LD", content = @Content(mediaType = "application/ld+json"))}) CompletionStage<Response> getResource(@Context final Request request, @Context final UriInfo uriInfo,
            @Context final HttpHeaders headers); @HEAD @Timed @Operation(summary = "Get the headers for a linked data resource") @APIResponse(description = "The headers for a linked data resource") CompletionStage<Response> getResourceHeaders(@Context final Request request, @Context final UriInfo uriInfo,
            @Context final HttpHeaders headers); @OPTIONS @Timed @Operation(summary = "Get the interaction options for a linked data resource") @APIResponse(description = "The interaction options for a linked data resource") CompletionStage<Response> options(@Context final Request request, @Context final UriInfo uriInfo,
            @Context final HttpHeaders headers); @PATCH @Timed @Operation(summary = "Update a linked data resource") CompletionStage<Response> updateResource(@Context final Request request, @Context final UriInfo uriInfo,
            @Context final HttpHeaders headers, @Context final SecurityContext secContext,
            @RequestBody(description = "The update request for RDF resources, typically as SPARQL-Update",
                         required = true,
                         content = @Content(mediaType = "application/sparql-update")) final String body); @DELETE @Timed @Operation(summary = "Delete a linked data resource") CompletionStage<Response> deleteResource(@Context final Request request, @Context final UriInfo uriInfo,
            @Context final HttpHeaders headers, @Context final SecurityContext secContext); @POST @Timed @Operation(summary = "Create a linked data resource") CompletionStage<Response> createResource(@Context final Request request, @Context final UriInfo uriInfo,
            @Context final HttpHeaders headers, @Context final SecurityContext secContext,
            @RequestBody(description = "The new resource") final InputStream body); @PUT @Timed @Operation(summary = "Create or update a linked data resource") CompletionStage<Response> setResource(@Context final Request request, @Context final UriInfo uriInfo,
            @Context final HttpHeaders headers, @Context final SecurityContext secContext,
            @RequestBody(description = "The updated resource") final InputStream body);  }