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

RE: Servlet setup question

From: Laird, Brian <BLaird@perseco.com>
Date: Wed, 2 Mar 2005 11:00:44 -0600
Message-ID: <198C7B6593B76E44B30C3AAC456E57A1059520@electra.Perseco.com>
To: "Yves Lafon" <ylafon@w3.org>
Cc: <www-jigsaw@w3.org>

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:

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?

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.
************************************************************************
Received on Wednesday, 2 March 2005 17:01:16 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 9 April 2012 12:13:37 GMT