I'm working on Jetspeed, and am tracking down a problem with some of the
Action code in Jetspeed, which was recently changed to start calling for a
URL redirect. With Internet Explorer, this doesn't work.
I'm proposing some chages to Turbine to better support the ability to call
for a URL redirect in an Action class.
Bug: IE hangs when leaving the Jetspeed 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. Or
better, Turbine should have a well defined and supported way to call for a
redirect from an Action. 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 to tell Turbine that
we want a redirect.
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()
- Glenn
--------------------------------------------
Glenn R. Golden, Systems Research Programmer
University of Michigan School of Information
[EMAIL PROTECTED] 734-615-1419
http://www-personal.si.umich.edu/~ggolden/
--------------------------------------------
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>