Q: How to config for multi-MIME type of a given resource

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

 

I need some help finding the relevant documentation and/or a solution for the following.

 

Problem:

 

I have an Apache httpd server that I want to use to serve a variety of different formats for the same resource URL.  Some of the resources are simple static files (OWL2 ontologies in this case serialized as both RDF/XML and Turtle).

 

Additionally I have a Tomcat service that I want to use to silently intercept  requests text/html and application/xhmtl versions of the resource. 

 

I want the url rewrite/redirect/proxy to be invisible to the caller  (http://example.com/ontology.owl with an Accept: text/html should go to  http://example.com/parrot/parrot?documentUri=http://example.com/ontology.owl to generate the proper HTML documentation output but not change the URL as a  RewriteRule does, so that the user still thinks the URL is  http://example.com/ontology.owl

 

Use cases:

 

GET http://example.com/v1/ontology.owl (Accept: application/rdf+xml)

Returns the /v1/ontology.owl file found in the htdocs

 

GET http://example.com/v1/ontology.owl (Accept: text/turtle)

Returns the /v1/ontology.owl.ttl file found in the htdocs

 

GET http://example.com/v1/ontology.owl (Accept: text/html)

Returns the response from forwarding the request to a Tomcat webapp running at

http://example.com/parrot/parrot?documentUri=http://example.com/ontology.owl

 

Additionally, I would like the URL to remain http://example.com/v1/ontology.owl and  not get rewritten or redirected where the client sees the webapp service's URL.

 

I currently have the following rewrite rules in place that do most of what I want.

 

RewriteCond %{HTTP_ACCEPT} !application/rdf\+xml.*(text/html|application/xhtml\+xml)

RewriteCond %{HTTP_ACCEPT} text/html [OR]

RewriteCond %{HTTP_ACCEPT} application/xhtml\+xml

RewriteRule ^/v1/ontology.owl$ http://example.com/parrot/parrot?documentUri=http://example.com/v1/ontology.owl [L]

 

RewriteCond %{HTTP_ACCEPT} application/rdf\+xml

RewriteRule ^/v1/ontology.owl$ /v1/ontology.owl [L]

 

# Rewrite rule to serve RDF/XML content from the vocabulary URI if requested

RewriteCond %{HTTP_ACCEPT} text/turtle

RewriteRule ^/v1/ontology.owl$ /v1/ontology.owl.ttl [L,R=303]

 

# Choose the default response

# ---------------------------

# Rewrite rule to serve the RDF/XML content from the vocabulary URI by default

RewriteRule ^/v1/ontology.owl$ /v1/ontology.owl [L]

 

 

How do I set up the config to handle the browser-friendly formats as described above?

 

Any help would be appreciated.  I've looked through the docs and searched the  net, but am at a loss on figuring this one out.

 

Thank you very much for reading through this massive wall of text.  I appreciate any help given.

 

/Paul

--------------------------------------------------- Confidentiality Notice: This electronic mail transmission is confidential, may be privileged and should be read or retained only by the intended recipient. If you have received this transmission in error, please immediately notify the sender and delete it from your system.

[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux