Questions tagged [content-negotiation]

Content negotiation is a mechanism defined in the HTTP specification that makes it possible to serve different versions of a document (or more generally, a resource representation) at the same URI, so that user agents can specify which version fit their capabilities the best.

184 questions
0
votes
2 answers

Getting 406 Could not find acceptable representation /Spring JSON Test. How to ignore .htm extension in tests?

Controller needs uses .htm extensions for all handlers, including JSON REST endpoints. How should I test for REST endpoints? Problem: I cannot disable suffix interpretation and I am getting 406 "Could not find acceptable representation" Tried…
Witold Kaczurba
  • 9,845
  • 3
  • 58
  • 67
0
votes
1 answer

How do I what Content Types are on offer (for HTTP Content Negotiation)?

What one gets back when resolving a DOI depends on content negotiation. I was looking at https://citation.crosscite.org/docs.html#sec-3 and I see different services offer different Content Types. For a particular URL I want to know all the content…
Frames Catherine White
  • 27,368
  • 21
  • 87
  • 137
0
votes
1 answer

mod_rewrite rules and content negotiation

I am relatively new to mod_rewrite, but have a site which I would like to have "pretty urls." Similarly to SO :). I am attempting to have things like: "http://www.whatever.com/search/test" get rewritten to "http://www.whatever.com/search.php?q=test"…
Evan Teran
  • 87,561
  • 32
  • 179
  • 238
0
votes
1 answer

Getting RDF for a resource from DBpedia

If I make an HTTP GET request on DBpedia on a resource say with content-type text/turtle,application/rdf+xml,text/ntriples,application/ld+json, I get the HTML content of the page…
Noor
  • 19,638
  • 38
  • 136
  • 254
0
votes
0 answers

Dynamically generate an object's HTML with Razor

I'd like to create a MediaTypeFormatter that handles HTML MIME types, similar to this. The catch is that I don't want (or have) a view/template file: I want to generate the HTML string given just the object (the value) and it's type. If Razor…
ricksmt
  • 888
  • 2
  • 13
  • 34
0
votes
1 answer

Content Negotiation in Web API via Agent Driven Negotiation (HTTP)

I understand how Server Driven Negotiation takes place via setting Accept and Content-Types. But am confused how is Agent Driven Negotiation taking place. Documentation to refer -…
Amul
  • 13
  • 4
0
votes
1 answer

How to bind and create html coming from asp.net web api with client side

I want to return html output from api. The output is in form of a list. I want to fetch this html list from api and bind it to the element on my client side. The api looks like: public IHttpActionResult LoadCities() { …
0
votes
1 answer

Web Api 2 Content Negotiation not obeying Accept Header

Following Darrel Miller's guide I'm posting raw data to my web api controller and persisting it. The content could be application/xml or application/json. In the corresponding get method I retrieve the posted content, parsing to either XElement for…
0
votes
1 answer

Grails Content Negotiation - handling unsupported type

We are using content negotiation in our service using the Accept header and the withFormat method....the issue we are facing is that we want to return a 406 http status if the Accept header has a type which is not supported by our service....can…
VKA
  • 1
0
votes
1 answer

Spring Security 4.0 Content Negotiation restrictiions

I have an app that uses spring security 4.0 and i am concern now about the content negotiation response that this app could send on a REST web service i.e. my target is to restrict the response on a global basis irrelevant of the type of the request…
Tito
  • 2,234
  • 6
  • 31
  • 65
0
votes
1 answer

Cannot create inner bean 'org.springframework.web.servlet.view.xml.MarshallingView#1e9ad27'

In rest-servlet.xml the below configuration is made ..
raja
  • 1
  • 2
0
votes
1 answer

Serving static files with content negotiation using embedded Jetty

I have an application using embedded Jetty to serve both the frontend of the site but also the API. It's written in Scala, but that's not really relevant. My file that sets everything up looks like this: val servlet = new ServletHolder(Servlet) val…
bicpence
  • 167
  • 3
  • 9
0
votes
1 answer

If the same URL can serve different content types shoud Vary include accept?

If the same URL can serve different content types for the same resource, must Vary include Accept ? Or do browser caches and proxies understand it as being implicit ? Example: GET /some/thing HTTP/1.1 Accept: application/json This response HTTP/1.1…
redben
  • 5,578
  • 5
  • 47
  • 63
0
votes
1 answer

ServiceStack media type

I am reading the jsoiapi document jsopi.org Can some one help me understand this Server Responsibilities Servers MUST send all JSON API data in response documents with the header Content-Type: application/vnd.api+json without any media type…
Greens
  • 3,061
  • 11
  • 43
  • 61
0
votes
1 answer

Content negotiation in WEB API without DataContract

How do I make HttpResponseMessage follow xml schema rather then datacontract? i tried to do return new HttpResponseMessage() { StatusCode = HttpStatusCode.OK, Content = new ObjectContent(foo,…
mko
  • 6,638
  • 12
  • 67
  • 118