gatein SVN: r4984 - in components/wsrp/trunk/wsrp-producer-war/src: test/producer-sar/conf and 1 other directory.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2010-11-09 06:14:17 -0500 (Tue, 09 Nov 2010)
New Revision: 4984
Modified:
components/wsrp/trunk/wsrp-producer-war/src/main/webapp/WEB-INF/conf/producer/config.xml
components/wsrp/trunk/wsrp-producer-war/src/test/producer-sar/conf/producer-config.xml
Log:
- GTNWSRP-152: updated schema declarations.
Modified: components/wsrp/trunk/wsrp-producer-war/src/main/webapp/WEB-INF/conf/producer/config.xml
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/main/webapp/WEB-INF/conf/producer/config.xml 2010-11-09 11:09:25 UTC (rev 4983)
+++ components/wsrp/trunk/wsrp-producer-war/src/main/webapp/WEB-INF/conf/producer/config.xml 2010-11-09 11:14:17 UTC (rev 4984)
@@ -9,7 +9,7 @@
~ 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
@@ -29,7 +29,7 @@
<!-- Configuration using registration with default registration property validator. -->
<producer-configuration xmlns="http://www.gatein.org/xml/ns/gatein_wsrp_producer_1_0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.gatein.org/xml/ns/gatein_wsrp_producer_1_0 http://www.jboss.org/portal/xsd/jboss-wsrp-producer_2_7.xsd">
+ xsi:schemaLocation="http://www.gatein.org/xml/ns/gatein_wsrp_producer_1_0 http://www.jboss.org/portal/xsd/gatein_wsrp_producer_1_0.xsd">
<registration-configuration fullServiceDescriptionRequiresRegistration="true">
<registration-property-validator>org.gatein.registration.policies.DefaultRegistrationPropertyValidator
</registration-property-validator>
Modified: components/wsrp/trunk/wsrp-producer-war/src/test/producer-sar/conf/producer-config.xml
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/test/producer-sar/conf/producer-config.xml 2010-11-09 11:09:25 UTC (rev 4983)
+++ components/wsrp/trunk/wsrp-producer-war/src/test/producer-sar/conf/producer-config.xml 2010-11-09 11:14:17 UTC (rev 4984)
@@ -1,9 +1,32 @@
+<!--
+ ~ JBoss, a division of Red Hat
+ ~ Copyright 2010, Red Hat Middleware, LLC, and individual
+ ~ contributors as indicated by the @authors tag. See the
+ ~ copyright.txt in the distribution for a full listing of
+ ~ individual contributors.
+ ~
+ ~ 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.
+ -->
+
<!--<producer-configuration/>-->
-<producer-configuration xmlns="urn:jboss:portal:wsrp:producer:v2_7"
+<producer-configuration xmlns="http://www.gatein.org/xml/ns/gatein_wsrp_producer_1_0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="urn:jboss:portal:wsrp:producer:v2_7 http://www.jboss.org/portal/xsd/jboss-wsrp-producer_2_7.xsd">
+ xsi:schemaLocation="http://www.gatein.org/xml/ns/gatein_wsrp_producer_1_0 http://www.jboss.org/portal/xsd/jboss-wsrp-producer_2_7.xsd">
<registration-configuration fullServiceDescriptionRequiresRegistration="true">
<registration-property-validator>org.gatein.registration.policies.DefaultRegistrationPropertyValidator
</registration-property-validator>
</registration-configuration>
-</producer-configuration>
+</producer-configuration>
\ No newline at end of file
14 years, 2 months
gatein SVN: r4983 - portal/trunk/web/eXoResources/src/main/webapp/javascript/eXo/portal.
by do-not-reply@jboss.org
Author: phuong_vu
Date: 2010-11-09 06:09:25 -0500 (Tue, 09 Nov 2010)
New Revision: 4983
Modified:
portal/trunk/web/eXoResources/src/main/webapp/javascript/eXo/portal/PortalHttpRequest.js
Log:
GTNPORTAL-1637 Javascript error when delete Gadget
Modified: portal/trunk/web/eXoResources/src/main/webapp/javascript/eXo/portal/PortalHttpRequest.js
===================================================================
--- portal/trunk/web/eXoResources/src/main/webapp/javascript/eXo/portal/PortalHttpRequest.js 2010-11-09 10:56:23 UTC (rev 4982)
+++ portal/trunk/web/eXoResources/src/main/webapp/javascript/eXo/portal/PortalHttpRequest.js 2010-11-09 11:09:25 UTC (rev 4983)
@@ -423,13 +423,15 @@
} ;
instance.updateHtmlHead = function(response) {
+ if (!response) return;
cleanHtmlHead(response);
var DOMUtil = eXo.core.DOMUtil;
var head = document.getElementsByTagName("head")[0];
- var markupHeadElements = response.markupHeadElements;
+ var markupHeadElements = response.markupHeadElements;
+ if (!markupHeadElements) return;
- if (markupHeadElements.titles.length != 0) {
+ if (markupHeadElements.titles && markupHeadElements.titles.length != 0) {
var oldTitle = DOMUtil.getChildrenByTagName(head, "title")[0];
var newTitle = markupHeadElements.titles[markupHeadElements.titles.length - 1];
if (oldTitle) {
@@ -440,7 +442,7 @@
}
appendElementsToHead(markupHeadElements.metas);
- appendElementsToHead(markupHeadElements.bases);
+ appendElementsToHead(markupHeadElements.bases);
appendElementsToHead(markupHeadElements.links);
appendElementsToHead(markupHeadElements.styles);
appendElementsToHead(markupHeadElements.scripts);
@@ -451,17 +453,19 @@
var head = document.getElementsByTagName("head")[0];
var portletResponses = response.portletResponses;
- if (portletResponses != null) {
+ if (portletResponses) {
for (var i = 0; i < portletResponses.length; i++) {
removeExtraHead(portletResponses[i].portletId);
}
}
+
+ if (response.data) {
+ var portletFragments = DOMUtil.findDescendantsByClass(response.data, "div", "PORTLET-FRAGMENT");
+ for (var i = 0; i < portletFragments.length; i++) {
+ removeExtraHead(portletFragments[i].parentNode.id);
+ }
+ }
- var portletFragments = DOMUtil.findDescendantsByClass(response.data, "div", "PORTLET-FRAGMENT");
- for (var i = 0; i < portletFragments.length; i++) {
- removeExtraHead(portletFragments[i].parentNode.id);
- }
-
var uiWorkingWorkspace = document.getElementById("UIWorkingWorkspace") ;
var portletFragsInWS = DOMUtil.findDescendantsByClass(uiWorkingWorkspace, "div", "PORTLET-FRAGMENT");
var exHeads = DOMUtil.getElementsBy(function(elem) {
@@ -497,6 +501,7 @@
}
function appendElementsToHead(elements) {
+ if (!elements) return;
var head = document.getElementsByTagName("head")[0];
for (var i = 0; i < elements.length; i++) {
14 years, 2 months
gatein SVN: r4982 - exo/portal/branches/3.1.x/packaging/pkg.
by do-not-reply@jboss.org
Author: trong.tran
Date: 2010-11-09 05:56:23 -0500 (Tue, 09 Nov 2010)
New Revision: 4982
Modified:
exo/portal/branches/3.1.x/packaging/pkg/pom.xml
Log:
Correct declaration of version number
Modified: exo/portal/branches/3.1.x/packaging/pkg/pom.xml
===================================================================
--- exo/portal/branches/3.1.x/packaging/pkg/pom.xml 2010-11-09 10:09:47 UTC (rev 4981)
+++ exo/portal/branches/3.1.x/packaging/pkg/pom.xml 2010-11-09 10:56:23 UTC (rev 4982)
@@ -84,7 +84,7 @@
<dependency>
<groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.server.jboss.patch-ear</artifactId>
- <version>3.1.5-PLF-SNAPSHOT</version>
+ <version>3.1.6-PLF-SNAPSHOT</version>
</dependency>
<!-- Missing packaging dependencies -->
14 years, 2 months
gatein SVN: r4981 - in exo/portal/branches/3.1.x: component/web/src/main/java/org/exoplatform/download and 10 other directories.
by do-not-reply@jboss.org
Author: phuong_vu
Date: 2010-11-09 05:09:47 -0500 (Tue, 09 Nov 2010)
New Revision: 4981
Removed:
exo/portal/branches/3.1.x/component/web/src/main/java/org/exoplatform/web/command/Command.java
exo/portal/branches/3.1.x/component/web/src/main/java/org/exoplatform/web/command/CommandHandler.java
exo/portal/branches/3.1.x/component/web/src/test/java/org/exoplatform/web/command/TestCommandHandler.java
exo/portal/branches/3.1.x/webui/eXo/src/main/java/org/exoplatform/web/command/handler/GetApplicationHandler.java
exo/portal/branches/3.1.x/webui/eXo/src/main/java/org/exoplatform/web/command/handler/HelloJCRHandler.java
Modified:
exo/portal/branches/3.1.x/component/web/src/main/java/conf/portal/configuration.xml
exo/portal/branches/3.1.x/component/web/src/main/java/org/exoplatform/download/DownloadService.java
exo/portal/branches/3.1.x/component/web/src/main/java/org/exoplatform/upload/UploadService.java
exo/portal/branches/3.1.x/component/web/src/main/java/org/exoplatform/upload/UploadSessionListener.java
exo/portal/branches/3.1.x/component/web/src/main/java/org/exoplatform/web/WebAppController.java
exo/portal/branches/3.1.x/component/web/src/main/java/org/exoplatform/web/WebRequestHandler.java
exo/portal/branches/3.1.x/examples/portal/war/src/main/webapp/WEB-INF/web.xml
exo/portal/branches/3.1.x/testsuite/webuibasedsamples/src/main/java/org/exoplatform/sample/webui/component/UISampleDownloadUpload.java
exo/portal/branches/3.1.x/web/eXoResources/src/main/webapp/javascript/eXo/webui/UIUpload.js
exo/portal/branches/3.1.x/web/portal/src/main/webapp/WEB-INF/web.xml
exo/portal/branches/3.1.x/webui/core/src/main/java/org/exoplatform/webui/form/UIFormUploadInput.java
exo/portal/branches/3.1.x/webui/eXo/src/main/java/org/exoplatform/web/command/handler/DownloadHandler.java
exo/portal/branches/3.1.x/webui/eXo/src/main/java/org/exoplatform/web/command/handler/UploadHandler.java
Log:
EXOGTN-3 UploadHandler/DownloadHandler improvements
Modified: exo/portal/branches/3.1.x/component/web/src/main/java/conf/portal/configuration.xml
===================================================================
--- exo/portal/branches/3.1.x/component/web/src/main/java/conf/portal/configuration.xml 2010-11-09 10:09:36 UTC (rev 4980)
+++ exo/portal/branches/3.1.x/component/web/src/main/java/conf/portal/configuration.xml 2010-11-09 10:09:47 UTC (rev 4981)
@@ -63,4 +63,30 @@
<type>org.exoplatform.web.filter.ExtensibleFilter</type>
</component>
+ <external-component-plugins>
+ <target-component>org.exoplatform.services.listener.ListenerService</target-component>
+ <component-plugin>
+ <name>org.exoplatform.web.GenericHttpListener.sessionDestroyed</name>
+ <set-method>addListener</set-method>
+ <type>org.exoplatform.upload.UploadSessionListener</type>
+ </component-plugin>
+ </external-component-plugins>
+
+ <external-component-plugins>
+ <target-component>org.exoplatform.web.WebAppController</target-component>
+ <component-plugin>
+ <name>UploadHandler</name>
+ <set-method>register</set-method>
+ <type>org.exoplatform.web.command.handler.UploadHandler</type>
+ </component-plugin>
+ </external-component-plugins>
+
+ <external-component-plugins>
+ <target-component>org.exoplatform.web.WebAppController</target-component>
+ <component-plugin>
+ <name>DownloadHandler</name>
+ <set-method>register</set-method>
+ <type>org.exoplatform.web.command.handler.DownloadHandler</type>
+ </component-plugin>
+ </external-component-plugins>
</configuration>
Modified: exo/portal/branches/3.1.x/component/web/src/main/java/org/exoplatform/download/DownloadService.java
===================================================================
--- exo/portal/branches/3.1.x/component/web/src/main/java/org/exoplatform/download/DownloadService.java 2010-11-09 10:09:36 UTC (rev 4980)
+++ exo/portal/branches/3.1.x/component/web/src/main/java/org/exoplatform/download/DownloadService.java 2010-11-09 10:09:47 UTC (rev 4981)
@@ -41,6 +41,8 @@
private PortalContainerInfo pinfo_;
+ public static final String DOWNLOAD_HANDLER_PATH = "download";
+
public DownloadService(PortalContainerInfo pinfo, InitParams params) throws Exception
{
int maxSize = Integer.parseInt(params.getValueParam("download.resource.cache.size").getValue());
@@ -82,8 +84,8 @@
public String getDownloadLink(String id)
{
- return "/" + pinfo_.getContainerName() + "/command?"
- + "type=org.exoplatform.web.command.handler.DownloadHandler&resourceId=" + id;
+ return "/" + pinfo_.getContainerName() + "/" + DOWNLOAD_HANDLER_PATH + "?"
+ + "resourceId=" + id;
}
@SuppressWarnings("serial")
@@ -97,10 +99,9 @@
maxSize_ = maxSize;
}
- @SuppressWarnings("unused")
protected boolean removeEldestEntry(Map.Entry<String, DownloadResource> eldest)
{
return size() > maxSize_;
}
}
-}
\ No newline at end of file
+}
Modified: exo/portal/branches/3.1.x/component/web/src/main/java/org/exoplatform/upload/UploadService.java
===================================================================
--- exo/portal/branches/3.1.x/component/web/src/main/java/org/exoplatform/upload/UploadService.java 2010-11-09 10:09:36 UTC (rev 4980)
+++ exo/portal/branches/3.1.x/component/web/src/main/java/org/exoplatform/upload/UploadService.java 2010-11-09 10:09:47 UTC (rev 4981)
@@ -19,29 +19,29 @@
package org.exoplatform.upload;
+import org.apache.commons.fileupload.FileItem;
+import org.apache.commons.fileupload.FileUploadException;
+import org.apache.commons.fileupload.ProgressListener;
+import org.apache.commons.fileupload.disk.DiskFileItem;
+import org.apache.commons.fileupload.disk.DiskFileItemFactory;
+import org.apache.commons.fileupload.servlet.ServletFileUpload;
import org.exoplatform.container.xml.InitParams;
import org.exoplatform.container.xml.PortalContainerInfo;
import org.gatein.common.logging.Logger;
import org.gatein.common.logging.LoggerFactory;
import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
+import java.util.HashSet;
import java.util.LinkedHashMap;
+import java.util.List;
import java.util.Map;
+import java.util.Set;
import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
-/**
- * Created by The eXo Platform SARL
- * Author : Tuan Nguyen
- * tuan.nguyen(a)exoplatform.com
- * Dec 8, 2006
- */
public class UploadService
{
-
/** . */
private static final Logger log = LoggerFactory.getLogger(UploadService.class);
@@ -53,6 +53,8 @@
private Map<String, Integer> uploadLimitsMB_ = new LinkedHashMap<String, Integer>();
+ public static String UPLOAD_RESOURCES_STACK = "uploadResourcesStack";
+
public UploadService(PortalContainerInfo pinfo, InitParams params) throws Exception
{
String tmpDir = System.getProperty("java.io.tmpdir");
@@ -66,127 +68,142 @@
uploadDir.mkdirs();
}
- public void createUploadResource(HttpServletRequest request) throws IOException
+ /**
+ * Create UploadResource for HttpServletRequest
+ *
+ * @param requestow
+ * the webapp's {@link javax.servlet.http.HttpServletRequest}
+ * @throws FileUploadException
+ */
+ @SuppressWarnings("unchecked")
+ public void createUploadResource(HttpServletRequest request) throws FileUploadException
{
String uploadId = request.getParameter("uploadId");
- // by default, use the limit set in the service
- //int limitMB = defaultUploadLimitMB_;
- // if the limit is set in the request (specific for this upload) then use this value instead of the default one
- //if (uploadLimitsMB_.containsKey(uploadId)) limitMB = uploadLimitsMB_.get(uploadId).intValue() ;
- int limitMB = uploadLimitsMB_.get(uploadId).intValue();
+ UploadResource upResource = new UploadResource(uploadId);
+ upResource.setFileName("");// Avoid NPE in UploadHandler
+ uploadResources.put(upResource.getUploadId(), upResource);
+
+ putToStackInSession(request.getSession(true), uploadId);
- UploadResource upResource = new UploadResource(uploadId);
- RequestStreamReader reader = new RequestStreamReader(upResource);
- int estimatedSizeMB = (request.getContentLength() / 1024) / 1024;
- if (limitMB > 0 && estimatedSizeMB > limitMB)
- { // a limit set to 0 means unlimited
+ double contentLength = request.getContentLength();
+ upResource.setEstimatedSize(contentLength);
+ if (isLimited(upResource, contentLength))
+ {
upResource.setStatus(UploadResource.FAILED_STATUS);
- //upResource.setLimitMB(limitMB);
- uploadResources.put(uploadId, upResource);
- log.debug("Upload cancelled because file bigger than size limit : " + estimatedSizeMB + " MB > "
- + limitMB + " MB");
- // WebuiRequestContext ctx = WebuiRequestContext.getCurrentInstance();
- // UIApplication uiApp = ctx.getUIApplication();
- // uiApp.addMessage(new ApplicationMessage("The file must be < "+limitMB+" MB.", null, ApplicationMessage.WARNING));
return;
}
- // TODO : display error message, terminate upload correctly
- String headerEncoding = request.getCharacterEncoding();
- Map<String, String> headers = reader.parseHeaders(request.getInputStream(), headerEncoding);
-
- String fileName = reader.getFileName(headers);
- if (fileName == null)
- fileName = uploadId;
- fileName = fileName.substring(fileName.lastIndexOf('\\') + 1);
-
- upResource.setFileName(fileName);
- upResource.setMimeType(headers.get(RequestStreamReader.CONTENT_TYPE));
- upResource.setStoreLocation(uploadLocation_ + "/" + uploadId + "." + fileName);
- upResource.setEstimatedSize(request.getContentLength());
-
- uploadResources.put(upResource.getUploadId(), upResource);
-
- File fileStore = new File(upResource.getStoreLocation());
- if (!fileStore.exists())
- fileStore.createNewFile();
- FileOutputStream output = new FileOutputStream(fileStore);
- reader.readBodyData(request, output);
-
- if (upResource.getStatus() == UploadResource.UPLOADING_STATUS)
+ ServletFileUpload servletFileUpload = makeServletFileUpload(upResource);
+ // parse request
+ List<FileItem> itemList = servletFileUpload.parseRequest(request);
+ if (itemList == null || itemList.size() != 1 || itemList.get(0).isFormField())
{
- upResource.setStatus(UploadResource.UPLOADED_STATUS);
+ log.debug("Please upload 1 file per request");
return;
}
- uploadResources.remove(uploadId);
- fileStore.delete();
- }
+ DiskFileItem fileItem = (DiskFileItem)itemList.get(0);
+ String fileName = fileItem.getName();
+ String storeLocation = uploadLocation_ + "/" + uploadId + "." + fileName;
- public void createUploadResource(String uploadId, String encoding, String contentType, double contentLength,
- InputStream inputStream) throws Exception
- {
- UploadResource upResource = new UploadResource(uploadId);
- RequestStreamReader reader = new RequestStreamReader(upResource);
- int limitMB = uploadLimitsMB_.get(uploadId).intValue();
- int estimatedSizeMB = (int)contentLength / 1024 / 1024;
- if (limitMB > 0 && estimatedSizeMB > limitMB)
- { // a limit set to 0 means unlimited
- upResource.setStatus(UploadResource.FAILED_STATUS);
- uploadResources.put(uploadId, upResource);
- log.debug("Upload cancelled because file bigger than size limit : " + estimatedSizeMB + " MB > "
- + limitMB + " MB");
- return;
- }
- Map<String, String> headers = reader.parseHeaders(inputStream, encoding);
+ // commons-fileupload will store the temp file with name *.tmp
+ // we need to rename it to our desired name
+ fileItem.getStoreLocation().renameTo(new File(storeLocation));
- String fileName = reader.getFileName(headers);
- if (fileName == null)
- fileName = uploadId;
- fileName = fileName.substring(fileName.lastIndexOf('\\') + 1);
-
upResource.setFileName(fileName);
- upResource.setMimeType(headers.get(RequestStreamReader.CONTENT_TYPE));
- upResource.setStoreLocation(uploadLocation_ + "/" + uploadId + "." + fileName);
- upResource.setEstimatedSize(contentLength);
- uploadResources.put(upResource.getUploadId(), upResource);
- File fileStore = new File(upResource.getStoreLocation());
- if (!fileStore.exists())
- fileStore.createNewFile();
- FileOutputStream output = new FileOutputStream(fileStore);
- reader.readBodyData(inputStream, contentType, output);
+ upResource.setMimeType(fileItem.getContentType());
+ upResource.setStoreLocation(storeLocation);
+ upResource.setStatus(UploadResource.UPLOADED_STATUS);
+ }
- if (upResource.getStatus() == UploadResource.UPLOADING_STATUS)
+ @SuppressWarnings("unchecked")
+ private void putToStackInSession(HttpSession session, String uploadId)
+ {
+ Set<String> uploadResouceIds = (Set<String>)session.getAttribute(UploadService.UPLOAD_RESOURCES_STACK);
+ if (uploadResouceIds == null)
{
- upResource.setStatus(UploadResource.UPLOADED_STATUS);
- return;
+ uploadResouceIds = new HashSet();
}
-
- uploadResources.remove(uploadId);
- fileStore.delete();
+ uploadResouceIds.add(uploadId);
+ session.setAttribute(UploadService.UPLOAD_RESOURCES_STACK, uploadResouceIds);
}
+ /**
+ * Get UploadResource by uploadId
+ *
+ * @param uploadId
+ * uploadId of UploadResource
+ * @return org.exoplatform.upload.UploadResource of uploadId
+ */
public UploadResource getUploadResource(String uploadId)
- {//throws Exception
- UploadResource upResource = uploadResources.get(uploadId);
- return upResource;
+ {
+ return uploadResources.get(uploadId);
}
+ /**
+ * Clean up temporary files that are uploaded in the Session but not removed yet
+ *
+ * @param session
+ */
+ @SuppressWarnings("unchecked")
+ public void cleanUp(HttpSession session)
+ {
+ log.debug("Cleaning up uploaded files for temporariness");
+ Set<String> uploadIds = (Set<String>)session.getAttribute(UploadService.UPLOAD_RESOURCES_STACK);
+ if (uploadIds != null)
+ {
+ for (String id : uploadIds)
+ {
+ removeUploadResource(id);
+ uploadLimitsMB_.remove(id);
+ }
+ }
+ }
+
+ /**
+ * @deprecated use {@link #removeUploadResource(String)} instead
+ *
+ * @param uploadId
+ */
+ @Deprecated
public void removeUpload(String uploadId)
{
+ removeUploadResource(uploadId);
+ }
+
+ /**
+ * Remove the UploadResource and its temporary file that associated with given <code>uploadId</code>.
+ * <br/>If <code>uploadId</code> is null or UploadResource is null, do nothing
+ *
+ * @param uploadId uploadId of UploadResource will be removed
+ */
+ public void removeUploadResource(String uploadId)
+ {
if (uploadId == null)
return;
UploadResource upResource = uploadResources.get(uploadId);
- if (upResource == null)
- return;
- if (upResource.getStoreLocation() == null)
- return;
- File file = new File(upResource.getStoreLocation());
- file.delete();
- uploadResources.remove(uploadId);
- //uploadLimitsMB_.remove(uploadId);
+ if (upResource != null)
+ {
+ uploadResources.remove(uploadId);
+
+ if (upResource.getStoreLocation() != null)
+ {
+ File file = new File(upResource.getStoreLocation());
+ file.delete();
+ }
+ }
+
+ // uploadLimitsMB_.remove(uploadId);
}
+ /**
+ * Registry upload limit size for uploadLimitsMB_. If limitMB is null,
+ * defaultUploadLimitMB_ will be registried
+ *
+ * @param uploadId
+ * @param limitMB
+ * upload limit size
+ */
public void addUploadLimit(String uploadId, Integer limitMB)
{
if (limitMB == null)
@@ -195,8 +212,61 @@
uploadLimitsMB_.put(uploadId, limitMB);
}
+ /**
+ * Get all upload limit sizes
+ *
+ * @return all upload limit sizes
+ */
public Map<String, Integer> getUploadLimitsMB()
{
return uploadLimitsMB_;
}
+
+ private ServletFileUpload makeServletFileUpload(final UploadResource upResource)
+ {
+ // Create a factory for disk-based file items
+ DiskFileItemFactory factory = new DiskFileItemFactory();
+
+ // Set factory constraints
+ factory.setSizeThreshold(0);
+ factory.setRepository(new File(uploadLocation_));
+
+ // Create a new file upload handler
+ ServletFileUpload upload = new ServletFileUpload(factory);
+ ProgressListener listener = new ProgressListener()
+ {
+ public void update(long pBytesRead, long pContentLength, int pItems)
+ {
+ if (pBytesRead == upResource.getUploadedSize())
+ return;
+ upResource.addUploadedBytes(pBytesRead - upResource.getUploadedSize());
+ }
+ };
+ upload.setProgressListener(listener);
+ return upload;
+ }
+
+ private boolean isLimited(UploadResource upResource, double contentLength)
+ {
+ // by default, use the limit set in the service
+ int limitMB = defaultUploadLimitMB_;
+ // if the limit is set in the request (specific for this upload) then use
+ // this value instead of the default one
+ if (uploadLimitsMB_.containsKey(upResource.getUploadId()))
+ {
+ limitMB = uploadLimitsMB_.get(upResource.getUploadId()).intValue();
+ }
+
+ int estimatedSizeMB = (int)((contentLength / 1024) / 1024);
+ if (limitMB > 0 && estimatedSizeMB > limitMB)
+ { // a limit set to 0 means unlimited
+ if (log.isDebugEnabled())
+ {
+ log.debug("Upload cancelled because file bigger than size limit : " + estimatedSizeMB + " MB > " + limitMB
+ + " MB");
+ }
+ return true;
+ }
+ return false;
+ }
}
\ No newline at end of file
Modified: exo/portal/branches/3.1.x/component/web/src/main/java/org/exoplatform/upload/UploadSessionListener.java
===================================================================
--- exo/portal/branches/3.1.x/component/web/src/main/java/org/exoplatform/upload/UploadSessionListener.java 2010-11-09 10:09:36 UTC (rev 4980)
+++ exo/portal/branches/3.1.x/component/web/src/main/java/org/exoplatform/upload/UploadSessionListener.java 2010-11-09 10:09:47 UTC (rev 4981)
@@ -0,0 +1,30 @@
+package org.exoplatform.upload;
+
+import javax.servlet.http.HttpSession;
+import javax.servlet.http.HttpSessionEvent;
+
+import org.exoplatform.container.PortalContainer;
+import org.exoplatform.services.listener.Event;
+import org.exoplatform.services.listener.Listener;
+
+/**
+ * This listener for the purpose of cleaning up temporary files that are uploaded to the server
+ * but not removed by specific actions from user
+ *
+ * The listener is triggered when a session is destroyed
+ *
+ * @author <a href="mailto:trongtt@gmail.com">Tran The Trong</a>
+ * @version $Revision$
+ */
+public class UploadSessionListener extends Listener<PortalContainer, HttpSessionEvent>
+{
+ @Override
+ public void onEvent(Event<PortalContainer, HttpSessionEvent> event) throws Exception
+ {
+ PortalContainer container = event.getSource();
+ HttpSession session = event.getData().getSession();
+
+ UploadService uploadService = (UploadService)container.getComponentInstanceOfType(UploadService.class);
+ uploadService.cleanUp(session);
+ }
+}
\ No newline at end of file
Modified: exo/portal/branches/3.1.x/component/web/src/main/java/org/exoplatform/web/WebAppController.java
===================================================================
--- exo/portal/branches/3.1.x/component/web/src/main/java/org/exoplatform/web/WebAppController.java 2010-11-09 10:09:36 UTC (rev 4980)
+++ exo/portal/branches/3.1.x/component/web/src/main/java/org/exoplatform/web/WebAppController.java 2010-11-09 10:09:47 UTC (rev 4981)
@@ -19,15 +19,6 @@
package org.exoplatform.web;
-import org.exoplatform.container.ExoContainer;
-import org.exoplatform.container.ExoContainerContext;
-import org.exoplatform.container.component.ComponentRequestLifecycle;
-import org.exoplatform.container.component.RequestLifeCycle;
-import org.exoplatform.services.log.ExoLogger;
-import org.exoplatform.services.log.Log;
-import org.exoplatform.web.application.Application;
-import org.exoplatform.web.command.CommandHandler;
-
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -35,6 +26,13 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import org.exoplatform.container.ExoContainer;
+import org.exoplatform.container.ExoContainerContext;
+import org.exoplatform.container.component.RequestLifeCycle;
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
+import org.exoplatform.web.application.Application;
+
/**
* Created by The eXo Platform SAS
* Mar 21, 2007
@@ -67,10 +65,8 @@
applications_ = new HashMap<String, Application>();
attributes_ = new HashMap<String, Object>();
handlers_ = new HashMap<String, WebRequestHandler>();
- register(new CommandHandler());
}
- @SuppressWarnings("unused")
public Object getAttribute(String name, Object value)
{
return attributes_.get(name);
@@ -148,4 +144,4 @@
}
}
}
-}
\ No newline at end of file
+}
Modified: exo/portal/branches/3.1.x/component/web/src/main/java/org/exoplatform/web/WebRequestHandler.java
===================================================================
--- exo/portal/branches/3.1.x/component/web/src/main/java/org/exoplatform/web/WebRequestHandler.java 2010-11-09 10:09:36 UTC (rev 4980)
+++ exo/portal/branches/3.1.x/component/web/src/main/java/org/exoplatform/web/WebRequestHandler.java 2010-11-09 10:09:47 UTC (rev 4981)
@@ -22,6 +22,8 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import org.exoplatform.container.component.BaseComponentPlugin;
+
/**
* Created by The eXo Platform SAS
* Mar 21, 2007
@@ -31,9 +33,9 @@
* In case of portal the path is /portal but you could return your own from the getPath() method and hence the
* WebAppController would use your own handler
*
- * The execute method is to be overideen and the buisness logic should be handled here
+ * The execute method is to be overridden and the buisness logic should be handled here
*/
-abstract public class WebRequestHandler
+abstract public class WebRequestHandler extends BaseComponentPlugin
{
public void onInit(WebAppController controller) throws Exception
@@ -50,4 +52,4 @@
}
-}
\ No newline at end of file
+}
Deleted: exo/portal/branches/3.1.x/component/web/src/main/java/org/exoplatform/web/command/Command.java
===================================================================
--- exo/portal/branches/3.1.x/component/web/src/main/java/org/exoplatform/web/command/Command.java 2010-11-09 10:09:36 UTC (rev 4980)
+++ exo/portal/branches/3.1.x/component/web/src/main/java/org/exoplatform/web/command/Command.java 2010-11-09 10:09:47 UTC (rev 4981)
@@ -1,43 +0,0 @@
-/**
- * Copyright (C) 2009 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.web.command;
-
-import org.exoplatform.web.WebAppController;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-/**
- * Created by The eXo Platform SARL
- * Author : Tuan Nguyen
- * tuan.nguyen(a)exoplatform.com
- * May 22, 2007
- */
-abstract public class Command
-{
-
- public String[] getRequiredMemberships()
- {
- return null;
- }
-
- abstract public void execute(WebAppController controller, HttpServletRequest req, HttpServletResponse res)
- throws Exception;
-}
\ No newline at end of file
Deleted: exo/portal/branches/3.1.x/component/web/src/main/java/org/exoplatform/web/command/CommandHandler.java
===================================================================
--- exo/portal/branches/3.1.x/component/web/src/main/java/org/exoplatform/web/command/CommandHandler.java 2010-11-09 10:09:36 UTC (rev 4980)
+++ exo/portal/branches/3.1.x/component/web/src/main/java/org/exoplatform/web/command/CommandHandler.java 2010-11-09 10:09:47 UTC (rev 4981)
@@ -1,196 +0,0 @@
-/**
- * Copyright (C) 2009 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.web.command;
-
-import org.exoplatform.web.WebAppController;
-import org.exoplatform.web.WebRequestHandler;
-
-import java.lang.reflect.Array;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.rmi.activation.UnknownObjectException;
-import java.util.Iterator;
-import java.util.Map;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-/**
- * Created by The eXo Platform SAS
- * Mar 21, 2007
- */
-public class CommandHandler extends WebRequestHandler
-{
-
- public String[] getPath()
- {
- return new String[]{"/command"};
- }
-
- public void execute(WebAppController controller, HttpServletRequest req, HttpServletResponse res) throws Exception
- {
- Map props = req.getParameterMap();
- String type = req.getParameter("type");
- if (!("org.exoplatform.web.command.handler.UploadHandler".equals(type) ||
- "org.exoplatform.web.command.handler.DownloadHandler".equals(type)))
- throw new IllegalArgumentException("Unknown type command handler");
- Command command = createCommand(type, props);
- if (command == null)
- throw new UnknownObjectException("Unknown command handler with type is " + type);
- command.execute(controller, req, res);
- }
-
- /**
- * This method should use the java reflection to create the command object according to the command
- * type, then populate the command properties
- *
- * @param type The command class type
- * @param props list of the properties that should be set in the command object
- * @return The command object instance
- * @throws Exception
- */
- @SuppressWarnings("unchecked")
- public Command createCommand(String type, Map props) throws Exception
- {
- ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
- Class<?> clazz = classLoader.loadClass(type);
- Object object = clazz.newInstance();
- Iterator<Object> iter = props.keySet().iterator();
- while (iter.hasNext())
- {
- Object key = iter.next();
- Field field = getField(clazz, key.toString());
- if (field == null)
- continue;
- setValue(object, field, props.get(key));
- }
- return (Command)object;
- }
-
- private final void setValue(Object bean, Field field, Object value) throws Exception
- {
- Class type = field.getType();
- if (type.isArray() && !value.getClass().isArray())
- {
- value = toValues(type, new Object[]{value});
- }
- else if (type.isArray() && value.getClass().isArray())
- {
- value = toValues(type, value);
- }
- else
- {
- if (!type.isArray() && value.getClass().isArray())
- value = Array.get(value, 0);
- value = toValue(type, value);
- }
- Class clazz = bean.getClass();
- Method method = getMethod("set", field, clazz);
- if (method != null)
- {
- method.invoke(bean, new Object[]{value});
- return;
- }
- field.setAccessible(true);
- field.set(bean, value);
- }
-
- private final Method getMethod(String prefix, Field field, Class clazz) throws Exception
- {
- StringBuilder name = new StringBuilder(field.getName());
- name.setCharAt(0, Character.toUpperCase(name.charAt(0)));
- name.insert(0, prefix);
- return getMethodByName(name.toString(), field, clazz);
- }
-
- private final Method getMethodByName(String name, Field field, Class clazz)
- {
- try
- {
- Method method = clazz.getDeclaredMethod(name.toString(), new Class[]{field.getType()});
- if (method != null)
- return method;
- if (clazz == Object.class)
- return null;
- method = getMethodByName(name, field, clazz.getSuperclass());
- if (method != null)
- return method;
- }
- catch (Exception e)
- {
- }
- return null;
- }
-
- private Field getField(Class clazz, String name)
- {
- Field field = null;
- try
- {
- field = clazz.getDeclaredField(name);
- }
- catch (Exception e)
- {
- }
- if (field != null)
- return field;
- if (clazz == Object.class)
- return null;
- return getField(clazz.getSuperclass(), name);
- }
-
- private Object toValues(Class<?> clazz, Object objects)
- {
- Class componentType = clazz.getComponentType();
- Object newValues = Array.newInstance(componentType, Array.getLength(objects));
- for (int i = 0; i < Array.getLength(objects); i++)
- {
- Array.set(newValues, i, toValue(componentType, Array.get(objects, i)));
- }
- return clazz.cast(newValues);
- }
-
- private Object toValue(Class<?> clazz, Object object)
- {
- if (clazz == int.class)
- return new Integer(object.toString()).intValue();
- if (clazz == short.class)
- return new Short(object.toString()).shortValue();
- if (clazz == float.class)
- return new Float(object.toString()).floatValue();
- if (clazz == double.class)
- return new Double(object.toString()).doubleValue();
- if (clazz == boolean.class)
- return new Boolean(object.toString()).booleanValue();
- if (clazz == char.class)
- return object.toString().trim().charAt(0);
- try
- {
- Constructor<?> constructor = clazz.getConstructor(new Class[]{String.class});
- return constructor.newInstance(new Object[]{object.toString()});
- }
- catch (Exception e)
- {
- }
- return object.toString();
- }
-
-}
\ No newline at end of file
Deleted: exo/portal/branches/3.1.x/component/web/src/test/java/org/exoplatform/web/command/TestCommandHandler.java
===================================================================
--- exo/portal/branches/3.1.x/component/web/src/test/java/org/exoplatform/web/command/TestCommandHandler.java 2010-11-09 10:09:36 UTC (rev 4980)
+++ exo/portal/branches/3.1.x/component/web/src/test/java/org/exoplatform/web/command/TestCommandHandler.java 2010-11-09 10:09:47 UTC (rev 4981)
@@ -1,98 +0,0 @@
-/**
- * Copyright (C) 2009 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.web.command;
-
-import org.exoplatform.component.test.AbstractGateInTest;
-import org.exoplatform.web.WebAppController;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-/**
- * Created by The eXo Platform SARL
- * Author : Nhu Dinh Thuan
- * nhudinhthuan(a)exoplatform.com
- * Mar 26, 2007
- */
-public class TestCommandHandler extends AbstractGateInTest
-{
-
- public TestCommandHandler(String name)
- {
- super(name);
- }
-
- public void testCommandHandler() throws Exception
- {
- CommandHandler handler = new CommandHandler();
- Map<String, Object> props = new HashMap<String, Object>();
- props.put("intProp", "10");
- props.put("stringProp", "welcome to eXo");
- props.put("doubleValues", new String[]{"10.0", "-6.7", "7.0"});
- props.put("booleanValue", "true");
- Command command = handler.createCommand("org.exoplatform.web.command.TestCommandHandler$CommandTest2", props);
- command.execute(null, null, null);
- }
-
- static public class CommandTest2 extends CommandTest
- {
-
- private boolean booleanValue = false;
-
- public void execute(WebAppController controller, HttpServletRequest req, HttpServletResponse res)
- throws Exception
- {
- super.execute(controller, req, res);
- System.out.println(" \n\n\n === >" + booleanValue + "\n\n");
- }
- }
-
- static public class CommandTest extends Command
- {
-
- private double[] doubleValues;
-
- private Integer intProp;
-
- private String stringProp;
-
- public void execute(WebAppController controller, HttpServletRequest req, HttpServletResponse res)
- throws Exception
- {
- System.out.println("\n\n");
- System.out.println("int prop : " + intProp);
- System.out.println("String prop : " + stringProp);
- for (double ele : doubleValues)
- {
- System.out.println("===== > " + ele);
- }
- System.out.println("\n\n");
- }
-
- public void setStringProp(String value)
- {
- System.out.println("\n\n invoke setter " + value + "\n\n");
- stringProp = value;
- }
- }
-}
Modified: exo/portal/branches/3.1.x/examples/portal/war/src/main/webapp/WEB-INF/web.xml
===================================================================
--- exo/portal/branches/3.1.x/examples/portal/war/src/main/webapp/WEB-INF/web.xml 2010-11-09 10:09:36 UTC (rev 4980)
+++ exo/portal/branches/3.1.x/examples/portal/war/src/main/webapp/WEB-INF/web.xml 2010-11-09 10:09:47 UTC (rev 4981)
@@ -228,10 +228,14 @@
<url-pattern>/service</url-pattern>
</servlet-mapping>
<servlet-mapping>
- <servlet-name>portal</servlet-name>
- <url-pattern>/command/*</url-pattern>
+ <servlet-name>portal</servlet-name>
+ <url-pattern>/upload/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
+ <servlet-name>portal</servlet-name>
+ <url-pattern>/download/*</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
<servlet-name>RestServer</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
Modified: exo/portal/branches/3.1.x/testsuite/webuibasedsamples/src/main/java/org/exoplatform/sample/webui/component/UISampleDownloadUpload.java
===================================================================
--- exo/portal/branches/3.1.x/testsuite/webuibasedsamples/src/main/java/org/exoplatform/sample/webui/component/UISampleDownloadUpload.java 2010-11-09 10:09:36 UTC (rev 4980)
+++ exo/portal/branches/3.1.x/testsuite/webuibasedsamples/src/main/java/org/exoplatform/sample/webui/component/UISampleDownloadUpload.java 2010-11-09 10:09:47 UTC (rev 4981)
@@ -30,8 +30,8 @@
public UISampleDownloadUpload() throws Exception
{
addUIFormInput(new UIFormUploadInput("name0", "value0"));
- addUIFormInput(new UIFormUploadInput("name1", "value1"));
- addUIFormInput(new UIFormUploadInput("name2", "value2"));
+ addUIFormInput(new UIFormUploadInput("name1", "value1", 100));
+ addUIFormInput(new UIFormUploadInput("name2", "value2", 200));
}
public void setDownloadLink(String[] downloadLink)
Modified: exo/portal/branches/3.1.x/web/eXoResources/src/main/webapp/javascript/eXo/webui/UIUpload.js
===================================================================
--- exo/portal/branches/3.1.x/web/eXoResources/src/main/webapp/javascript/eXo/webui/UIUpload.js 2010-11-09 10:09:36 UTC (rev 4980)
+++ exo/portal/branches/3.1.x/web/eXoResources/src/main/webapp/javascript/eXo/webui/UIUpload.js 2010-11-09 10:09:47 UTC (rev 4981)
@@ -28,8 +28,8 @@
* @param {boolean} isAutoUpload auto upload or none
*/
UIUpload.prototype.initUploadEntry = function(uploadId, isAutoUpload) {
- var url = eXo.env.server.context + "/command?" ;
- url += "type=org.exoplatform.web.command.handler.UploadHandler&action=progress&uploadId="+uploadId ;
+ var url = eXo.env.server.context + "/upload?" ;
+ url += "action=progress&uploadId="+uploadId ;
var responseText = ajaxAsyncGetRequest(url, false);
var response;
@@ -51,9 +51,8 @@
UIUpload.prototype.createUploadEntry = function(uploadId, isAutoUpload) {
var iframe = document.getElementById(uploadId+'uploadFrame');
var idoc = iframe.contentWindow.document ;
- var uploadAction = eXo.env.server.context + "/command?" ;
- uploadAction += "type=org.exoplatform.web.command.handler.UploadHandler";
- uploadAction += "&uploadId=" + uploadId+"&action=upload" ;
+ var uploadAction = eXo.env.server.context + "/upload?" ;
+ uploadAction += "uploadId=" + uploadId+"&action=upload" ;
var uploadHTML = "";
uploadHTML += "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>";
@@ -97,8 +96,8 @@
UIUpload.prototype.refeshProgress = function(elementId) {
var list = eXo.webui.UIUpload.listUpload;
if(list.length < 1) return;
- var url = eXo.env.server.context + "/command?" ;
- url += "type=org.exoplatform.web.command.handler.UploadHandler&action=progress" ;
+ var url = eXo.env.server.context + "/upload?" ;
+ url += "action=progress" ;
// var url = eXo.env.server.context + "/upload?action=progress";
for(var i = 0; i < list.length; i++){
url = url + "&uploadId=" + list[i];
@@ -177,8 +176,8 @@
*/
UIUpload.prototype.abortUpload = function(id) {
eXo.webui.UIUpload.listUpload.remove(id);
- var url = eXo.env.server.context + "/command?" ;
- url += "type=org.exoplatform.web.command.handler.UploadHandler&uploadId=" +id+"&action=abort" ;
+ var url = eXo.env.server.context + "/upload?" ;
+ url += "uploadId=" +id+"&action=abort" ;
// var url = eXo.env.server.context + "/upload?uploadId=" +id+"&action=abort" ;
var request = eXo.core.Browser.createHttpRequest();
request.open('GET', url, false);
@@ -209,8 +208,8 @@
* @param {String} id upload identifier
*/
UIUpload.prototype.deleteUpload = function(id) {
- var url = eXo.env.server.context + "/command?";
- url += "type=org.exoplatform.web.command.handler.UploadHandler&uploadId=" +id+"&action=delete" ;
+ var url = eXo.env.server.context + "/upload?";
+ url += "uploadId=" +id+"&action=delete" ;
// var url = eXo.env.server.context + "/upload?uploadId=" +id+"&action=delete" ;
var request = eXo.core.Browser.createHttpRequest();
request.open('GET', url, false);
Modified: exo/portal/branches/3.1.x/web/portal/src/main/webapp/WEB-INF/web.xml
===================================================================
--- exo/portal/branches/3.1.x/web/portal/src/main/webapp/WEB-INF/web.xml 2010-11-09 10:09:36 UTC (rev 4980)
+++ exo/portal/branches/3.1.x/web/portal/src/main/webapp/WEB-INF/web.xml 2010-11-09 10:09:47 UTC (rev 4981)
@@ -280,8 +280,12 @@
</servlet-mapping>
<servlet-mapping>
<servlet-name>portal</servlet-name>
- <url-pattern>/command/*</url-pattern>
+ <url-pattern>/upload/*</url-pattern>
</servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>portal</servlet-name>
+ <url-pattern>/download/*</url-pattern>
+ </servlet-mapping>
<servlet-mapping>
<servlet-name>RestServer</servlet-name>
<url-pattern>/rest/*</url-pattern>
Modified: exo/portal/branches/3.1.x/webui/core/src/main/java/org/exoplatform/webui/form/UIFormUploadInput.java
===================================================================
--- exo/portal/branches/3.1.x/webui/core/src/main/java/org/exoplatform/webui/form/UIFormUploadInput.java 2010-11-09 10:09:36 UTC (rev 4980)
+++ exo/portal/branches/3.1.x/webui/core/src/main/java/org/exoplatform/webui/form/UIFormUploadInput.java 2010-11-09 10:09:47 UTC (rev 4981)
@@ -54,11 +54,6 @@
*/
private boolean isAutoUpload = false;
- /**
- * The maximum size of the file to upload, in MB
- */
- //private int limitMB_;
-
public UIFormUploadInput(String name, String bindingExpression)
{
super(name, bindingExpression, String.class);
@@ -127,9 +122,8 @@
WebuiRequestContext pcontext = (WebuiRequestContext)context.getParentAppRequestContext();
if (pcontext == null)
pcontext = context;
- String uploadAction = pcontext.getRequestContextPath() + "/command?";
- uploadAction += "type=org.exoplatform.web.command.handler.UploadHandler";
- uploadAction += "&uploadId=" + uploadId_ + "&action=upload";
+ String uploadAction = pcontext.getRequestContextPath() + "/upload?";
+ uploadAction += "uploadId=" + uploadId_ + "&action=upload";
return uploadAction;
}
@@ -148,8 +142,4 @@
this.isAutoUpload = isAutoUpload;
}
- // public void setLimit(int size) { limitMB_ = size; }
- //
- // public int getLimit() { return limitMB_; }
-
}
\ No newline at end of file
Modified: exo/portal/branches/3.1.x/webui/eXo/src/main/java/org/exoplatform/web/command/handler/DownloadHandler.java
===================================================================
--- exo/portal/branches/3.1.x/webui/eXo/src/main/java/org/exoplatform/web/command/handler/DownloadHandler.java 2010-11-09 10:09:36 UTC (rev 4980)
+++ exo/portal/branches/3.1.x/webui/eXo/src/main/java/org/exoplatform/web/command/handler/DownloadHandler.java 2010-11-09 10:09:47 UTC (rev 4981)
@@ -24,7 +24,7 @@
import org.exoplatform.download.DownloadResource;
import org.exoplatform.download.DownloadService;
import org.exoplatform.web.WebAppController;
-import org.exoplatform.web.command.Command;
+import org.exoplatform.web.WebRequestHandler;
import java.io.InputStream;
import java.io.OutputStream;
@@ -39,14 +39,18 @@
* thuy.le(a)exoplatform.com
* Dec 9, 2006
*/
-public class DownloadHandler extends Command
+public class DownloadHandler extends WebRequestHandler
{
- private String resourceId;
+ @Override
+ public String[] getPath()
+ {
+ return new String[]{"/download"};
+ }
- @SuppressWarnings("unused")
public void execute(WebAppController controller, HttpServletRequest req, HttpServletResponse res) throws Exception
{
+ String resourceId = req.getParameter("resourceId");
res.setHeader("Cache-Control", "private max-age=600, s-maxage=120");
ExoContainer container = ExoContainerContext.getCurrentContainer();
DownloadService dservice = (DownloadService)container.getComponentInstanceOfType(DownloadService.class);
@@ -87,11 +91,6 @@
}
}
- public String getResourceId()
- {
- return resourceId;
- }
-
private static void optimalRead(InputStream is, OutputStream os) throws Exception
{
int bufferLength = 1024; //TODO: Better to compute bufferLength in term of -Xms, -Xmx properties
@@ -106,4 +105,4 @@
}
}
}
-}
\ No newline at end of file
+}
Deleted: exo/portal/branches/3.1.x/webui/eXo/src/main/java/org/exoplatform/web/command/handler/GetApplicationHandler.java
===================================================================
--- exo/portal/branches/3.1.x/webui/eXo/src/main/java/org/exoplatform/web/command/handler/GetApplicationHandler.java 2010-11-09 10:09:36 UTC (rev 4980)
+++ exo/portal/branches/3.1.x/webui/eXo/src/main/java/org/exoplatform/web/command/handler/GetApplicationHandler.java 2010-11-09 10:09:47 UTC (rev 4981)
@@ -1,169 +0,0 @@
-/**
- * Copyright (C) 2009 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.web.command.handler;
-
-import org.exoplatform.application.registry.Application;
-import org.exoplatform.application.registry.ApplicationCategory;
-import org.exoplatform.application.registry.ApplicationRegistryService;
-import org.exoplatform.container.ExoContainer;
-import org.exoplatform.container.ExoContainerContext;
-import org.exoplatform.json.BeanToJSONPlugin;
-import org.exoplatform.json.JSONService;
-import org.exoplatform.portal.config.model.ApplicationType;
-import org.exoplatform.web.WebAppController;
-import org.exoplatform.web.command.Command;
-
-import java.io.IOException;
-import java.io.Writer;
-import java.util.List;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-/**
- * Created by The eXo Platform SARL
- * Author : Nhu Dinh Thuan
- * nhudinhthuan(a)exoplatform.com
- * May 31, 2007
- */
-public class GetApplicationHandler extends Command
-{
-
- private ApplicationType<?>[] applicationType;
-
- public void setApplicationTypes(ApplicationType<?>[] type)
- {
- applicationType = type;
- }
-
- @SuppressWarnings("unused")
- public void execute(WebAppController controller, HttpServletRequest req, HttpServletResponse res) throws Exception
- {
- res.setHeader("Cache-Control", "no-cache");
- Writer writer = res.getWriter();
- try
- {
- writer.append(getApplications(req.getRemoteUser()));
- }
- catch (Exception e)
- {
- e.printStackTrace();
- throw new IOException(e.getMessage());
- }
- }
-
- @SuppressWarnings("unchecked")
- private StringBuilder getApplications(String remoteUser) throws Exception
- {
- ExoContainer container = ExoContainerContext.getCurrentContainer();
- ApplicationRegistryService prService =
- (ApplicationRegistryService)container.getComponentInstanceOfType(ApplicationRegistryService.class);
-
- if (applicationType == null)
- applicationType = new ApplicationType<?>[0];
- List<ApplicationCategory> appCategories = prService.getApplicationCategories(remoteUser, applicationType);
- ApplicationCategoryToJSONPlugin toJSON = new ApplicationCategoryToJSONPlugin();
-
- StringBuilder value = new StringBuilder();
- JSONService jsonService = new JSONService();
- jsonService.register(ApplicationCategory.class, toJSON);
-
- if (appCategories.size() < 1)
- return value;
-
- value.append("{\n").append(" applicationRegistry : {\n");
- for (int i = 0; i < appCategories.size(); i++)
- {
- ApplicationCategory category = appCategories.get(i);
- jsonService.toJSONScript(category, value, 1);
- if (i < appCategories.size() - 1)
- value.append(" ,\n");
- }
- value.append(" }\n").append("}\n");
-
- return value;
- }
-
- private class ApplicationCategoryToJSONPlugin extends BeanToJSONPlugin<ApplicationCategory>
- {
-
- @SuppressWarnings("unchecked")
- public void toJSONScript(ApplicationCategory category, StringBuilder builder, int indentLevel) throws Exception
- {
- StringBuilder builderPortlet = toJSONScript(category, indentLevel + 2);
- if (builderPortlet.length() < 1)
- return;
-
- appendIndentation(builder, indentLevel);
- builder.append('\'').append(category.getName()).append("' : {\n");
- appendIndentation(builder, indentLevel + 1);
- builder.append("'name' : '").append(category.getDisplayName()).append("',\n");
- appendIndentation(builder, indentLevel + 1);
- builder.append("'applications' : {\n");
- builder.append(builderPortlet);
- appendIndentation(builder, indentLevel + 1);
- builder.append("}\n");
- appendIndentation(builder, indentLevel);
- builder.append("}\n");
- }
-
- @SuppressWarnings("unchecked")
- private StringBuilder toJSONScript(ApplicationCategory category, int indentLevel) throws Exception
- {
- StringBuilder builder = new StringBuilder();
- List<Application> applications = category.getApplications();
-
- for (int j = 0; j < applications.size(); j++)
- {
- toJSONScript(applications.get(j), builder, indentLevel);
- if (j < applications.size() - 1)
- {
- appendIndentation(builder, indentLevel);
- builder.append(",\n");
- }
- }
-
- return builder;
- }
-
- private void toJSONScript(Application application, StringBuilder builder, int indentLevel)
- {
- appendIndentation(builder, indentLevel);
- builder.append('\'').append(application.getId()).append("' : {\n");
- appendIndentation(builder, indentLevel + 1);
- //TODO: Tung.Pham modified
- //----------------------------
- //builder.append("'title' : ").append("'").append(application.getApplicationName()).append("',\n");
- builder.append("'name' : ").append("'").append(application.getApplicationName()).append("',\n");
- appendIndentation(builder, indentLevel + 1);
- builder.append("'title' : ").append("'").append(application.getDisplayName()).append("',\n");
- //------------------------------
- appendIndentation(builder, indentLevel + 1);
- builder.append("'des' : ").append("'").append(application.getDescription()).append("',\n");
- appendIndentation(builder, indentLevel + 1);
- builder.append("'id' : ").append("'").append(application.getId()).append("',\n");
- appendIndentation(builder, indentLevel + 1);
- builder.append("'type' : ").append("'").append(application.getType()).append("'\n");
- appendIndentation(builder, indentLevel);
- builder.append("}\n");
- }
- }
-
-}
Deleted: exo/portal/branches/3.1.x/webui/eXo/src/main/java/org/exoplatform/web/command/handler/HelloJCRHandler.java
===================================================================
--- exo/portal/branches/3.1.x/webui/eXo/src/main/java/org/exoplatform/web/command/handler/HelloJCRHandler.java 2010-11-09 10:09:36 UTC (rev 4980)
+++ exo/portal/branches/3.1.x/webui/eXo/src/main/java/org/exoplatform/web/command/handler/HelloJCRHandler.java 2010-11-09 10:09:47 UTC (rev 4981)
@@ -1,46 +0,0 @@
-/**
- * Copyright (C) 2009 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.web.command.handler;
-
-import org.exoplatform.web.WebAppController;
-import org.exoplatform.web.command.Command;
-
-import java.io.PrintWriter;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-/**
- * Created by The eXo Platform SARL
- * Author : Nguyen Ba Uoc
- * thuy.le(a)exoplatform.com
- * July 24, 2007
- */
-public class HelloJCRHandler extends Command
-{
-
- public void execute(WebAppController controller, HttpServletRequest req, HttpServletResponse res) throws Exception
- {
- res.setContentType("text/xml");
- PrintWriter out = res.getWriter();
- out.println("Hello from server");
- System.out.println("Client request");
- }
-}
\ No newline at end of file
Modified: exo/portal/branches/3.1.x/webui/eXo/src/main/java/org/exoplatform/web/command/handler/UploadHandler.java
===================================================================
--- exo/portal/branches/3.1.x/webui/eXo/src/main/java/org/exoplatform/web/command/handler/UploadHandler.java 2010-11-09 10:09:36 UTC (rev 4980)
+++ exo/portal/branches/3.1.x/webui/eXo/src/main/java/org/exoplatform/web/command/handler/UploadHandler.java 2010-11-09 10:09:47 UTC (rev 4981)
@@ -24,7 +24,7 @@
import org.exoplatform.upload.UploadResource;
import org.exoplatform.upload.UploadService;
import org.exoplatform.web.WebAppController;
-import org.exoplatform.web.command.Command;
+import org.exoplatform.web.WebRequestHandler;
import java.io.Writer;
import java.net.URLEncoder;
@@ -38,30 +38,24 @@
* nhudinhthuan(a)exoplatform.com
* Dec 9, 2006
*/
-public class UploadHandler extends Command
+public class UploadHandler extends WebRequestHandler
{
static enum UploadServiceAction {
PROGRESS, UPLOAD, DELETE, ABORT
}
-
- private String action;
-
- private String[] uploadId;
-
- public void setAction(String action)
+
+ @Override
+ public String[] getPath()
{
- this.action = action;
+ return new String[]{"/upload"};
}
- public void setUploadId(String[] uploadId)
- {
- this.uploadId = uploadId;
- }
-
- @SuppressWarnings("unused")
public void execute(WebAppController controller, HttpServletRequest req, HttpServletResponse res) throws Exception
{
+ String action = req.getParameter("action");
+ String[] uploadIds = req.getParameterValues("uploadId");
+
res.setHeader("Cache-Control", "no-cache");
ExoContainer container = ExoContainerContext.getCurrentContainer();
@@ -73,19 +67,19 @@
if (uploadActionService == UploadServiceAction.PROGRESS)
{
Writer writer = res.getWriter();
- if (uploadId == null)
+ if (uploadIds == null)
return;
StringBuilder value = new StringBuilder();
value.append("{\n upload : {");
- for (int i = 0; i < uploadId.length; i++)
+ for (int i = 0; i < uploadIds.length; i++)
{
- UploadResource upResource = service.getUploadResource(uploadId[i]);
+ UploadResource upResource = service.getUploadResource(uploadIds[i]);
if (upResource == null)
continue;
if (upResource.getStatus() == UploadResource.FAILED_STATUS)
{
- int limitMB = service.getUploadLimitsMB().get(uploadId[i]).intValue();
- value.append("\n \"").append(uploadId[i]).append("\": {");
+ int limitMB = service.getUploadLimitsMB().get(uploadIds[i]).intValue();
+ value.append("\n \"").append(uploadIds[i]).append("\": {");
value.append("\n \"status\":").append('\"').append("failed").append("\",");
value.append("\n \"size\":").append('\"').append(limitMB).append("\"");
value.append("\n }");
@@ -96,12 +90,12 @@
{
percent = (upResource.getUploadedSize() * 100) / upResource.getEstimatedSize();
}
- value.append("\n \"").append(uploadId[i]).append("\": {");
+ value.append("\n \"").append(uploadIds[i]).append("\": {");
value.append("\n \"percent\":").append('\"').append((int)percent).append("\",");
value.append("\n \"fileName\":").append('\"').append(encodeName(upResource.getFileName()))
.append("\"");
value.append("\n }");
- if (i < uploadId.length - 1)
+ if (i < uploadIds.length - 1)
value.append(',');
}
value.append("\n }\n}");
@@ -113,14 +107,11 @@
}
else if (uploadActionService == UploadServiceAction.DELETE)
{
- service.removeUpload(uploadId[0]);
+ service.removeUploadResource(uploadIds[0]);
}
else if (uploadActionService == UploadServiceAction.ABORT)
{
- //TODO: dang.tung - we don't need 2 statements because it'll show error when we reload browser
- //UploadResource upResource = service.getUploadResource(uploadId[0]);
- //if(upResource != null) upResource.setStatus(UploadResource.UPLOADED_STATUS) ;
- service.removeUpload(uploadId[0]);
+ service.removeUploadResource(uploadIds[0]);
}
}
@@ -135,4 +126,4 @@
return str;
}
-}
\ No newline at end of file
+}
14 years, 2 months
gatein SVN: r4980 - in epp/portal/branches/EPP_5_1_Branch/portlet/exoadmin/src/main: webapp/groovy/applicationregistry/webui/component and 1 other directory.
by do-not-reply@jboss.org
Author: thomas.heute(a)jboss.com
Date: 2010-11-09 05:09:36 -0500 (Tue, 09 Nov 2010)
New Revision: 4980
Modified:
epp/portal/branches/EPP_5_1_Branch/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UICategorySelector.java
epp/portal/branches/EPP_5_1_Branch/portlet/exoadmin/src/main/webapp/groovy/applicationregistry/webui/component/UIGadgetInfo.gtmpl
epp/portal/branches/EPP_5_1_Branch/portlet/exoadmin/src/main/webapp/groovy/applicationregistry/webui/component/UIPortletInfo.gtmpl
Log:
JBEPP-604: XSS issues in the application registry related to category display names
Modified: epp/portal/branches/EPP_5_1_Branch/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UICategorySelector.java
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UICategorySelector.java 2010-11-09 10:07:06 UTC (rev 4979)
+++ epp/portal/branches/EPP_5_1_Branch/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UICategorySelector.java 2010-11-09 10:09:36 UTC (rev 4980)
@@ -19,6 +19,8 @@
import org.exoplatform.webui.form.UIFormInputSet;
import org.exoplatform.webui.form.UIFormPageIterator;
+import org.gatein.common.text.EntityEncoder;
+
import java.util.ArrayList;
import java.util.List;
@@ -77,6 +79,8 @@
UIFormCheckBoxInput<Boolean> checkBoxInput;
UIFormInputInfo uiInfo;
+ EntityEncoder encoder = EntityEncoder.FULL;
+
//
ApplicationRegistryService appRegService = getApplicationComponent(ApplicationRegistryService.class);
List<ApplicationCategory> categories = getAllCategories();
@@ -91,7 +95,7 @@
defaultValue = appRegService.getApplication(category.getName(), definitionName) != null;
}
checkBoxInput = new UIFormCheckBoxInput<Boolean>("category_" + category.getName(), null, defaultValue);
- uiInfo = new UIFormInputInfo("categoryName", null, category.getDisplayName());
+ uiInfo = new UIFormInputInfo("categoryName", null, encoder.encode(category.getDisplayName()));
uiInputSet.addChild(checkBoxInput);
uiInputSet.addChild(uiInfo);
uiTableInputSet.addChild(uiInputSet);
Modified: epp/portal/branches/EPP_5_1_Branch/portlet/exoadmin/src/main/webapp/groovy/applicationregistry/webui/component/UIGadgetInfo.gtmpl
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/portlet/exoadmin/src/main/webapp/groovy/applicationregistry/webui/component/UIGadgetInfo.gtmpl 2010-11-09 10:07:06 UTC (rev 4979)
+++ epp/portal/branches/EPP_5_1_Branch/portlet/exoadmin/src/main/webapp/groovy/applicationregistry/webui/component/UIGadgetInfo.gtmpl 2010-11-09 10:09:36 UTC (rev 4980)
@@ -1,6 +1,8 @@
<%
import org.exoplatform.applicationregistry.webui.component.UICategorySelector;
-
+ import org.gatein.common.text.EntityEncoder;
+
+ EntityEncoder encoder = EntityEncoder.FULL;
def gadget = uicomponent.getGadget();
boolean selectorRender = uicomponent.getChild(UICategorySelector.class).isRendered();
String srcBGError = "/eXoResources/skin/sharedImages/Icon80x80/DefaultPortlet.png";
@@ -59,7 +61,7 @@
<table>
<tr>
<td class="LeftLabel"><%=_ctx.appRes("UIGadgetInfo.label.categories")%></td>
- <td class="RightLabel">$categoryNames
+ <td class="RightLabel"><%= encoder.encode(categoryNames) %>
<% if (categoryNames.equals("")) { %>
<%=_ctx.appRes("UIGadgetInfo.label.categories.guide")%><br/>
<% if (!selectorRender) { %>
@@ -80,4 +82,4 @@
uicomponent.renderChildren();
} %>
</div>
-</div>
\ No newline at end of file
+</div>
Modified: epp/portal/branches/EPP_5_1_Branch/portlet/exoadmin/src/main/webapp/groovy/applicationregistry/webui/component/UIPortletInfo.gtmpl
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/portlet/exoadmin/src/main/webapp/groovy/applicationregistry/webui/component/UIPortletInfo.gtmpl 2010-11-09 10:07:06 UTC (rev 4979)
+++ epp/portal/branches/EPP_5_1_Branch/portlet/exoadmin/src/main/webapp/groovy/applicationregistry/webui/component/UIPortletInfo.gtmpl 2010-11-09 10:09:36 UTC (rev 4980)
@@ -2,9 +2,11 @@
import java.util.Iterator;
import java.util.Map.Entry;
import org.exoplatform.applicationregistry.webui.component.UICategorySelector;
+ import org.gatein.common.text.EntityEncoder;
- boolean selectorRender = uicomponent.getChild(UICategorySelector.class).isRendered();
- String categoryNames = uicomponent.getCategorieNames();
+ boolean selectorRender = uicomponent.getChild(UICategorySelector.class).isRendered();
+ String categoryNames = uicomponent.getCategorieNames();
+ EntityEncoder encoder = EntityEncoder.FULL;
def portlet = uicomponent.getPortlet();
def portletPreferences = portlet.getPortletPreferences();
String srcBG = "/" + portlet.getPortletGroup() + "/skin/DefaultSkin/portletIcons/" + portlet.getName() + ".png";
@@ -64,7 +66,7 @@
</tr>
<tr>
<td class="LeftLabel"><%= _ctx.appRes("UIPortletInfo.label.categories") %></td>
- <td class="RightLabel">$categoryNames
+ <td class="RightLabel"><%= encoder.encode(categoryNames) %>
<% if (categoryNames.equals("")) { %>
<%=_ctx.appRes("UIPortletInfo.label.categories.guide")%><br/>
<% if (!selectorRender) { %>
@@ -111,4 +113,4 @@
</table>
</div>
<% }%>
-</div>
\ No newline at end of file
+</div>
14 years, 2 months
gatein SVN: r4979 - in epp/portal/branches/EPP_5_1_Branch/starter: jar and 9 other directories.
by do-not-reply@jboss.org
Author: thomas.heute(a)jboss.com
Date: 2010-11-09 05:07:06 -0500 (Tue, 09 Nov 2010)
New Revision: 4979
Added:
epp/portal/branches/EPP_5_1_Branch/starter/jar/
epp/portal/branches/EPP_5_1_Branch/starter/jar/pom.xml
epp/portal/branches/EPP_5_1_Branch/starter/jar/src/
epp/portal/branches/EPP_5_1_Branch/starter/jar/src/main/
epp/portal/branches/EPP_5_1_Branch/starter/jar/src/main/java/
epp/portal/branches/EPP_5_1_Branch/starter/jar/src/main/java/org/
epp/portal/branches/EPP_5_1_Branch/starter/jar/src/main/java/org/gatein/
epp/portal/branches/EPP_5_1_Branch/starter/jar/src/main/java/org/gatein/portal/
epp/portal/branches/EPP_5_1_Branch/starter/jar/src/main/java/org/gatein/portal/starter/
epp/portal/branches/EPP_5_1_Branch/starter/jar/src/main/java/org/gatein/portal/starter/VersionDisplayer.java
Modified:
epp/portal/branches/EPP_5_1_Branch/starter/pom.xml
epp/portal/branches/EPP_5_1_Branch/starter/war/pom.xml
epp/portal/branches/EPP_5_1_Branch/starter/war/src/main/webapp/WEB-INF/web.xml
Log:
JBEPP-521: Include EPP version in log
Added: epp/portal/branches/EPP_5_1_Branch/starter/jar/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/starter/jar/pom.xml (rev 0)
+++ epp/portal/branches/EPP_5_1_Branch/starter/jar/pom.xml 2010-11-09 10:07:06 UTC (rev 4979)
@@ -0,0 +1,51 @@
+<!--
+
+ Copyright (C) 2009 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.
+
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.exoplatform.portal</groupId>
+ <artifactId>exo.portal.parent</artifactId>
+ <version>5.1.0-epp-ER04-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>exo.portal.starter.jar</artifactId>
+ <packaging>jar</packaging>
+ <name>GateIn Portal Starter Jar</name>
+ <url>http://www.gatein.org</url>
+ <description>GateIn Portal Starter Jar</description>
+
+ <build>
+ <finalName>starter</finalName>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.gatein.common</groupId>
+ <artifactId>common-logging</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+</project>
Added: epp/portal/branches/EPP_5_1_Branch/starter/jar/src/main/java/org/gatein/portal/starter/VersionDisplayer.java
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/starter/jar/src/main/java/org/gatein/portal/starter/VersionDisplayer.java (rev 0)
+++ epp/portal/branches/EPP_5_1_Branch/starter/jar/src/main/java/org/gatein/portal/starter/VersionDisplayer.java 2010-11-09 10:07:06 UTC (rev 4979)
@@ -0,0 +1,55 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, Red Hat Middleware, LLC, and individual
+ * contributors as indicated by the @authors tag. See the
+ * copyright.txt in the distribution for a full listing of
+ * individual contributors.
+ *
+ * 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.gatein.portal.starter;
+
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
+
+import org.gatein.common.logging.Logger;
+import org.gatein.common.logging.LoggerFactory;
+
+/**
+ * To display in the log the used version of EPP on startup
+ * @author <a href="theute(a)redhat.com">Thomas Heute</a>
+ * @version 1.0
+ */
+public class VersionDisplayer implements ServletContextListener
+{
+ private Logger logger = LoggerFactory.getLogger(VersionDisplayer.class);
+
+ public void contextDestroyed(ServletContextEvent arg0) {
+
+ }
+
+ public void contextInitialized(ServletContextEvent arg0) {
+ String eppVersion;
+ try {
+ eppVersion = this.getClass().getPackage().getImplementationVersion();
+ } catch (Exception e) {
+ eppVersion = "Version not found";
+ e.printStackTrace();
+ }
+ logger.info("JBoss Enterprise Portal Platform [" + eppVersion + "]");
+ }
+
+}
Modified: epp/portal/branches/EPP_5_1_Branch/starter/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/starter/pom.xml 2010-11-09 08:42:24 UTC (rev 4978)
+++ epp/portal/branches/EPP_5_1_Branch/starter/pom.xml 2010-11-09 10:07:06 UTC (rev 4979)
@@ -33,6 +33,7 @@
<description>GateIn Portal Starter Root Pom</description>
<modules>
+ <module>jar</module>
<module>war</module>
<module>ear</module>
</modules>
Modified: epp/portal/branches/EPP_5_1_Branch/starter/war/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/starter/war/pom.xml 2010-11-09 08:42:24 UTC (rev 4978)
+++ epp/portal/branches/EPP_5_1_Branch/starter/war/pom.xml 2010-11-09 10:07:06 UTC (rev 4979)
@@ -36,4 +36,21 @@
<build>
<finalName>starter</finalName>
</build>
+ <dependencies>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.gatein.common</groupId>
+ <artifactId>common-logging</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.exoplatform.portal</groupId>
+ <artifactId>exo.portal.starter.jar</artifactId>
+ <version>5.1.0-epp-ER04-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
</project>
Modified: epp/portal/branches/EPP_5_1_Branch/starter/war/src/main/webapp/WEB-INF/web.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/starter/war/src/main/webapp/WEB-INF/web.xml 2010-11-09 08:42:24 UTC (rev 4978)
+++ epp/portal/branches/EPP_5_1_Branch/starter/war/src/main/webapp/WEB-INF/web.xml 2010-11-09 10:07:06 UTC (rev 4979)
@@ -31,5 +31,8 @@
<listener-class>org.exoplatform.container.web.PortalContainerCreator</listener-class>
</listener>
+ <listener>
+ <listener-class>org.gatein.portal.starter.VersionDisplayer</listener-class>
+ </listener>
</web-app>
14 years, 2 months
gatein SVN: r4978 - in epp/portal/branches/EPP_5_1_Branch: webui/portal/src/main/java/org/exoplatform/portal/webui and 1 other directory.
by do-not-reply@jboss.org
Author: thomas.heute(a)jboss.com
Date: 2010-11-09 03:42:24 -0500 (Tue, 09 Nov 2010)
New Revision: 4978
Modified:
epp/portal/branches/EPP_5_1_Branch/portlet/exoadmin/src/main/java/org/exoplatform/account/webui/component/RegisterPortletApplicationController.java
epp/portal/branches/EPP_5_1_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/CaptchaValidator.java
Log:
JBEPP-593: Captcha is not refreshing on Register page
Modified: epp/portal/branches/EPP_5_1_Branch/portlet/exoadmin/src/main/java/org/exoplatform/account/webui/component/RegisterPortletApplicationController.java
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/portlet/exoadmin/src/main/java/org/exoplatform/account/webui/component/RegisterPortletApplicationController.java 2010-11-09 08:38:37 UTC (rev 4977)
+++ epp/portal/branches/EPP_5_1_Branch/portlet/exoadmin/src/main/java/org/exoplatform/account/webui/component/RegisterPortletApplicationController.java 2010-11-09 08:42:24 UTC (rev 4978)
@@ -67,18 +67,18 @@
{
PortletSession session = req.getPortletSession();
Captcha captcha;
- if (session.getAttribute(NAME) == null)
+ if (session.getAttribute(NAME, PortletSession.APPLICATION_SCOPE) == null)
{
captcha = new Captcha.Builder(_width, _height).addText().gimp().addNoise().addBackground().build();
- session.setAttribute(NAME, captcha);
+ session.setAttribute(NAME, captcha, PortletSession.APPLICATION_SCOPE);
writeImage(resp, captcha.getImage());
return;
}
- captcha = (Captcha)session.getAttribute(NAME);
+ captcha = (Captcha)session.getAttribute(NAME, PortletSession.APPLICATION_SCOPE);
writeImage(resp, captcha.getImage());
}
Modified: epp/portal/branches/EPP_5_1_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/CaptchaValidator.java
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/CaptchaValidator.java 2010-11-09 08:38:37 UTC (rev 4977)
+++ epp/portal/branches/EPP_5_1_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/CaptchaValidator.java 2010-11-09 08:42:24 UTC (rev 4978)
@@ -49,7 +49,7 @@
PortletRequest req = ctx.getRequest();
PortletSession session = req.getPortletSession();
- Captcha captcha = (Captcha) session.getAttribute(Captcha.NAME);
+ Captcha captcha = (Captcha) session.getAttribute(Captcha.NAME, PortletSession.APPLICATION_SCOPE);
if ((captcha != null) && (captcha.isCorrect((String) uiInput.getValue())))
{
14 years, 2 months
gatein SVN: r4976 - epp/portal/branches/EPP_5_1_Branch/portlet/exoadmin/src/main/webapp/groovy/admintoolbar/webui/component.
by do-not-reply@jboss.org
Author: thomas.heute(a)jboss.com
Date: 2010-11-09 03:34:22 -0500 (Tue, 09 Nov 2010)
New Revision: 4976
Modified:
epp/portal/branches/EPP_5_1_Branch/portlet/exoadmin/src/main/webapp/groovy/admintoolbar/webui/component/UIUserToolBarDashboardPortlet.gtmpl
Log:
JBEPP-579: NullPointerException in UIUserToolBarDashboardPortlet.gtmpl if no navigation.xml created for a LDAP user
Modified: epp/portal/branches/EPP_5_1_Branch/portlet/exoadmin/src/main/webapp/groovy/admintoolbar/webui/component/UIUserToolBarDashboardPortlet.gtmpl
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/portlet/exoadmin/src/main/webapp/groovy/admintoolbar/webui/component/UIUserToolBarDashboardPortlet.gtmpl 2010-11-09 08:26:30 UTC (rev 4975)
+++ epp/portal/branches/EPP_5_1_Branch/portlet/exoadmin/src/main/webapp/groovy/admintoolbar/webui/component/UIUserToolBarDashboardPortlet.gtmpl 2010-11-09 08:34:22 UTC (rev 4976)
@@ -91,7 +91,7 @@
<%
String defaultDashboardPage;
- if(currentUserNavigation.getNodes() ==null || currentUserNavigation.getNodes().size() < 1){
+ if(currentUserNavigation == null || currentUserNavigation.getNodes() == null || currentUserNavigation.getNodes().size() < 1){
defaultDashboardPage = org.exoplatform.toolbar.webui.component.UIUserToolBarDashboardPortlet.DEFAULT_TAB_NAME;
%>
<div class="UIUserToolBarDashboardPortlet" id="$uicomponent.id">
14 years, 2 months
gatein SVN: r4975 - epp/portal/branches/EPP_5_1_Branch/webui/framework/src/main/java/org/exoplatform/webui/application.
by do-not-reply@jboss.org
Author: thomas.heute(a)jboss.com
Date: 2010-11-09 03:26:30 -0500 (Tue, 09 Nov 2010)
New Revision: 4975
Modified:
epp/portal/branches/EPP_5_1_Branch/webui/framework/src/main/java/org/exoplatform/webui/application/ConfigurationManager.java
Log:
JBEPP-577: Concurrency problem (HashMap used in class ConfigurationManager in multithreaded environment)
Modified: epp/portal/branches/EPP_5_1_Branch/webui/framework/src/main/java/org/exoplatform/webui/application/ConfigurationManager.java
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/webui/framework/src/main/java/org/exoplatform/webui/application/ConfigurationManager.java 2010-11-09 08:18:59 UTC (rev 4974)
+++ epp/portal/branches/EPP_5_1_Branch/webui/framework/src/main/java/org/exoplatform/webui/application/ConfigurationManager.java 2010-11-09 08:26:30 UTC (rev 4975)
@@ -40,6 +40,7 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
/**
* May 10, 2006
@@ -55,8 +56,16 @@
* <p/>
* The components of which we manage the configuration
*/
- private Map<String, Component> configs_ = new HashMap<String, Component>();
+ //private Map<String, Component> configs_ = new HashMap<String, Component>();
+ /**
+ * Minh Hoang TO: First attempt to synchronize the map, we simply replace HashMap with ConcurrentHashMap
+ * and default values for load factor, initial capacity and concurrentcyLevel
+ *
+ * TODO: Need to examine the performance influence in the future for a better synchronizing
+ */
+ private Map<String, Component> configs_ = new ConcurrentHashMap<String, Component>();
+
/** The logger. */
private final Logger log;
14 years, 2 months