title: Spring MVC: Getting 406 response while mapping the @PathVariable with url which has ".com" in the last
body: <p>I am in a project and getting <code>HTTP Status 406</code> in the response when my URL is such like that: </p>
  
  <p><code>http://www.mydomain.com/project/website/reply/google.com</code></p>
  
  <p>I found its throwing 406 when url ended with <code>.com, .in</code> etc, and when the url ended with <code>.do, .co, .coom</code> etc, then its response as a HTML page but not mapped the full url</p>
  
  <p>eg: Suppose I have 2 url </p>
  
  <ol>
  <li><p><code>http://www.mydomain.com/project/website/reply/google.com</code> </p>
  
  <p>// will return 406</p></li>
  <li><p><code>http://www.mydomain.com/project/website/reply/apple.do</code> </p>
  
  <p>// will return HTML but <code>.do</code> will be ignored by <code>@PathVariable</code>, so you will get only <code>apple</code> in the place on <code>apple.do</code>. I want the full value after the <code>reply/</code></p></li>
  </ol>
  
  <p>As I said that I am getting <code>HTTP Status 406(The resource identified by this request is only capable of generating responses with characteristics not acceptable according to the request "accept" headers.)</code>, So I googled and got some suggestions like <code>Ignoring accept headers</code> and <code>ContentNegotiations</code>, but still getting the same response.</p>
  
  <p>I am using: </p>
  
  <ul>
  <li>Spring MVC 3.2.0.RELEASE (with JAVA Config)</li>
  <li>jackson.version 2.1.0</li>
  <li>Thymeleaf Template Engine 2.1.2.RELEASE</li>
  </ul>
  
  <p>Please let me know if you want any other information from my side.</p>
  
  <p>Here is my code for <code>ContentNegotiatingViewResolver</code> (using this <a href="https://spring.io/blog/2013/06/03/content-negotiation-using-views" rel="nofollow">ref</a>) in JAVA config but its not working:</p>
  
  <pre><code>@Override
  public void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
  System.out.println("### configureContentNegotiation is called");
  configurer.ignoreAcceptHeader(true).defaultContentType(MediaType.TEXT_HTML);
  }
  
  @Bean
  public ViewResolver contentNegotiatingViewResolver(
  ContentNegotiationManager manager) {
  System.out.println("### contentNegotiatingViewResolver is called");
  List&lt;ViewResolver&gt; resolvers = new ArrayList&lt;ViewResolver&gt;();      
  ThymeleafViewResolver viewResolver = new ThymeleafViewResolver();
  viewResolver.setTemplateEngine(templateEngine());      
  
  // Create the CNVR plugging in the resolvers and the content-negotiation manager
  ContentNegotiatingViewResolver resolver = new ContentNegotiatingViewResolver();
  resolver.setViewResolvers(resolvers);
  resolver.setContentNegotiationManager(manager);
  return resolver;
  }
  </code></pre>
  
  <p>Please give me some suggestion for this.</p>