Re: URL Rewriting/Servlet Question...

On Fri, 21 May 1999, Adam Hill wrote:

> Is there a way, on the Jigsaw side to do URL redirection behind the scenes,
> based on if a file is there or not? Or serve the file *AS IF* it was where
> the client thought it was (Like the File Servlet), even though it is
> somewhere else.
> 
> Here is the scenario:
> 
> I am working on a piece of software that serves up web pages to a user.
> 
> The user could be:
> 
> 1) Accessing his content locally off of his computer.(running Jigsaw on his
> workstation) In which case all of the data I wish is on the local filesystem
> (HD, CD, DVD). Everything is fine.
> 
> 2) Accessing the content over the Internet off of a server and have a set of
> CD's for the big media (audio and video). So by virtue of the file not being
> there, redirect to the local media for a given file.

One thing that can be done is a kind of Relocate filter, but this one will
not work at lookup time, it will be an outGoingFilter instead.
The thing is, try to perform the request, then catch the Reply back
(outGoingFilter), if the response code is HTTP.NOT_FOUND (aka 404), then
you may want to rewrite the URL and send back a HTTP.FOUND or
TEMPORARY_REDIRECT or PERMANENT REDIRECT. And sends the right (rewritten)
URI to the client (that way you can easily redirect to another server).
Hope this helps,

      /\          - Yves Lafon - World Wide Web Consortium - 
  /\ /  \        Architecture Domain - Jigsaw Activity Leader
 /  \    \/\    
/    \   /  \   http://www.w3.org/People/Lafon - ylafon@w3.org    

Received on Monday, 24 May 1999 17:46:11 UTC