-
Notifications
You must be signed in to change notification settings - Fork 38.6k
Description
Hans Desmet opened SPR-7837 and commented
Given following configuration of the DispatcherServlet in web.xml
<servlet>
<servlet-name>springDispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/springControllers.xml</param-value>
</init-param>
<init-param>
<param-name>dispatchOptionsRequest</param-name>
<param-value>true</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>springDispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
And the following MVC Controller:
@Controller
@RequestMapping
("/persons")
public class PersonController {
@RequestMapping
(method = RequestMethod.OPTIONS)
public ResponseEntity getPersonsOptions() {
HttpHeaders headers = new HttpHeaders();
headers.setAllow(EnumSet.of(HttpMethod.GET, HttpMethod.POST));
return new ResponseEntity(headers, HttpStatus.OK);
}
}
When you do a request to the URI /persons with the HTTP method OPTIONS, you get a request which contains the Alow header TWICE:
- once with the value GET, HEAD, POST, PUT, DELETE, TRACE, OPTIONS
this is incorrect and most likely generated by the standard HttpServlet behavior of OPTIONS requests - and once with te value GET,POST (this is correct)
Affects: 3.0.5