cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tobia Conforto <tobia.confo...@linux.it>
Subject Redirect to GET, strange bug
Date Mon, 31 Mar 2008 08:46:48 GMT
Hello

I'm trying to implement in Cocoon a somewhat standard web behaviour:  
at the end of a form (final POST request, form fully validated, etc.)  
I'd like to redirect the user to a GET request before showing him the  
final 'Thank you' page.

This is often done in web programming, so that in case the user  
reloads the result page, he will just reload the page itself, and not  
execute the form logic twice.  The browsers use this interpretation  
too, by showing the user a warning "The form action will be executed  
again if you reload. Are you sure? Yes/No" when you try to reload a  
POST page.

I thought this would be easy to accomplish with continuations, but I'm  
hitting a strange bug.  This is the utility function I'm calling from  
my flows, AFTER the form has been processed (DB inserts, emails sent,  
etc), just BEFORE doing the sendPage() with the result page:

function redirectToGet() {
	var done = false;
	var cont = cocoon.createWebContinuation();
	if (! done) {
		done = true;
		cocoon.redirectTo('/cont=' + cont.id, true);
		cocoon.exit();
	}
}

The problem is:

- if I leave out the cocoon.exit(), I get:
IllegalStateException: Pipeline has already been processed for this  
request

- if I put the cocoon.exit() as shown, I get:
ProcessingException: Attempted to process incomplete pipeline

What gives?

I'm using Cocoon 2.1.10


Tobia

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message