List of usage examples for org.springframework.http HttpMethod HEAD
HttpMethod HEAD
To view the source code for org.springframework.http HttpMethod HEAD.
Click Source Link
From source file:de.zib.gndms.gndmc.utils.HTTPGetter.java
public int head(String url) throws NoSuchAlgorithmException, KeyManagementException { return get(HttpMethod.HEAD, url, (HttpHeaders) null); }
From source file:de.zib.gndms.gndmc.utils.HTTPGetter.java
public int head(String url, final HttpHeaders headers) throws NoSuchAlgorithmException, KeyManagementException { return get(HttpMethod.HEAD, url, headers); }
From source file:de.zib.gndms.gndmc.utils.HTTPGetter.java
private EnhancedResponseExtractor head(final String url, final RequestCallback requestCallback) throws NoSuchAlgorithmException, KeyManagementException { return get(HttpMethod.HEAD, url, requestCallback); }
From source file:net.eusashead.hateoas.conditional.interceptor.AsyncTestControllerITCase.java
@Test public void testConditionalHead() throws Exception { // Expected result HttpHeaders headers = new HttpHeaders(); headers.setETag("\"123456\""); ResponseEntity<String> expectedResult = new ResponseEntity<String>(headers, HttpStatus.OK); // Execute asynchronously MvcResult mvcResult = this.mockMvc .perform(request(HttpMethod.HEAD, "http://localhost/async/123") .contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON)) .andExpect(request().asyncStarted()).andExpect(request().asyncResult(expectedResult)).andReturn(); // Perform asynchronous dispatch this.mockMvc.perform(asyncDispatch(mvcResult)).andExpect(status().isOk()) .andExpect(header().string("ETag", "\"123456\"")).andExpect(content().string("")); // The 304 should be returned synchronously (it bypasses the controller) this.mockMvc.perform( request(HttpMethod.HEAD, "http://localhost/async/123").contentType(MediaType.APPLICATION_JSON) .accept(MediaType.APPLICATION_JSON).header("If-None-Match", "\"123456\"")) .andExpect(status().isNotModified()).andReturn(); }
From source file:net.eusashead.hateoas.response.argumentresolver.AsyncEntityControllerITCase.java
@Test public void testHead() throws Exception { // Expected result HttpHeaders headers = new HttpHeaders(); headers.setETag("W/\"b0c689597eb9dd62c0a1fb90a7c5c5a5\""); ResponseEntity<Entity> expectedResult = new ResponseEntity<Entity>(headers, HttpStatus.NO_CONTENT); // Execute asynchronously MvcResult mvcResult = this.mockMvc .perform(request(HttpMethod.HEAD, "http://localhost/async/foo") .contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON)) .andExpect(request().asyncStarted()).andExpect(request().asyncResult(expectedResult)).andReturn(); // Perform asynchronous dispatch this.mockMvc.perform(asyncDispatch(mvcResult)).andDo(print()).andExpect(status().isNoContent()) .andExpect(header().string("ETag", "W/\"b0c689597eb9dd62c0a1fb90a7c5c5a5\"")); }
From source file:net.eusashead.hateoas.hal.response.impl.HalResponseBuilderITCase.java
@Test public void testHeadNotModified() throws Exception { // Execute controller method this.mockMvc// w w w .ja va2 s . co m .perform(request(HttpMethod.HEAD, "http://localhost/order/123") .contentType(HalHttpMessageConverter.HAL_JSON).accept(HalHttpMessageConverter.HAL_JSON) .header("If-None-Match", "W/\"123456789\"")) .andExpect(status().isNotModified()).andReturn(); }
From source file:net.eusashead.hateoas.springhalbuilder.controller.CustomerOrdersControllerITCase.java
@Test public void testHead() throws Exception { this.mockMvc//from ww w . j a v a2 s . co m .perform(request(HttpMethod.HEAD, "http://localhost/customer/1/orders/") .contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON)) .andExpect(status().isNoContent()) .andExpect(header().string("ETag", "W/\"c457c4aeaaecafccf898c555663f337e\"")).andReturn(); }
From source file:net.eusashead.hateoas.springhalbuilder.controller.CustomerListControllerITCase.java
@Test public void testHead() throws Exception { this.mockMvc//from w w w . j a va 2s. c o m .perform(request(HttpMethod.HEAD, "http://localhost/customer/?page=0&size=3") .contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON)) .andExpect(status().isNoContent()) .andExpect(header().string("ETag", "W/\"f4da35bd8dcf93431dfef867460dcdd8\"")).andReturn(); }
From source file:net.eusashead.hateoas.response.impl.HalPageResponseBuilderITCase.java
@Test public void testHead() throws Exception { // Execute controller method this.mockMvc//from w w w .j a va2 s. c om .perform(request(HttpMethod.HEAD, "http://localhost/customer/?page=1&size=15") .contentType(HalHttpMessageConverter.HAL_JSON).accept(HalHttpMessageConverter.HAL_JSON)) .andExpect(status().isNoContent()).andExpect(header().string("ETag", "W/\"123456789\"")) .andReturn(); }
From source file:net.eusashead.hateoas.springhalbuilder.controller.OrderListControllerITCase.java
@Test public void testHead() throws Exception { this.mockMvc// w w w .j a v a2 s .co m .perform(request(HttpMethod.HEAD, "http://localhost/order/?page=0&size=3") .contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON)) .andExpect(status().isNoContent()) .andExpect(header().string("ETag", "W/\"306adbe412771f9da18422312c5c13fc\"")).andReturn(); }