title: How to ignore any http content headers on Spring @RestController?
body: <p>I have some <code>webservice</code> endpoints that should offer <code>json</code> data by default. Therefore configuring as follows:</p>
  
  <pre><code>@Configuration
  public class ContentNegotiationConfiguration implements WebMvcConfigurer {
      @Override
      public void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
          configurer.defaultContentType(MediaType.APPLICATION_JSON);
      }
  }
  </code></pre>
  
  <p>Problem: now I want to create an endpoint that offers a file download (thus is not json).</p>
  
  <pre><code>@RestController
  public class FileServlet {
     @GetMapping(value = "/docs/{filename}", consumes = MediaType.ALL_VALUE, produces = APPLICATION_OCTET_STREAM_VALUE)
     public Object download(@Pathvariable filename) {
            File file = fileservice.resolve(filename);
            return new FileSystemResource(file);
     }
  }
  </code></pre>
  
  <p>Accessing this endpoint from the browser works fine. I can download the files.</p>
  
  <p>But: when using native clients that are not setting any http headers like content-type, accept-header etc, the access fails with:</p>
  
  <pre><code>WARN o.s.w.s.m.m.a.ExceptionHandlerExceptionResolver: Resolved 
  [org.springframework.web.HttpMediaTypeNotAcceptableException:
  Could not find acceptable representation]
  </code></pre>
  
  <p>All of them result in the exception:</p>
  
  <pre><code>curl localhost:8080/docs/testfile.txt
  curl -O localhost:8080/docs/testfile.txt
  wget localhost:8080/docs/testfile.txt
  </code></pre>
  
  <p>This is probably because I set the default content type to <code>json</code> above in <code>ContentNegotiationConfiguration</code>. I cannot change that due to all the other endpoints that should be json by default.</p>
  
  <p>Question: how can I explicit <strong>ignore that default json setting on that single endpoint</strong>, and always just offer the download stream?</p>