tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jens Skripczynski <>
Subject Re: content negotiation with tomcat
Date Tue, 08 Apr 2003 20:59:36 GMT

Shapira, Yoav:
> >i just ran over some tips at the saying url should not
> >have content specific endings (like .html, jsp, .gif).
> Can you please post the URL to these tips?  I've never heard them before
> and don't buy them without further convincing ;)
The tips is Part of the Quality Assurance
 (to make the web a better place to surf ... :))
> I don't know the answer to your question really, as you've left the
> definition of "content-negotiation" wide open.  You could, for example,
> have a servlet mapped and coded to serve pictures out of
> http://yourhost:yourport/yourapp/pictures/x as x.gif
As far as I understand it, the Client tells the server what kind of
files (html, jpg, png) and languages (en, de..) he will accept.
The server has a list server-side-mapping and if many mappings are
avaible a list of the quality.

One drawback I have experienced so far is, that this negotiation
has no override mode. (I visited and got the
german version but wanted english. their solution was to change the
browser configuration which is not too user friendly).

To me this kind of mapping sounds very reasonable, because i do not
have to worry if I change my static html pages to jsp's, that
old bookmarks from other people break or I have to setup some URL
rewriting engine.

Has somebody tried something like the W3 QA Team recommends ?
Does it make life easier or produce the same amount of sleepless 
   nights ?

Pages for reference:
"What to leave out"->"File name extension"
    This is a very common one. "cgi", even ".html" is something which will
    change. You may not be using HTML for that page in 20 years time, but you
    might want today's links to it to still be valid. The canonical way of 
    making links to the W3C site doesn't use the extension.

"How can I remove the file extensions"
   If you are using, for example, Apache, you can set it up to do content
   negotiation. You keep the file extension (such as .png) on the file (eg
   mydog.png), but refer to the web resource without it. Apache then checks the
   directory for all files with that name and any extension, and it can also 
   pick the best one out of a set (e.g. GIF and PNG). (You do not have to put
   different types of file in different directories, in fact the content
   negotiation won't work if you do.)

   - Set up your server to do content negotiation
   - Make references always to the URI without the extension

   References which do have the extension on will still work but will not allow
   your server to select the best of currently available and future formats.
   (In fact, mydog, mydog.png and mydog.gif are each valid web resources. mydog
   is content-type-generic. mydog and mydog.gif are content-type-specific.)
   Of course, if you are building your own server, then using a database to
   relate persistent identifiers to their current form is a very clean idea --
   though beware the unbounded growth of your database.   

For Apache Content Negotiatoin: 
    "Content Negotiation Explained"


Jens Skripczynski
E-Mail: skripczynski(at)mail2003(dot)skripczynski(dot)de

Tollef Fog Heen
Unix _IS_ user friendly... It's just selective about who its friends are.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message