- From: Yves Lafon <ylafon@w3.org>
- Date: Thu, 10 Mar 2005 18:59:07 +0100 (MET)
- To: "Laird, Brian" <BLaird@perseco.com>
- cc: www-jigsaw@w3.org
- Message-ID: <Pine.GSO.4.62.0503101851100.20596@gnenaghyn.vaevn.se>
On Wed, 2 Mar 2005, Laird, Brian wrote: > Yves, > > I am still struggling with this one. I build a custom resource which > just extends the ServletWrapper. Since I am using JDK 1.4 I decided it > would use regular expressions. Here is the code: the Lookup mechanism works only on containers, while ServletWrapper is a "leaf" resource. So the lookup mechanism is never called. > > package org.w3c.jigsaw.servlet; > > import org.w3c.tools.resources.LookupResult; > import org.w3c.tools.resources.LookupState; > import org.w3c.tools.resources.ProtocolException; > > > public class PersecoFrameworkServletWrapper extends ServletWrapper > { > public boolean lookup(LookupState ls, LookupResult lr) throws ProtocolException > { > if (ls.getURI() != null && ls.getURI().matches(getIdentifier())) > { > lr.setTarget(getResourceReference()); > return true; > } > return super.lookup(ls, lr); > } > } > > Then I defined a DirectoryResource with a ServletDirectoryFrame > underneath it. Then I added a resource under that directory with the > identifier of *.flow and pointed it to the class above. In stepping > through the code it just never seems to get my class. I always get a > 404 back from the server. Can you let me know what I am doing wrong on > this? I should be extending the ServletWrapperFrame instead? Wouldn't it be possible to have an indexer to handle this? you can map the "flow" extension to a FileResource+ServletMapperFrame and point to the URI of the servlet in charge of handling them. (a bit like for JSPs [1]) The servlet is located using an internal lookup, so it may be everywhere on the server. Or maybe I just misread what you really want there :) Thanks, [1] http://www.w3.org/Jigsaw/Doc/User/jsp.html > > Thanks, > Brian > > -----Original Message----- > From: Yves Lafon [mailto:ylafon@w3.org] > Sent: Wednesday, February 23, 2005 4:25 AM > To: Laird, Brian > Cc: www-jigsaw@w3.org > Subject: Re: Servlet setup question > > > On Tue, 22 Feb 2005, Laird, Brian wrote: > >> How do I configure a servlet in Jigsaw to listen on a specific >> extension? This extension will not be mapped to any physical file on >> the disk. My example is that I want to have a servlet listen in a >> specific directory for anything with .flow at the end. Is this possible >> and how would I go about doing it? In that same directory, I will >> probably have some images and static files. > > It is easy to do in the Jigsaw framework, but I don't know how to do that > with servlets. > The way to do this in Jigsaw is to overload the "lookup" method of a > resource or a frame. > > If your .flow are linked to existing files, the ServletMapperFrame on top > of a FileResource is the way to go (much like jsp, it delegates everything > to a servlet with the path of the .jsp given to the servlet, see [1]) > It might work without any physical file on the disk if you replace the > FileResource by a FramedResource which is only virtual. > Thanks, > > [1] http://www.w3.org/Jigsaw/Doc/User/jsp.html > > > >> >> >> Thanks in advance, >> >> Brian >> >> >> ************************************************************************ >> This e-mail and any accompanying documents or files contain information that is the >> property of Perseco, that is intended solely for those to whom this e-mail is addressed >> (i.e., those identified in the "To" and "Cc" boxes), and that is confidential, proprietary, >> and/or privileged. If you are not an intended recipient of this e-mail, you are hereby >> notified that any viewing, use, disclosure, forwarding, copying, or distribution of any of >> this information is strictly prohibited and may be subject to legal sanctions. If you have >> received this e-mail in error, please notify the sender immediately of any unintended >> recipients, and delete the e-mail, all attachments, and all copies of both from your system. >> >> While we have taken reasonable precautions to ensure that any attachments to this e-mail >> have been swept for viruses, we cannot accept liability for any damage sustained as a >> result of software viruses. >> ************************************************************************ >> > > -- Yves Lafon - W3C "Baroula que barouleras, au tiéu toujou t'entourneras."
Received on Thursday, 10 March 2005 18:00:04 UTC