Problem with redirection to anchors in Win-deployment

Susanne Schneider <[email protected]>
Newsgroups gmane.comp.web.webobjects.devel
Message-ID <[email protected]>
Hi,

I just wanted to share some experience we just had with java-handling of 
anchors and one of our customers, who against our advice insists on 
deploying on windows.

The situation: At one point in our application we want to redisplay a 
page after the user has clicked on one of several active images. The 
page should jump back to the clicked image.
The problems emerges from the following code where I don't know who the 
primary author was (assumed the "anchor" variable is set during the 
click on the image):

public void appendToResponse(WOResponse res, WOContext ctx) {
     if (anchor != null) {
         res.setHeader(ctxt.componentActionURL() + "#" + anchor, 	
                       "location");
         res.setHeader("text/html", "content-type");
         res.setHeader("0","content-length");
         res.setStatus(302);
         anchor = null;
     } else {
         super.appendToResponse(res, ctx);
     }
}

It seems, that the webserver does not handle this kind of redirect 
correct, the url and header information shows the componentActionURL 
doubled which leads to a session-restoration error instead of the wanted 
page-reload.

I know nothing about webserver configuration, but there is a better 
solution for this: just put this javascript at the bottom of the page:

<script language="javascript">
     document.location='#<webobject name="StringAnchor"></webobject>';
</script>

and in wod:

StringAnchor: WOString { value=anchor; }

and forget the redirect!

Susanne
-- 
Susanne Schneider
Coordinator secuSuite Development

iAS interActive Systems GmbH
Dieffenbachstraße 33 c, D-10967 Berlin

fon    +49(0)30 69 004 - 205
fax    +49(0)30 69 004 - 210
mail   [email protected]
web    http://www.interActive-Systems.de
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.