W3C home > Mailing lists > Public > www-jigsaw@w3.org > March to April 2000

Re: Content negotiation for index page

From: Dennis Sosnoski <dms@sosnoski.com>
Date: Wed, 29 Mar 2000 10:38:30 -0800
Message-ID: <38E24DA6.25B8E218@sosnoski.com>
To: Yves Lafon <ylafon@w3.org>
CC: www-jigsaw@w3.org
Hmmm, setting Negotiable on the Root DirectoryResource and indexing .html files
as content type text/html and .wml as text/vnd.wap.wml results in an HTTP 300
response, multiple choices, when accessed from either phone or regular browser.
The regular browser displays the choices, while the phone browser just reports
an HTTP error 300. Is there a way to have the server choose the content type
without sending a choice list back with a 300 response?

It looks like the web browser is specifying a list of Accept types starting with
several image/ types and ending with */*, while the web phone browser is
specifying a long list of application/ types followed by text/vnd.wap.wml and
then */*. To make this work properly I'd need to return the html page as the
default and only override it to send the wml page when text/vnd.wap.wml is
specifically listed as an Accept type. Can I do this using configuration
parameters, or do I need to use a servlet for the default page handling?

Also, once I set Negotiable on the Root DirectoryResource all servlets not
actually present as class files in the servlet directory to be found by the
indexer appear to be broken. Here's what I get trying to run a JSP in the Root
directory, using Gnujsp10:

Exception while servicing request for /snoop.jsp:

java.lang.NullPointerException
        at
org.w3c.jigsaw.servlet.JigsawServletContext.getRealPath(JigsawServletContext.java,
Compiled Code)
        at org.gjt.jsp.JspServlet$Page.getResourceImpl(JspServlet.java:689)
        at org.gjt.jsp.JspServlet$Page.needToRecompile(JspServlet.java, Compiled
Code)
        at org.gjt.jsp.JspServlet$Page.process(JspServlet.java, Compiled Code)
        at org.gjt.jsp.JspServlet.service(JspServlet.java:284)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:840)
        at
org.w3c.jigsaw.servlet.ServletWrapper.service(ServletWrapper.java:278)
        at
org.w3c.jigsaw.servlet.ServletWrapperFrame.perform(ServletWrapperFrame.java:118)
        at
org.w3c.tools.resources.FramedResource.performFrames(FramedResource.java,
Compiled Code)
        at org.w3c.tools.resources.FramedResource.perform(FramedResource.java,
Compiled Code)
        at org.w3c.jigsaw.http.httpd.perform(httpd.java, Compiled Code)
        at
org.w3c.jigsaw.servlet.ServletMapperFrame.perform(ServletMapperFrame.java:87)
        at
org.w3c.tools.resources.FramedResource.performFrames(FramedResource.java,
Compiled Code)
        at org.w3c.tools.resources.FramedResource.perform(FramedResource.java,
Compiled Code)
        at org.w3c.jigsaw.http.httpd.perform(httpd.java, Compiled Code)
        at org.w3c.jigsaw.http.Client.processRequest(Client.java, Compiled Code)
        at org.w3c.jigsaw.http.Client.startConnection(Client.java, Compiled
Code)
        at org.w3c.jigsaw.http.socket.SocketClient.run(SocketClient.java:114)
        at org.w3c.util.CachedThread.run(ThreadCache.java, Compiled Code)

Another servlet I added manually also throws a null pointer exception, but
HelloWorld still works okay.

I didn't try the FramedResource approach, that would probably avoid the servlet
problems but I believe it would still do the HTTP 300 response since it's still
using a NegotiatedFrame. I'm using Jigsaw 2.0.4, by the way.

  - Dennis

Yves Lafon wrote:
> 
> On Mon, 27 Mar 2000, Dennis Sosnoski wrote:
> 
> > I'd like to have different default pages for my site depending on
> > whether it's accessed from a cell phone browser (content type
> > text/vnd.wap.wml) or a regular web browser. It looks like it should be
> > possible to do this, but I haven't been able to figure out how to
> > configure it.
> 
> Content Negotiation is of course possible, and is very flexible.
> In your case you want to have the default page changed depending on .html
> or .wml.
> Let's suppose they are called Overview.html and Overview.wml (Having the
> same basename helps automation, but it is not required).
> If the container is declared to be negotiable, a Framed resource with a
> NegotiatedFrame [1] called "Overview" will be created.
> If the index of the container is set to be "Overview", then the default
> page will be served using content negotiation. (The index of the container
> can be modified per resource, or set directly in the indexer).
> 
> Also it is possible to do it direcly, just create a resource, ex: "foo", a
> FramedResource, and a NegotiatedFrame attached to it, and configure the
> variants (ex: Overview.html, Overview.wml and bar.txt), and everytime you
> want to reference Overview.html/wml or bar.txt, just reference
> "foo" instead. And this "foo" resource can be set as the index or one of
> the indexes of a container.
> Hope it is clear ;)
> 
> [1]: http://www.w3.org/Jigsaw/Doc/Reference/org.w3c.jigsaw.frames.NegotiatedFrame.html
> 
>       /\          - Yves Lafon - World Wide Web Consortium -
>   /\ /  \        Architecture Domain - Jigsaw Activity Leader
>  /  \    \/\
> /    \   /  \   http://www.w3.org/People/Lafon - ylafon@w3.org
Received on Wednesday, 29 March 2000 13:39:15 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 5 February 2014 07:14:07 UTC