Note that there are some explanatory texts on larger screens.

plurals
  1. POSpring 3.0 HEAD Requests
    primarykey
    data
    text
    <p>recently we moved to spring 3.0 Controller handling like this:</p> <pre><code>@Controller public class MyController { @RequestMapping(method = RequestMethod.POST) protected String onSubmit ( Form form, Errors errors) { // handle POST } @RequestMapping(method = RequestMethod.GET) protected void getForm ( Form form ) { // handle GET } } </code></pre> <p>Now we are getting lots of Exceptions in our logs because of HEAD Requests.</p> <pre><code>org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'HEAD' not supported at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter$ServletHandlerMethodResolver.resolveHandlerMethod(AnnotationMethodHandlerAdapter.java:621) at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:422) at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:415) ... </code></pre> <p>I would like to support HEAD Requests the same way like GET Requests, but obeying the HTTP reference of course:</p> <blockquote> <p>The HEAD method is identical to GET except that the server MUST NOT<br> return a message-body in the response. The metainformation contained in the HTTP headers in response to a HEAD request SHOULD be identical to the information sent in response to a GET request. This method can be used for obtaining metainformation about the entity implied by the request without transferring the entity-body itself. This method is often used for testing hypertext links for validity, accessibility, and recent modification. <a href="http://www.ietf.org/rfc/rfc2616.txt" rel="nofollow noreferrer">http://www.ietf.org/rfc/rfc2616.txt</a></p> </blockquote> <p>Does anybody has an elegant solution or is there even a spring solution out-of-the-box?</p> <p>I searched the web but did not find any answers to this.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload