DATAREST-454 - Reverted to usage of plain Strings for HTTP headers.

Spring 4.0.9 does not include the constants for HTTP headers whose usage was introduced in 46b08. Reverted to use the String equivalents.

Original pull request: #184.
This commit is contained in:
Oliver Gierke
2015-06-30 14:11:15 +02:00
parent 96bc074282
commit a21a1f3fd2
3 changed files with 5 additions and 9 deletions

View File

@@ -16,8 +16,6 @@
package org.springframework.data.rest.webmvc.support;
import static org.springframework.http.HttpHeaders.*;
import org.springframework.core.MethodParameter;
import org.springframework.web.bind.support.WebDataBinderFactory;
import org.springframework.web.context.request.NativeWebRequest;
@@ -48,6 +46,6 @@ public class ETagArgumentResolver implements HandlerMethodArgumentResolver {
@Override
public ETag resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer,
NativeWebRequest webRequest, WebDataBinderFactory binderFactory) throws Exception {
return ETag.from(webRequest.getHeader(IF_MATCH));
return ETag.from(webRequest.getHeader("If-Match"));
}
}

View File

@@ -18,7 +18,6 @@ package org.springframework.data.rest.webmvc.jpa;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
import static org.springframework.data.rest.webmvc.util.TestUtils.*;
import static org.springframework.http.HttpHeaders.*;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
@@ -38,7 +37,6 @@ import org.springframework.data.rest.core.mapping.ResourceMappings;
import org.springframework.data.rest.webmvc.CommonWebTests;
import org.springframework.hateoas.Link;
import org.springframework.hateoas.RelProvider;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.mock.web.MockHttpServletResponse;
import org.springframework.test.context.ContextConfiguration;
@@ -588,12 +586,12 @@ public class JpaWebTests extends CommonWebTests {
mvc.perform(
patch(builder.build().toUriString()).content("{ \"saleItem\" : \"SpringyBurritos\" }")
.contentType(MediaType.APPLICATION_JSON).header(IF_MATCH, concurrencyTag)).andExpect(
.contentType(MediaType.APPLICATION_JSON).header("If-Match", concurrencyTag)).andExpect(
status().is2xxSuccessful());
mvc.perform(
patch(builder.build().toUriString()).content("{ \"saleItem\" : \"SpringyTequila\" }")
.contentType(MediaType.APPLICATION_JSON).header(IF_MATCH, "\"falseETag\"")).andExpect(
.contentType(MediaType.APPLICATION_JSON).header("If-Match", "\"falseETag\"")).andExpect(
status().isPreconditionFailed());
}

View File

@@ -193,12 +193,12 @@ public class MongoWebTests extends CommonWebTests {
mvc.perform(
patch(builder.build().toUriString()).content("{ \"saleItem\" : \"SpringyBurritos\" }")
.contentType(MediaType.APPLICATION_JSON).header(IF_MATCH, concurrencyTag)).andExpect(
.contentType(MediaType.APPLICATION_JSON).header("If-Match", concurrencyTag)).andExpect(
status().is2xxSuccessful());
mvc.perform(
patch(builder.build().toUriString()).content("{ \"saleItem\" : \"SpringyTequila\" }")
.contentType(MediaType.APPLICATION_JSON).header(IF_MATCH, concurrencyTag)).andExpect(
.contentType(MediaType.APPLICATION_JSON).header("If-Match", concurrencyTag)).andExpect(
status().isPreconditionFailed());
}