When a request comes in to the spring dispatcher, part of the controller mapping/matching is matching accepted media types on the client side to producible media types on the controller side (so you can have controllers that are only distinguishable by their produced media types).
The bad news is that springmvc in its default configuration favors the extension of the requested url over any accept header in the request.
In your example, when you are requesting abc
there is no match on the extension so other contentent negotiation strategies are kicking in eventually resolving to the right type (via accept
header). But if you request abc.com
spring will derive a mime type of application/octet-stream
that doesn't match the produces
of your controller and generating a 406
(because there is no matching controller).
You can find the default mime matching for path extensions in the spring-context-support.jar in org/springframework/mail/javamail/mime.types
(see https://github.com/spring-projects/spring-framework/blob/master/spring-context-support/src/main/resources/org/springframework/mail/javamail/mime.types#L278 ).
You can disable this 'feature' in your dispatcher config so spring will not use the path extension to resolve the mime-type:
<bean id="contentNegotiationManager" class="org.springframework.web.accept.ContentNegotiationManagerFactoryBean">
<property name="favorPathExtension" value="false" />
</bean>
If you are using java config have a look at my related question/answer.