Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Responding to different content type

 
Mahtab Alam
Ranch Hand
Posts: 391
1
Java MySQL Database PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was reading Oracle docs https://docs.oracle.com/cd/E19776-01/820-4867/ghrpv/ which says


If no methods in a resource are able to produce the MIME type in a client request, the Jersey runtime sends back an HTTP “406 Not Acceptable” error


So I wrote below code to see 406 error



Now If I make a get request with content-type application/xml it should give me 406 error in response but it returns GET called

406.PNG
[Thumbnail for 406.PNG]
Request with Content-Type application/xml
 
Mahtab Alam
Ranch Hand
Posts: 391
1
Java MySQL Database PHP
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got it, it should be Accept header not Content-Type header
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!