JSON-LD Accept Header

Hi,

I'm currently testing content negotiation on Apache 2.4.7 on ubuntu. I have
enabled htaccess and added the mime types below in htaccess. I also added
application/ld+json to the mime.types config file in apache. The header
requests all seem to be working fine except JSON-LD. Is there anything I
need to add to the JSON-LD header accept? When I try to test this out with
curl the server returns HTML, RDF/XML, and Turtle content types as
expected. But when I try the Accept: application/ld+json" header it returns
RDF/XML. Do I need to explicitly set up some type of content-type match or
 use MultiviewsMatch? I know this question is specific to apache, but I
can't seem to find any modern examples of the best way to do this for
JSON-LD. Thanks in advance for any suggestions or tips.

Here are the curl examples:

curl --header "Accept: application/rdf+xml" -L
http://xapi.vocab.pub/ontology

curl --header "Accept: text/turtle" -L http://xapi.vocab.pub/ontology
curl --header "Accept: application/ld+json" -L
http://xapi.vocab.pub/ontology


.HTACCESS FILE


# Turn off MultiViews
Options -MultiViews

# Rewrite engine setup
RewriteEngine On

# Directive to allow Cross origin requests
Header add Access-Control-Allow-Origin "*"
Header add Access-Control-Allow-Headers "origin, x-requested-with,
content-type"
Header add Access-Control-Allow-Methods "PUT, GET, POST, DELETE, OPTIONS"
# Directive to ensure *.rdf files served as appropriate content type,
# if not present in main apache config
AddType text/html .html
AddType application/rdf+xml .rdf
AddType  text/turtle   .ttl
AddType application/ld+json .jsonld

# Rewrite rule to serve HTML content from the vocabulary URI if requested
RewriteCond %{HTTP_ACCEPT}
!application/rdf\+xml.*(text/html|application/xhtml\+xml)
RewriteCond %{HTTP_ACCEPT} text/html [OR]
RewriteCond %{HTTP_ACCEPT} application/xhtml\+xml [OR]
RewriteCond %{HTTP_USER_AGENT} ^Mozilla/.*
RewriteRule ^ontology$ http://xapi.vocab.pub/ontology/index.html [R=303]

# Rewrite rule to serve RDF/XML content from the vocabulary URI if requested
RewriteCond %{HTTP_ACCEPT} application/rdf\+xml
RewriteRule ^ontology$ http://xapi.vocab.pub/ontology.rdf [R=303]

# Rewrite rule to serve Turtle content from the vocabulary URI if requested
RewriteCond %{HTTP_ACCEPT} text/turtle
RewriteRule ^ontology$ http://xapi.vocab.pub/ontology.ttl [R=303]

# Rewrite rule to serve JSON-LD content from the vocabulary URI if requested
RewriteCond %{HTTP_ACCEPT} application/ld+json
RewriteRule ^ontology$ http://xapi.vocab.pub/ontology.jsonld [R=303]

# Choose the default response
# ---------------------------

# Rewrite rule to serve the RDF/XML content from the vocabulary URI by
default
RewriteRule ^ontology$ http://xapi.vocab.pub/ontology.rdf [R=303]

Received on Thursday, 6 August 2015 17:45:45 UTC