Class: Rack::LinkedData::ContentNegotiation

Inherits:
RDF::ContentNegotiation
  • Object
show all
Defined in:
lib/rack/linkeddata/conneg.rb

Overview

Rack middleware for Linked Data content negotiation.

Uses HTTP Content Negotiation to find an appropriate RDF format to serialize any result with a body being RDF::Enumerable.

Override content negotiation by setting the :format option to #initialize.

Add a :default option to set a content type to use when nothing else is found.

Examples:

use Rack::LinkedData::ContentNegotation, :format => :ttl
use Rack::LinkedData::ContentNegotiation, :format => RDF::NTriples::Format
use Rack::LinkedData::ContentNegotiation, :default => 'application/rdf+xml'

See Also: