In a web MVC Spring application, I can configure the app to favor the extension of the request path to determine the requested media type over the 'accept' headers.
Adding:
@Override
public void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
configurer.favorPathExtension(true);
}
to my Spring web configuration, will favor the path extension over the accept header the client sends.
For instance, for the following HTTP request:
POST http://somehost:8080/some/path.xml HTTP/1.1
accept: application/json
...
On that example, Spring will 'think' the client accepts xml
and not application/json
.
If I change the configurer
like this:
configurer.favorPathExtension(false);
spring will ignore the xml
'extension' and use the application/json
header.
My question is, can I configure Spring to not favor the path extension for only one endpoint?
For instance, if I have a controller with multiple endpoints:
@RequestMapping(value="/myEndpoint1", ...
...
@RequestMapping(value="/myEndpoint2", ...
I would like to know if is possible that all endpoints except myEndpoint1
favor the path extension over the accept header.
Aucun commentaire:
Enregistrer un commentaire