- From: Paul Pazandak <pazandak@OBJS.com>
- Date: Thu, 30 Oct 1997 09:41:36 -0600
- To: Benoit Mahe <Benoit.Mahe@sophia.inria.fr>
- CC: www-jigsaw@w3.org
This worked quite well, thank you!! Paul. Benoit Mahe wrote: > > In a subclass of FileResource I may determine that I want to redirect the request to > > another file -- is this possible? Yes, I can change the filename & return the content of the > > other file, but this would bypass security & any file processing that may be done earlier in > > the request process. > > > > What is the proper way to redirect an HTTP request (in Jigsaw)? > > > > Paul. > > -- > > > > If you want to make a HTTP redirect with the MOVED_TEMPORARILY or > MOVED_PERMANENTLY reply code, look at w3c.jigsaw.resources.RelocateResource > otherwise the way to do an internal redirect could be : > > public Reply perform(Request request) > throws HTTPException, ClientException > { > Reply reply = null; > httpd server = getServer(); > String target = "/foo/bar/toto.html"; //the resource to redirect the > request > request.setReferer(getURLPath()); > > try { > request.setURL( new URL(server.getURL(), target)); > } catch (MalformedURLException ex) { > Reply error = request.makeReply(HTTP.INTERNAL_SERVER_ERROR); > error.setContent("<html><head><title>Server Error</title>"+ > "</head><body><h1>Server misconfigured</h1>"+ > "<p>The resource <b>"+getIdentifier()+"</b>"+ > "has an invalid target attribute : <p><b>"+ > getTarget()+"</b></body></html>"); > throw new HTTPException (error); > } > return server.perform(request); > } > > > > > - Benoît Mahé ------------------------------------------------------- > World Wide Web Consortium bmahe@w3.org, bmahe@sophia.inria.fr > Architecture domain - Jigsaw Team tel : 04 93 65 79 89 > --------------------------------------------------------------------- -- ******************************************************************** Paul Pazandak pazandak@objs.com Object Services and Consulting, Inc. http://www.objs.com Minneapolis, Minnesota 55420-5409 612-881-6498 ********************************************************************
Received on Thursday, 30 October 1997 10:42:52 UTC