RE: Servlet setup question

On Mon, 14 Mar 2005, Laird, Brian wrote:

> Hey Yves,
>
> Did you see my follow up email about this?  I couldn't get the indexer 
> to work without having a physical file located on the disk.  If you 
> didn't get my other email let me know and I can resend it.  I really 
> would like your opinion about what I am doing and if it is "o.k." from a 
> design sense or if it is a really big hack.

By "the indexer" you mean the one used for jsp? How about replacing the 
FileResource by a FramedResource?

Going back to your solution, the best solution would be to extend the 
ServletDirectoryFrame, and change the "lookupOther" method to fit your 
need. If lookupOther is defined, then the frame must be put on a 
FramedResource (ie: not a "physical" resource). It won't be a container 
per-se but from what I understood of the situation you won't have files 
underneath, so the remaining part of the URI is treated as extra 
parameters. You can see VirtualHostFrame as an example.

(FramedResource calls frames[i].lookup(ls,lr), in HTTPFrame, lookup calls 
(depending if it is attached to a file resource or not, lookupFile, 
lookupDirectory or lookupOther).
Thanks,

>
> Thanks,
> Brian
>
> ________________________________
>
> From: Yves Lafon [mailto:ylafon@w3.org]
> Sent: Thu 3/10/2005 11:59 AM
> To: Laird, Brian
> Cc: www-jigsaw@w3.org
> Subject: RE: Servlet setup question
>
>
>
>
> 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."
>
>
> ************************************************************************
> 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 Tuesday, 22 March 2005 10:46:09 UTC