You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by sy...@apache.org on 2005/06/23 11:22:13 UTC
svn commit: r193120 -
/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/flow/javascript/Form.js
Author: sylvain
Date: Thu Jun 23 02:22:12 2005
New Revision: 193120
URL: http://svn.apache.org/viewcvs?rev=193120&view=rev
Log:
Fix Ajax with Safari
Modified:
cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/flow/javascript/Form.js
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/flow/javascript/Form.js
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/flow/javascript/Form.js?rev=193120&r1=193119&r2=193120&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/flow/javascript/Form.js (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/flow/javascript/Form.js Thu Jun 23 02:22:12 2005
@@ -149,10 +149,27 @@
this.submitId = widget == null ? null : widget.getId();
if (cocoon.request.getParameter("cocoon-ajax") != null) {
- // Ask the client to load the page
+ // Ask the client to issue a new request reloading the whole page.
+ // As we have nothing special to send back, so a header is just what we need...
cocoon.response.setHeader("X-Cocoon-Ajax", "continue");
- cocoon.response.setHeader("Content-Length", "0");
cocoon.sendStatus(200);
+
+ // ...but Safari doesn't consider empty responses (with content-length=0) as
+ // valid ones. So send a dummy response by using directly the HttpResponse's
+ // output stream. Avoiding this hack would require to put an additional pipeline
+ // in the sitemap for just sending this dummy response, which isn't nice.
+ var httpResponse = objectModel.get(org.apache.cocoon.environment.http.HttpEnvironment.HTTP_RESPONSE_OBJECT);
+ if (httpResponse) {
+ httpResponse.setContentType("text/xml");
+ var text = "<?xml version='1.0'?><bu:document xmlns:bu='" +
+ org.apache.cocoon.transformation.BrowserUpdateTransformer.BU_NSURI +
+ "'></bu:document>";
+ httpResponse.writer.print(text);
+ } else {
+ // Empty response
+ cocoon.response.setHeader("Content-Length", "0");
+ }
+
FOM_Cocoon.suicide();
}