portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Glenn Golden <ggol...@umich.edu>
Subject Turbine - Jetspeed interaction problems
Date Tue, 26 Mar 2002 03:24:38 GMT
Bug: IE hangs when leaving customizers... I don't know how widespread this
problem is, is it just IE 6 on XP? Is it just Jetspeed running with jdk
1.4.0 in Tomcat 4.0.2?  Whatever - it's a problem, and we are doing
something against the HTTP rules.

Problem: last month, many Jetspeed actions were modified to use a redirect
on cancel or done.  Code like this in MultiColumnControllerAction.java:

                // bring logged on user to homepage with internal redirect
                DynamicURI duri = new DynamicURI(data);
                data.getResponse().sendRedirect(duri.toString());

Note the comment refers to "internal redirect", but this is a real HTTP
redirect attempt.  After this is done in the action, the page goes on to
execute the screen.  It known nothing about the redirect.  It goes on to
write stuff to the response.

HTTP / servlet rules are that a) a redirect can be placed into the response
only before anything has been written to the response, and b) once the
redirect is placed, nothing may be written.  It seems that our violation of
this rule is messing up IE.

Comment:  I *really* like the idea of being able to use a redirect in an
action to end a customization to get the browser URL back to a good URL.

Solution:  Fix Turbine.  Turbine should not let us make this mistake.  The
Page code that is messing us up is in Turbine's DefaultPage.  And a final
mess up is made in the Turbine servlet's doGet().

1) Define a standard in Turbine for an action to make an HTTP redirect.
RunData already has get/setRedirectURI(), and just setting this to a
non-null non-blank value in an Action should be enough.

2) Modify DefaultPage doBuild() to, after running the action, check for a
redirect, and do whatever is needed.  If we standardize on
"RunData.setRedirectURI()", then the following code inserted in doBuild()
after the action call would work:

ActionLoader.getInstance().exec ( data, data.getAction() );
if ((data.getRedirectURI() != null) && (data.getRedirectURI().length() > 0))
{
    // directly set the response object for a redirect
    data.declareDirectResponse();
    data.getResponse().sendRedirect(data.getRedirectURI());
    return;
}

3) Turbine doGet() must make sure not to inadvertently create an output if
one has not yet been created!  This is what it does now in the finally()
block with "data.getOut().close();".  getOut() makes the PrintWriter, and
even closing it right away causes IE to get messed up.  We need this code
instead:

if (data.isOutSet()) data.getOut().close()

Next Step: If we like this, how do we get this into Turbine?

- Glenn
 
--------------------------------------------
Glenn R. Golden, Systems Research Programmer
University of Michigan School of Information
ggolden@umich.edu               734-615-1419
http://www-personal.si.umich.edu/~ggolden/
--------------------------------------------

--
To unsubscribe, e-mail:   <mailto:jetspeed-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:jetspeed-dev-help@jakarta.apache.org>


Mime
View raw message