From do-not-reply at jboss.org Mon Aug 15 07:36:42 2011
Content-Type: multipart/mixed; boundary="===============8575338842092882808=="
MIME-Version: 1.0
From: do-not-reply at jboss.org
To: gatein-commits at lists.jboss.org
Subject: [gatein-commits] gatein SVN: r7126 - in portal/trunk:
portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component
and 2 other directories.
Date: Mon, 15 Aug 2011 07:36:42 -0400
Message-ID: <201108151136.p7FBagWD027239@svn01.web.mwc.hst.phx2.redhat.com>
--===============8575338842092882808==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Author: kien_nguyen
Date: 2011-08-15 07:36:41 -0400 (Mon, 15 Aug 2011)
New Revision: 7126
Removed:
portal/trunk/gadgets/core/src/main/java/org/exoplatform/portal/gadget/co=
re/ShindigClientEndpoint.java
Modified:
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationr=
egistry/webui/component/UIGadgetEditor.java
portal/trunk/web/eXoResources/src/main/webapp/javascript/eXo/portal/Port=
alHttpRequest.js
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/gadget-confi=
guration.xml
Log:
GTNPORTAL-1957: Caching issue when edit gadget in ApplicationRegistry (Reve=
rt to use javascript request)
Deleted: portal/trunk/gadgets/core/src/main/java/org/exoplatform/portal/gad=
get/core/ShindigClientEndpoint.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- portal/trunk/gadgets/core/src/main/java/org/exoplatform/portal/gadget/c=
ore/ShindigClientEndpoint.java 2011-08-15 10:39:08 UTC (rev 7125)
+++ portal/trunk/gadgets/core/src/main/java/org/exoplatform/portal/gadget/c=
ore/ShindigClientEndpoint.java 2011-08-15 11:36:41 UTC (rev 7126)
@@ -1,122 +0,0 @@
-/*
- * Copyright (C) 2011 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.portal.gadget.core;
-
-import org.exoplatform.container.xml.InitParams;
-import org.exoplatform.container.xml.ValueParam;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStreamWriter;
-import java.net.URL;
-import java.net.URLConnection;
-import java.util.Timer;
-import java.util.TimerTask;
-
-/**
- * An endpoint to send requests to Shindig from Portal.
- *
- * This endpoint is necessary as Shindig does not expose any public API to=
manipulates
- * its caches from Portal.
- *
- * @author Minh Hoang TO
- * @date 8/15/11
- */
-public class ShindigClientEndpoint
-{
-
- private final long delay;
-
- private final Timer timer;
-
- public ShindigClientEndpoint(InitParams params) throws Exception
- {
- long delayTime =3D 1000;
- if(params !=3D null)
- {
- ValueParam delayParam =3D params.getValueParam("delayTime");
- delayTime =3D Long.parseLong(delayParam.getValue());
- }
- delay =3D delayTime;
- timer =3D new Timer(true);
- }
-
- /**
- * Etablish URLConnection to shindigURL and post request data to it
- *
- * @param requestData
- * @param shindigURL
- */
- public void sendRequest(String requestData, String shindigURL)
- {
- timer.schedule(createTimerTask(requestData, shindigURL), delay);
- }
-
- private TimerTask createTimerTask(final String requestData, final Strin=
g shindigURL)
- {
- return new TimerTask()
- {
- @Override
- public void run()
- {
- OutputStreamWriter out =3D null;
- InputStream in =3D null;
-
- try
- {
- URLConnection conn =3D new URL(shindigURL).openConnection();
- conn.setDoOutput(true);
- out =3D new OutputStreamWriter(conn.getOutputStream());
- out.write(requestData);
- out.flush();
-
- in =3D conn.getInputStream(); //Don't remove this if you do=
n't understand!
- }
- catch (IOException ioEx)
- {
- ioEx.printStackTrace();
-
- }
- finally
- {
- try
- {
- if (out !=3D null)
- out.close();
- }
- catch (IOException ex)
- {
- ex.printStackTrace();
- }
-
- try
- {
- if (in !=3D null)
- in.close();
- }
- catch (IOException ex)
- {
- ex.printStackTrace();
- }
- }
-
- }
- };
- }
-
-}
Modified: portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/appli=
cationregistry/webui/component/UIGadgetEditor.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/application=
registry/webui/component/UIGadgetEditor.java 2011-08-15 10:39:08 UTC (rev 7=
125)
+++ portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/application=
registry/webui/component/UIGadgetEditor.java 2011-08-15 11:36:41 UTC (rev 7=
126)
@@ -26,9 +26,8 @@
import org.exoplatform.application.gadget.GadgetRegistryService;
import org.exoplatform.application.gadget.Source;
import org.exoplatform.application.gadget.SourceStorage;
-import org.exoplatform.commons.serialization.api.annotations.Serialized;
-import org.exoplatform.portal.gadget.core.ShindigClientEndpoint;
import org.exoplatform.portal.webui.application.GadgetUtil;
+import org.exoplatform.commons.serialization.api.annotations.Serialized;
import org.exoplatform.web.application.ApplicationMessage;
import org.exoplatform.webui.application.WebuiRequestContext;
import org.exoplatform.webui.config.InitParams;
@@ -214,14 +213,6 @@
source.setLastModified(Calendar.getInstance());
=
sourceStorage.saveSource(gadget, source);
-
- //Send request to invalidate the cache on Shindig
- String requestData =3D "{\"context\":{\"ignoreCache\":\"true\"},\=
"gadgets\":[" + "{\"url\":\"" + GadgetUtil.reproduceUrl(gadget.getUrl(), ga=
dget.isLocal()) + "\"}]}";
- String gadgetServerURL =3D GadgetUtil.getGadgetServerUrl();
- String gadgetShindigURL =3D gadgetServerURL + (gadgetServerURL.en=
dsWith("/")?"" : "/") + "metadata";
- ShindigClientEndpoint endPoint =3D uiForm.getApplicationComponent=
(ShindigClientEndpoint.class);
- endPoint.sendRequest(requestData, gadgetShindigURL);
-
uiManagement.removeChild(UIGadgetEditor.class);
// This will update the source and also update the gadget related
// cached meta data
@@ -229,6 +220,13 @@
uiManagement.initData();
uiManagement.setSelectedGadget(gadget.getName());
event.getRequestContext().addUIComponentToUpdateByAjax(uiManageme=
nt);
+ =
+ //Send request to invalidate the cache to Shindig
+ String gadgetServerUrl =3D GadgetUtil.getGadgetServerUrl();
+ String gadgetUrl =3D GadgetUtil.reproduceUrl(gadget.getUrl(), gad=
get.isLocal());
+ String metadataUrl =3D gadgetServerUrl + (gadgetServerUrl.endsWit=
h("/") ? "" : "/") + "metadata";
+ String queryString =3D "{\"context\":{\"ignoreCache\":\"true\"},\=
"gadgets\":[" + "{\"url\":\"" + gadgetUrl + "\"}]}";
+ event.getRequestContext().getJavascriptManager().addJavascript("a=
jaxAsyncRequest('" + metadataUrl + "', true, 'POST', '" + queryString + "')=
;");
}
=
}
Modified: portal/trunk/web/eXoResources/src/main/webapp/javascript/eXo/port=
al/PortalHttpRequest.js
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- portal/trunk/web/eXoResources/src/main/webapp/javascript/eXo/portal/Por=
talHttpRequest.js 2011-08-15 10:39:08 UTC (rev 7125)
+++ portal/trunk/web/eXoResources/src/main/webapp/javascript/eXo/portal/Por=
talHttpRequest.js 2011-08-15 11:36:41 UTC (rev 7126)
@@ -724,17 +724,28 @@
} ;
=
/**
+ * Create a ajax GET request
+ * @param {String} url - Url
+ * @param {boolean} async - asynchronous or none
+ * @return {String} response text if request is not async
+ */
+function ajaxAsyncGetRequest(url, async) {
+ ajaxAsyncRequest("GET", url, async);
+}
+
+/**
* Create a ajax request
+ * @param {String} method - GET, POST, etc
* @param {String} url - Url
* @param {boolean} async - asynchronous or none
* @return {String} response text if request is not async
*/
-function ajaxAsyncGetRequest(url, async) {
+function ajaxAsyncRequest(url, async, method, queryString) {
if(async =3D=3D undefined) async =3D true ;
var request =3D eXo.core.Browser.createHttpRequest() ;
- request.open('GET', url, async) ;
+ request.open(method, url, async) ;
request.setRequestHeader("Cache-Control", "max-age=3D86400") ;
- request.send(null) ;
+ request.send((queryString !=3D undefined && queryString !=3D null) ? que=
ryString : null) ;
eXo.session.itvDestroy() ;
if(eXo.session.canKeepState && eXo.session.isOpen && eXo.env.portal.acce=
ssMode =3D=3D 'private') {
eXo.session.itvInit() ;
Modified: portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/gadge=
t-configuration.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/gadget-conf=
iguration.xml 2011-08-15 10:39:08 UTC (rev 7125)
+++ portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/gadget-conf=
iguration.xml 2011-08-15 11:36:41 UTC (rev 7126)
@@ -39,10 +39,6 @@
-
-
- org.exoplatform.portal.gadget.core.ShindigClientEndpoint
-
=
org.exoplatform.commons.chromattic.ChromatticManager=
--===============8575338842092882808==--