/** * Performs a HEAD request to the specified URI. * * @param uri the uri to request the head of * @return the client response of the request */ public Response head(final URI uri) { // perform the request WebTarget webTarget = client.target(uri); return webTarget.request().head(); } }
@Test public void testHead() { Response response = target("/ready").request().head(); Assert.assertEquals(Response.Status.OK.getStatusCode(), response.getStatus()); } }
@Test public void testHead() { Response response = target("/ready").request().head(); Assert.assertEquals(Response.Status.OK.getStatusCode(), response.getStatus()); } }
/** * Test that memento binary descriptions are also LDP resources. */ @Test @DisplayName("Test that memento binary descriptions are also LDP resources") default void testMementoBinaryDescriptionLdpResource() { getMementos().forEach((memento, date) -> { final String description = getDescription(memento); assertNotNull(description, "No describedby Link header!"); try (final Response res = target(description).request().accept("text/turtle").head()) { assertAll("Check LDP headers", checkMementoLdpHeaders(res, LDP.RDFSource)); } }); } }
/** * Build a list of all Mementos. * @return the resource mementos */ default Map<String, String> getMementos() { final Map<String, String> mementos = new HashMap<>(); try (final Response res = target(getBinaryLocation()).request().head()) { getLinks(res).stream().filter(link -> link.getRel().equals("memento")) .filter(l -> l.getParams().containsKey("datetime")) .forEach(link -> mementos.put(link.getUri().toString(), link.getParams().get("datetime"))); } return mementos; }
/** * Build a list of all Mementos. * @return the resource mementos */ default Map<String, String> getMementos() { final Map<String, String> mementos = new HashMap<>(); try (final Response res = target(getBinaryLocation()).request().head()) { getLinks(res).stream().filter(link -> link.getRel().equals("memento")) .filter(l -> l.getParams().containsKey("datetime")) .forEach(link -> mementos.put(link.getUri().toString(), link.getParams().get("datetime"))); } return mementos; }
@Override public Response head() { return builder.head(); }
/** * Get the describedby Link value, if one exists. * @param url the URL * @return the location of a description resource, or null if none is available */ default String getDescription(final String url) { try (final Response res = target(url).request().head()) { return getLinks(res).stream().filter(link -> "describedby".equals(link.getRel())) .map(Link::getUri).map(URI::toString).findFirst().orElse(null); } }
@Override public Response head() { return delegate().head(); }
@Test public void testHeadDefaultType() { final Response res = target(RESOURCE_PATH).request().head(); assertEquals(SC_OK, res.getStatus(), "Unexpected response code!"); assertTrue(TEXT_TURTLE_TYPE.isCompatible(res.getMediaType()), "Incorrect content-type: " + res.getMediaType()); assertTrue(res.getMediaType().isCompatible(TEXT_TURTLE_TYPE), "Incorrect content-type: " + res.getMediaType()); }
/** * Get the describedby Link value, if one exists. * @param url the URL * @return the location of a description resource, or null if none is available */ default String getDescription(final String url) { try (final Response res = target(url).request().head()) { return getLinks(res).stream().filter(link -> "describedby".equals(link.getRel())) .map(Link::getUri).map(URI::toString).findFirst().orElse(null); } }
@Override public Response getSchema(String schemaName) { try { final Response response = indexTarget.path(schemaName).request(MediaType.TEXT_PLAIN).head(); if (response.getStatus() != 200) throw new WebApplicationException(response); return response; } catch (WebApplicationException e) { throw ServerException.from(e); } }
/** * Perform an HTTP HEAD call with the specified query parameters and URL, returning * a ClientResponse instance with the data returned from the endpoint. * * @param queryParams multivalue map of request parameters * @param url the fully formed path to the GitLab API endpoint * @return a ClientResponse instance with the data returned from the endpoint */ protected Response head(MultivaluedMap<String, String> queryParams, URL url) { return (invocation(url, queryParams).head()); }
private Object sendHeadRequest( RequestConfigurer configurer, Method method, Builder request ) { Response response = request.head(); validateResponse( configurer, response, "HEAD" ); return response.readEntity( method.getReturnType() ); }
@Override public Response execute(Invocation.Builder requestBuilder, Object entity, String contentType) { return requestBuilder.head(); } },
@Override public Response head() { return builder.head(); }
/** * Test that memento resources are also LDP resources. */ @Test @DisplayName("Test that memento resources are also LDP resources") default void testMementoLdpResource() { getMementos().forEach((memento, date) -> { try (final Response res = target(memento).request().head()) { assertAll("Check LDP headers", checkMementoLdpHeaders(res, LDP.NonRDFSource)); } }); }
/** * Test that memento resources are also LDP resources. */ @Test @DisplayName("Test that memento resources are also LDP resources") default void testMementoLdpResource() { getMementos().forEach((memento, date) -> { try (final Response res = target(memento).request().head()) { assertAll("Check LDP headers", checkMementoLdpHeaders(res, LDP.NonRDFSource)); } }); }
/** * Perform an HTTP HEAD call with the specified query parameters and URL, returning * a ClientResponse instance with the data returned from the endpoint. * * @param queryParams multivalue map of request parameters * @param url the fully formed path to the GitLab API endpoint * @return a ClientResponse instance with the data returned from the endpoint */ protected Response head(MultivaluedMap<String, String> queryParams, URL url) { return (invocation(url, queryParams).head()); }
@Test public void testHead() { Response response = target("/ready").request().head(); Assert.assertEquals(Response.Status.OK.getStatusCode(), response.getStatus()); } }