Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialmarkmneimneh
14,132 PointsBuild a Rest API in Spring (Versioning Error)
I see this error when I applied the 'If-None-Match' header value in PostMan. It happens in both examples discussed in Video (0 and 1).
Any idea what could be the cause?
Thanks
java.lang.IllegalArgumentException: Could not parse header 'If-None-Match' with value '0' org.springframework.http.HttpHeaders.getETagValuesAsList(HttpHeaders.java:1090) org.springframework.http.HttpHeaders.getIfNoneMatch(HttpHeaders.java:843) org.springframework.data.rest.webmvc.RepositoryEntityController.getItemResource(RepositoryEntityController.java:349) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.lang.reflect.Method.invoke(Method.java:497) org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221) org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136) org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:114) org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827) org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738) org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85) org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963) org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897) org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861) javax.servlet.http.HttpServlet.service(HttpServlet.java:622) org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) javax.servlet.http.HttpServlet.service(HttpServlet.java:729) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:87) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) note The full stack trace of the root cause is available in the Apache Tomcat/8.5.4 logs.
3 Answers
markmneimneh
14,132 PointsNever Mind
The problem was that you need to go back to the Body tab and make sure that the format is JSON(application/Json) and there is no typo in the request
hchris
Courses Plus Student 11,116 PointsI realize you found the answer that worked for you, but going back to the body didn't work for me as Postman isn't sending a body on the GET request. I had to put quotes around the value for If-None-Match.
Steven Stanton
59,998 PointsThanks hchris - I had the same issue
Fahad Mutair
10,359 PointsThanks @hchris , saved my day with that solve
"0"
Michael Gulley
19,465 PointsThanks @hchris!
Brendan Whiting
Front End Web Development Techdegree Graduate 84,738 PointsThanks, adding quotes around the value fixed my problem too.
Matt Malone
11,437 PointsYes, adding quotes to the number worked for me! And I also got a 304 when I changed the value.