Author: julien_viet
Date: 2009-10-30 17:04:13 -0400 (Fri, 30 Oct 2009)
New Revision: 466
Modified:
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestHandler.java
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIPortalApplication.java
Log:
move the close() of the portal request writer in order to make it work whatever the kind
of request is
Modified:
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestHandler.java
===================================================================
---
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestHandler.java 2009-10-30
20:42:31 UTC (rev 465)
+++
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestHandler.java 2009-10-30
21:04:13 UTC (rev 466)
@@ -19,6 +19,7 @@
package org.exoplatform.portal.application;
+import org.exoplatform.commons.utils.Safe;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
import org.exoplatform.web.WebAppController;
@@ -112,6 +113,11 @@
}
finally
{
+
+ // We close the writer here once and for all
+ Safe.close(context.getWriter());
+
+ //
try
{
for (ApplicationLifecycle lifecycle : lifecycles)
Modified:
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIPortalApplication.java
===================================================================
---
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIPortalApplication.java 2009-10-30
20:42:31 UTC (rev 465)
+++
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIPortalApplication.java 2009-10-30
21:04:13 UTC (rev 466)
@@ -424,91 +424,84 @@
{
Writer w = context.getWriter();
- try
+ //
+ if (!context.useAjax())
{
- if (!context.useAjax())
+ super.processRender(context);
+ }
+ else
+ {
+ PortalRequestContext pcontext = (PortalRequestContext)context;
+
+ UIMaskWorkspace uiMaskWS = getChildById(UIPortalApplication.UI_MASK_WS_ID);
+ if (uiMaskWS.isUpdated())
+ pcontext.addUIComponentToUpdateByAjax(uiMaskWS);
+ if (getUIPopupMessages().hasMessage())
{
- super.processRender(context);
+ pcontext.addUIComponentToUpdateByAjax(getUIPopupMessages());
}
- else
- {
- PortalRequestContext pcontext = (PortalRequestContext)context;
- UIMaskWorkspace uiMaskWS = getChildById(UIPortalApplication.UI_MASK_WS_ID);
- if (uiMaskWS.isUpdated())
- pcontext.addUIComponentToUpdateByAjax(uiMaskWS);
- if (getUIPopupMessages().hasMessage())
+ Set<UIComponent> list = context.getUIComponentToUpdateByAjax();
+ List<UIPortlet> uiPortlets = new ArrayList<UIPortlet>(3);
+ List<UIComponent> uiDataComponents = new ArrayList<UIComponent>(5);
+
+ if (list != null)
+ {
+ for (UIComponent uicomponent : list)
{
- pcontext.addUIComponentToUpdateByAjax(getUIPopupMessages());
+ if (uicomponent instanceof UIPortlet)
+ uiPortlets.add((UIPortlet)uicomponent);
+ else
+ uiDataComponents.add(uicomponent);
}
+ }
+ w.write("<div class=\"PortalResponse\">");
+ w.write("<div class=\"PortalResponseData\">");
+ for (UIComponent uicomponent : uiDataComponents)
+ {
+ if (log.isDebugEnabled())
+ log.debug("AJAX call: Need to refresh the UI component " +
uicomponent.getName());
+ renderBlockToUpdate(uicomponent, context, w);
+ }
+ w.write("</div>");
- Set<UIComponent> list = context.getUIComponentToUpdateByAjax();
- List<UIPortlet> uiPortlets = new ArrayList<UIPortlet>(3);
- List<UIComponent> uiDataComponents = new
ArrayList<UIComponent>(5);
-
- if (list != null)
+ if (!context.getFullRender())
+ {
+ for (UIPortlet uiPortlet : uiPortlets)
{
- for (UIComponent uicomponent : list)
- {
- if (uicomponent instanceof UIPortlet)
- uiPortlets.add((UIPortlet)uicomponent);
- else
- uiDataComponents.add(uicomponent);
- }
- }
- w.write("<div class=\"PortalResponse\">");
- w.write("<div class=\"PortalResponseData\">");
- for (UIComponent uicomponent : uiDataComponents)
- {
if (log.isDebugEnabled())
- log.debug("AJAX call: Need to refresh the UI component " +
uicomponent.getName());
- renderBlockToUpdate(uicomponent, context, w);
- }
- w.write("</div>");
+ log.debug("AJAX call: Need to refresh the Portlet " +
uiPortlet.getId());
- if (!context.getFullRender())
- {
- for (UIPortlet uiPortlet : uiPortlets)
- {
- if (log.isDebugEnabled())
- log.debug("AJAX call: Need to refresh the Portlet " +
uiPortlet.getId());
+ w.write("<div class=\"PortletResponse\"
style=\"display: none\">");
+ w.append("<div
class=\"PortletResponsePortletId\">" + uiPortlet.getId() +
"</div>");
+ w.append("<div
class=\"PortletResponseData\">");
- w.write("<div class=\"PortletResponse\"
style=\"display: none\">");
- w.append("<div
class=\"PortletResponsePortletId\">" + uiPortlet.getId() +
"</div>");
- w.append("<div
class=\"PortletResponseData\">");
+ /*
+ * If the portlet is using our UI framework or supports it then it
+ * will return a set of block to updates. If there is not block to
+ * update the javascript client will see that as a full refresh of the
+ * content part
+ */
+ uiPortlet.processRender(context);
- /*
- * If the portlet is using our UI framework or supports it then it
- * will return a set of block to updates. If there is not block to
- * update the javascript client will see that as a full refresh of the
- * content part
- */
- uiPortlet.processRender(context);
-
- w.append("</div>");
- w.append("<div
class=\"PortletResponseScript\"></div>");
- w.write("</div>");
- }
+ w.append("</div>");
+ w.append("<div
class=\"PortletResponseScript\"></div>");
+ w.write("</div>");
}
+ }
- w.write("<div class=\"PortalResponseScript\">");
- w.write(pcontext.getJavascriptManager().getJavascript());
- w.write("eXo.core.Browser.onLoad();\n");
- w.write(pcontext.getJavascriptManager().getCustomizedOnLoadScript());
- String skin = getAddSkinScript(list);
- if (skin != null)
- {
- w.write(skin);
- }
- w.write("</div>");
- w.write("</div>");
+ w.write("<div class=\"PortalResponseScript\">");
+ w.write(pcontext.getJavascriptManager().getJavascript());
+ w.write("eXo.core.Browser.onLoad();\n");
+ w.write(pcontext.getJavascriptManager().getCustomizedOnLoadScript());
+ String skin = getAddSkinScript(list);
+ if (skin != null)
+ {
+ w.write(skin);
}
+ w.write("</div>");
+ w.write("</div>");
}
- finally
- {
- //
- w.close();
- }
}
private String getAddSkinScript(Set<UIComponent> updateComponents)