Author: julien(a)jboss.com
Date: 2007-04-03 11:18:26 -0400 (Tue, 03 Apr 2007)
New Revision: 6911
Modified:
trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxController.java
trunk/theme/src/bin/portal-ajax-war/js/portal/dyna.js
trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/JSONMarshaller.java
trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/response/UpdatePageStateResponse.java
Log:
- piggy back view state to client
- make ajax POST execute in a blocking manner
Modified: trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxController.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxController.java 2007-04-03
13:34:24 UTC (rev 6910)
+++
trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxController.java 2007-04-03
15:18:26 UTC (rev 6911)
@@ -367,7 +367,7 @@
PageResult res = new PageResult(page.getName(), page.getProperties(),
portal.getProperties());
//
- UpdatePageStateResponse updatePage = new UpdatePageStateResponse();
+ UpdatePageStateResponse updatePage = new
UpdatePageStateResponse(ctx.getViewId());
//
for (Iterator i = windowToRefresh.iterator();i.hasNext();)
Modified: trunk/theme/src/bin/portal-ajax-war/js/portal/dyna.js
===================================================================
--- trunk/theme/src/bin/portal-ajax-war/js/portal/dyna.js 2007-04-03 13:34:24 UTC (rev
6910)
+++ trunk/theme/src/bin/portal-ajax-war/js/portal/dyna.js 2007-04-03 15:18:26 UTC (rev
6911)
@@ -100,9 +100,12 @@
// of a post, the parameters will be appended to the body of the query which
// will lead to a non correct request
+ // If we process a form then we will perform a blocking interaction
+ var asynchronous = !form;
+
//
var options = {
- asynchronous:true,
+ asynchronous:asynchronous,
method: method,
postBody: body,
requestHeaders:headers,
@@ -127,6 +130,9 @@
markupContainer.innerHTML = markup;
}
}
+
+ // update view state
+ view_state = resp.view_state;
}
else if (resp.type == "update_page")
{
Modified:
trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/JSONMarshaller.java
===================================================================
---
trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/JSONMarshaller.java 2007-04-03
13:34:24 UTC (rev 6910)
+++
trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/JSONMarshaller.java 2007-04-03
15:18:26 UTC (rev 6911)
@@ -54,6 +54,7 @@
//
writer.key("type").value("update_markup");
+ writer.key("view_state").value(umr.getViewState());
//
writer.key("fragments").object();
Modified:
trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/response/UpdatePageStateResponse.java
===================================================================
---
trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/response/UpdatePageStateResponse.java 2007-04-03
13:34:24 UTC (rev 6910)
+++
trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/response/UpdatePageStateResponse.java 2007-04-03
15:18:26 UTC (rev 6911)
@@ -38,11 +38,20 @@
/** . */
private Map fragments;
- public UpdatePageStateResponse()
+ /** . */
+ private String viewState;
+
+ public UpdatePageStateResponse(String viewState)
{
- fragments = new HashMap();
+ this.viewState = viewState;
+ this.fragments = new HashMap();
}
+ public String getViewState()
+ {
+ return viewState;
+ }
+
public void addFragment(String id, String fragment)
{
fragments.put(id, fragment);
Show replies by date