gatein SVN: r5159 - portal/trunk/packaging/tomcat/pkg.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2010-11-18 09:36:34 -0500 (Thu, 18 Nov 2010)
New Revision: 5159
Modified:
portal/trunk/packaging/tomcat/pkg/pom.xml
Log:
GTNPORTAL-1670 : Explicit filter of webapps pre packaged in tomcat (remove ROOT / examples / docs)
Modified: portal/trunk/packaging/tomcat/pkg/pom.xml
===================================================================
--- portal/trunk/packaging/tomcat/pkg/pom.xml 2010-11-18 11:55:43 UTC (rev 5158)
+++ portal/trunk/packaging/tomcat/pkg/pom.xml 2010-11-18 14:36:34 UTC (rev 5159)
@@ -900,7 +900,11 @@
<!-- Copy tomcat -->
<copy todir="${project.build.directory}/tomcat">
- <fileset dir="${tomcat.dir}" excludes="webapps/**"/>
+ <fileset dir="${tomcat.dir}">
+ <exclude name="webapps/ROOT/**"/>
+ <exclude name="webapps/examples/**"/>
+ <exclude name="webapps/docs/**"/>
+ </fileset>
</copy>
<!-- Copy the dependencies -->
15 years, 5 months
gatein SVN: r5158 - in components/wsrp/trunk: common/src/test/java/org/gatein/wsrp and 7 other directories.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2010-11-18 06:55:43 -0500 (Thu, 18 Nov 2010)
New Revision: 5158
Added:
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/ResourceServingUtil.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/DirectResourceServingHandler.java
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/resources/
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/resources/ResourceServingServlet.java
Modified:
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPActionURL.java
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPPortletURL.java
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPRenderURL.java
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPResourceURL.java
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPTypeFactory.java
components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/WSRPRenderURLTestCase.java
components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/other/WSRPPortletURLTestCase.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/WSRPConsumerImpl.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/InvocationDispatcher.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/InvocationHandler.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/MimeResponseHandler.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/ResourceHandler.java
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/handlers/processors/WSRPPortletInvocationContext.java
components/wsrp/trunk/wsrp-producer-war/src/main/webapp/WEB-INF/web.xml
Log:
- GTNWSRP-146: Use a servlet to serve wsrp v1 resource:
+ Improved invocation dispatching of resources.
+ Refactored handling of direct resource serving: now uses a proper handler, subclassing ResourceHandler.
+ Added WSRPPortletURL.URLContext as a parameter to build WSRPPortletURL so that contextual informtation can be passed to the URL.
+ Added ResourceServingUtil to deal with encoding and decoding of direct resource requests.
+ Had WSRPPortletInvocationContext.renderURL use URLContext to transmit data to URLs.
+ WSRPResourceURL now computes a resourceURL if it is provided with the information to do so.
- Moved namespace generation and portlet instance key extraction methods to WSRPTypeFactory so that they can be reused across modules with the same logic.
Added: components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/ResourceServingUtil.java
===================================================================
--- components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/ResourceServingUtil.java (rev 0)
+++ components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/ResourceServingUtil.java 2010-11-18 11:55:43 UTC (rev 5158)
@@ -0,0 +1,181 @@
+/*
+ * 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.wsrp;
+
+import org.gatein.common.net.URLTools;
+import org.gatein.common.util.ParameterValidation;
+import org.gatein.pc.api.Mode;
+import org.gatein.pc.api.StateString;
+import org.gatein.pc.api.WindowState;
+import org.gatein.pc.api.cache.CacheLevel;
+import org.oasis.wsrp.v2.GetResource;
+import org.oasis.wsrp.v2.NamedString;
+import org.oasis.wsrp.v2.PortletContext;
+import org.oasis.wsrp.v2.RegistrationContext;
+import org.oasis.wsrp.v2.ResourceParams;
+import org.oasis.wsrp.v2.RuntimeContext;
+import org.oasis.wsrp.v2.StateChange;
+
+import javax.servlet.http.HttpServletRequest;
+import java.net.URI;
+import java.net.URL;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class ResourceServingUtil
+{
+ private static final String REG_HANDLE = "regHandle";
+ private static final String INSTANCE_KEY = "instanceKey";
+ private static final String NS = "ns";
+ private static final String MODE = "mode";
+ private static final String WINDOW_STATE = "windowState";
+ private static final String RESOURCE_STATE = "resourceState";
+ private static final String NAV_STATE = "navState";
+ private static final String SLASH_REPLACEMENT = "__";
+ private static final String QMARK = "?";
+
+ public static GetResource decode(HttpServletRequest req)
+ {
+ String path = req.getPathInfo();
+
+ int portletHandleEnd = path.indexOf(URLTools.SLASH, 1);
+ String portletHandle = path.substring(1, portletHandleEnd);
+ PortletContext portletContext = decode(portletHandle);
+
+ String resourceId = path.substring(portletHandleEnd);
+
+ String registrationHandle = req.getParameter(REG_HANDLE);
+ RegistrationContext registrationContext = null;
+ if (!ParameterValidation.isNullOrEmpty(registrationHandle))
+ {
+ registrationContext = WSRPTypeFactory.createRegistrationContext(registrationHandle);
+ }
+
+ String instanceKey = req.getParameter(INSTANCE_KEY);
+ String ns = req.getParameter(NS);
+ RuntimeContext runtimeContext = WSRPTypeFactory.createRuntimeContext(WSRPConstants.NONE_USER_AUTHENTICATION, instanceKey, ns);
+
+ Enumeration reqLocales = req.getLocales();
+ List<String> locales = WSRPUtils.convertLocalesToRFC3066LanguageTags(Collections.list(reqLocales));
+ List<String> mimeTypes = WSRPConstants.getDefaultMimeTypes();
+
+ ResourceParams resourceParams = WSRPTypeFactory.createResourceParams(req.isSecure(), locales, mimeTypes,
+ WSRPConstants.VIEW_MODE, WSRPConstants.NORMAL_WINDOW_STATE, resourceId, StateChange.READ_ONLY);
+ resourceParams.setResourceState(req.getParameter(RESOURCE_STATE));
+
+ String navState = req.getParameter(NAV_STATE);
+ if (!ParameterValidation.isNullOrEmpty(navState))
+ {
+ resourceParams.setNavigationalContext(WSRPTypeFactory.createNavigationalContext(navState, Collections.<NamedString>emptyList()));
+ }
+
+ return WSRPTypeFactory.createGetResource(registrationContext, portletContext, runtimeContext, null, resourceParams);
+ }
+
+ public static URL encode(Mode mode, WindowState windowState, boolean secure, StateString navigationalState, StateString resourceState, String resourceId, CacheLevel cacheability, WSRPPortletURL.URLContext context)
+ {
+ // Generate a resource URL based on the resource Id
+ String serverAddress = (String)context.getValueFor(WSRPPortletURL.URLContext.SERVER_ADDRESS);
+ org.gatein.pc.api.PortletContext portletContext = (org.gatein.pc.api.PortletContext)context.getValueFor(WSRPPortletURL.URLContext.PORTLET_CONTEXT);
+ try
+ {
+ StringBuilder sb = new StringBuilder(createAbsoluteURLFrom(resourceId, serverAddress, portletContext));
+ appendParameter(sb, MODE, mode.toString());
+ appendParameter(sb, WINDOW_STATE, windowState.toString());
+ appendParameter(sb, INSTANCE_KEY, context.getValueFor(WSRPPortletURL.URLContext.INSTANCE_KEY));
+ appendParameter(sb, NS, context.getValueFor(WSRPPortletURL.URLContext.NAMESPACE));
+ appendParameter(sb, REG_HANDLE, context.getValueFor(WSRPPortletURL.URLContext.REGISTRATION_HANDLE));
+ if (resourceState != null)
+ {
+ appendParameter(sb, RESOURCE_STATE, resourceState.getStringValue());
+ }
+ if (navigationalState != null)
+ {
+ appendParameter(sb, NAV_STATE, navigationalState.getStringValue());
+ }
+
+ return new URI(sb.toString()).toURL();
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Couldn't create an absolute URL from resourceId: " + resourceId + ", server address: " + serverAddress
+ + ", portlet: " + portletContext, e);
+ }
+ }
+
+ private static String createAbsoluteURLFrom(String resourceId, String serverAddress, org.gatein.pc.api.PortletContext portletContext)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(resourceId, "resource ID", null);
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(serverAddress, "server address", null);
+ ParameterValidation.throwIllegalArgExceptionIfNull(portletContext, "portlet context");
+
+ String url = serverAddress + "/wsrp-producer/resource/";
+
+ url += encode(portletContext);
+
+ if (resourceId.startsWith(URLTools.SLASH))
+ {
+ url += resourceId + QMARK;
+ }
+ else
+ {
+ url += URLTools.SLASH + resourceId + QMARK;
+ }
+
+ return url;
+ }
+
+ private static String encode(org.gatein.pc.api.PortletContext portletContext)
+ {
+ String id = portletContext.getId();
+ if (id.startsWith(URLTools.SLASH))
+ {
+ id = id.replace(URLTools.SLASH, SLASH_REPLACEMENT);
+ }
+ return id;
+ }
+
+ private static PortletContext decode(String encodedPortletContext)
+ {
+ if (encodedPortletContext.startsWith(SLASH_REPLACEMENT))
+ {
+ encodedPortletContext = encodedPortletContext.replace(SLASH_REPLACEMENT, URLTools.SLASH);
+ }
+
+ return WSRPTypeFactory.createPortletContext(encodedPortletContext);
+ }
+
+ private static void appendParameter(StringBuilder builder, String name, Object value)
+ {
+ if (value != null)
+ {
+ builder.append("&").append(name).append("=").append(value);
+ }
+ }
+}
Modified: components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPActionURL.java
===================================================================
--- components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPActionURL.java 2010-11-18 11:22:08 UTC (rev 5157)
+++ components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPActionURL.java 2010-11-18 11:55:43 UTC (rev 5158)
@@ -40,9 +40,9 @@
{
private StateString interactionState;
- protected WSRPActionURL(Mode mode, WindowState windowState, boolean secure, StateString navigationalState, StateString interactionState)
+ protected WSRPActionURL(Mode mode, WindowState windowState, boolean secure, StateString navigationalState, StateString interactionState, URLContext context)
{
- super(mode, windowState, secure, navigationalState);
+ super(mode, windowState, secure, navigationalState, context);
this.interactionState = interactionState;
}
Modified: components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPPortletURL.java
===================================================================
--- components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPPortletURL.java 2010-11-18 11:22:08 UTC (rev 5157)
+++ components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPPortletURL.java 2010-11-18 11:55:43 UTC (rev 5158)
@@ -49,7 +49,7 @@
*/
public abstract class WSRPPortletURL implements ContainerURL
{
- private static final Logger log = LoggerFactory.getLogger(WSRPPortletURL.class);
+ protected static final Logger log = LoggerFactory.getLogger(WSRPPortletURL.class);
protected static final String EQUALS = "=";
protected static final String AMPERSAND = "&";
@@ -85,7 +85,7 @@
log.debug("Using " + (strict ? "strict" : "lenient") + " rewriting parameters validation mode.");
}
- public static WSRPPortletURL create(ContainerURL containerURL, boolean secure)
+ public static WSRPPortletURL create(ContainerURL containerURL, boolean secure, URLContext context)
{
if (containerURL == null)
{
@@ -100,17 +100,17 @@
if (containerURL instanceof ActionURL)
{
StateString interactionState = ((ActionURL)containerURL).getInteractionState();
- url = new WSRPActionURL(mode, windowState, secure, navigationalState, interactionState);
+ url = new WSRPActionURL(mode, windowState, secure, navigationalState, interactionState, context);
}
else if (containerURL instanceof RenderURL)
{
- url = new WSRPRenderURL(mode, windowState, secure, navigationalState, ((RenderURL)containerURL).getPublicNavigationalStateChanges());
+ url = new WSRPRenderURL(mode, windowState, secure, navigationalState, ((RenderURL)containerURL).getPublicNavigationalStateChanges(), context);
}
else if (containerURL instanceof ResourceURL)
{
ResourceURL resource = (ResourceURL)containerURL;
url = new WSRPResourceURL(mode, windowState, secure, navigationalState, resource.getResourceState(),
- resource.getResourceId(), resource.getCacheability());
+ resource.getResourceId(), resource.getCacheability(), context);
}
else
{
@@ -283,7 +283,7 @@
return create(encodedURL, Collections.<String>emptySet(), Collections.<String>emptySet());
}
- protected WSRPPortletURL(Mode mode, WindowState windowState, boolean secure, StateString navigationalState)
+ protected WSRPPortletURL(Mode mode, WindowState windowState, boolean secure, StateString navigationalState, URLContext context)
{
this.mode = mode;
this.windowState = windowState;
@@ -597,4 +597,50 @@
{
return Collections.emptyMap();
}
+
+ public static class URLContext
+ {
+ public static final String SERVER_ADDRESS = "org.gatein.wsrp.server.address";
+ public static final String PORTLET_CONTEXT = "org.gatein.wsrp.portlet.context";
+ public static final String REGISTRATION_HANDLE = "org.gatein.wsrp.registration";
+ public static final String INSTANCE_KEY = "org.gatein.wsrp.instance.key";
+ public static final String NAMESPACE = "org.gatein.wsrp.namespace";
+
+ public static final URLContext EMPTY = new URLContext()
+ {
+ @Override
+ public Object getValueFor(String name)
+ {
+ return null;
+ }
+
+ @Override
+ public void setValueFor(String name, Object value)
+ {
+ }
+ };
+ private Map<String, Object> context;
+
+ public URLContext()
+ {
+ context = new HashMap<String, Object>(7);
+ }
+
+ public URLContext(String name1, Object value1, String name2, Object value2)
+ {
+ this();
+ context.put(name1, value1);
+ context.put(name2, value2);
+ }
+
+ public Object getValueFor(String name)
+ {
+ return context.get(name);
+ }
+
+ public void setValueFor(String name, Object value)
+ {
+ context.put(name, value);
+ }
+ }
}
Modified: components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPRenderURL.java
===================================================================
--- components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPRenderURL.java 2010-11-18 11:22:08 UTC (rev 5157)
+++ components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPRenderURL.java 2010-11-18 11:55:43 UTC (rev 5158)
@@ -40,9 +40,9 @@
{
private Map<String, String[]> publicNSChanges;
- protected WSRPRenderURL(Mode mode, WindowState windowState, boolean secure, StateString navigationalState, Map<String, String[]> publicNavigationalStateChanges)
+ protected WSRPRenderURL(Mode mode, WindowState windowState, boolean secure, StateString navigationalState, Map<String, String[]> publicNavigationalStateChanges, URLContext context)
{
- super(mode, windowState, secure, navigationalState);
+ super(mode, windowState, secure, navigationalState, context);
this.publicNSChanges = publicNavigationalStateChanges;
}
Modified: components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPResourceURL.java
===================================================================
--- components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPResourceURL.java 2010-11-18 11:22:08 UTC (rev 5157)
+++ components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPResourceURL.java 2010-11-18 11:55:43 UTC (rev 5158)
@@ -59,15 +59,25 @@
{
}
- public WSRPResourceURL(Mode mode, WindowState windowState, boolean secure, StateString navigationalState, StateString resourceState, String resourceId, CacheLevel cacheability)
+ public WSRPResourceURL(Mode mode, WindowState windowState, boolean secure, StateString navigationalState, StateString resourceState, String resourceId, CacheLevel cacheability, URLContext context)
{
- super(mode, windowState, secure, navigationalState);
+ super(mode, windowState, secure, navigationalState, context);
if (resourceId == null)
{
// if the container didn't provide us with a resource id, fake one so that we can still build a correct WSRP URL.
resourceId = DEFAULT_RESOURCE_ID;
}
+
+ if (context != null && !URLContext.EMPTY.equals(context))
+ {
+ resourceURL = ResourceServingUtil.encode(mode, windowState, secure, navigationalState, resourceState, resourceId, cacheability, context);
+ }
+ else
+ {
+ resourceURL = null;
+ }
+
this.resourceId = resourceId;
this.resourceState = resourceState;
this.cacheability = cacheability;
@@ -252,7 +262,7 @@
public static Map<String, String> decodeResource(String resourceInfo)
{
Map<String, String> resource = new HashMap<String, String>();
-
+
if (resourceInfo != null && resourceInfo.startsWith(StateString.JBPNS_PREFIX))
{
Map<String, String[]> resourceParameters = StateString.decodeOpaqueValue(resourceInfo);
Modified: components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPTypeFactory.java
===================================================================
--- components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPTypeFactory.java 2010-11-18 11:22:08 UTC (rev 5157)
+++ components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPTypeFactory.java 2010-11-18 11:55:43 UTC (rev 5158)
@@ -37,7 +37,9 @@
import org.gatein.pc.api.URLFormat;
import org.gatein.pc.api.WindowState;
import org.gatein.pc.api.cache.CacheLevel;
+import org.gatein.pc.api.spi.InstanceContext;
import org.gatein.pc.api.spi.PortletInvocationContext;
+import org.gatein.pc.api.spi.WindowContext;
import org.gatein.wsrp.payload.PayloadUtils;
import org.gatein.wsrp.spec.v2.ErrorCodes;
import org.gatein.wsrp.spec.v2.WSRP2RewritingConstants;
@@ -419,7 +421,7 @@
private static void checkPortletHandle(String portletHandle)
{
- ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(portletHandle, "portlet handle", "PortletDescription");
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(portletHandle, "portlet handle", null);
if (portletHandle.length() > 255)
{
throw new IllegalArgumentException("Portlet handles must be less than 255 characters long. Was "
@@ -586,10 +588,10 @@
public static MarkupContext createMarkupContext(String mediaType, String markupString, byte[] markupBinary, Boolean useCachedItem)
{
boolean isUseCachedItem = (useCachedItem == null) ? false : useCachedItem.booleanValue();
-
+
MarkupContext markupContext = new MarkupContext();
markupContext.setMimeType(mediaType);
-
+
if (isUseCachedItem)
{
markupContext.setUseCachedItem(useCachedItem);
@@ -597,7 +599,7 @@
else
{
ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(mediaType, "Media type", "MarkupContext");
-
+
if (markupBinary != null)
{
markupContext.setItemBinary(markupBinary);
@@ -1811,4 +1813,30 @@
{
return new NamedStringArray();
}
+
+ public static String getPortletInstanceKey(InstanceContext instanceContext)
+ {
+ return instanceContext.getId();
+ }
+
+ public static String getNamespacePrefix(WindowContext windowContext, String portletHandle)
+ {
+ String namespacePrefix = getNamespaceFrom(windowContext);
+ if (namespacePrefix == null)
+ {
+ return portletHandle;
+ }
+
+ return namespacePrefix;
+ }
+
+ public static String getNamespaceFrom(WindowContext windowContext)
+ {
+ if (windowContext != null)
+ {
+ return windowContext.getNamespace();
+ }
+
+ return null;
+ }
}
Modified: components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/WSRPRenderURLTestCase.java
===================================================================
--- components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/WSRPRenderURLTestCase.java 2010-11-18 11:22:08 UTC (rev 5157)
+++ components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/WSRPRenderURLTestCase.java 2010-11-18 11:55:43 UTC (rev 5158)
@@ -39,13 +39,13 @@
{
public void testNullPublicNavigationalState()
{
- WSRPRenderURL url = new WSRPRenderURL(null, null, false, null, null);
+ WSRPRenderURL url = new WSRPRenderURL(null, null, false, null, null, WSRPPortletURL.URLContext.EMPTY);
assertFalse(url.toString().contains(WSRP2RewritingConstants.NAVIGATIONAL_VALUES));
}
public void testEmptyPublicNavigationalState()
{
- WSRPRenderURL url = new WSRPRenderURL(null, null, false, null, Collections.<String, String[]>emptyMap());
+ WSRPRenderURL url = new WSRPRenderURL(null, null, false, null, Collections.<String, String[]>emptyMap(), WSRPPortletURL.URLContext.EMPTY);
assertFalse(url.toString().contains(WSRP2RewritingConstants.NAVIGATIONAL_VALUES));
}
Modified: components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/other/WSRPPortletURLTestCase.java
===================================================================
--- components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/other/WSRPPortletURLTestCase.java 2010-11-18 11:22:08 UTC (rev 5157)
+++ components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/other/WSRPPortletURLTestCase.java 2010-11-18 11:55:43 UTC (rev 5158)
@@ -96,16 +96,16 @@
assertNull(resourceMap.get(WSRPRewritingConstants.RESOURCE_URL));
assertEquals("false", resourceMap.get(WSRP2RewritingConstants.RESOURCE_PREFER_OPERATION));
}
-
+
public void testResourceIDToken()
{
//Test what happens in the case where the url is created via token wsrp rewriting on the producer side
//In this case the resource ID will not be an encoded resource map.
-
+
Map<String, String> resourceMap = WSRPResourceURL.decodeResource("resource_123");
String resourceID = resourceMap.get(WSRP2RewritingConstants.RESOURCE_ID);
assertEquals("resource_123", resourceID);
-
+
assertNull(resourceMap.get(WSRPRewritingConstants.RESOURCE_URL));
assertNull(resourceMap.get(WSRP2RewritingConstants.RESOURCE_PREFER_OPERATION));
}
@@ -197,7 +197,7 @@
{
// create URL from container
ResourceURL resourceURL = new TestResourceURL("resparam", "resvalue");
- WSRPPortletURL url = WSRPPortletURL.create(resourceURL, false);
+ WSRPPortletURL url = WSRPPortletURL.create(resourceURL, false, WSRPPortletURL.URLContext.EMPTY);
assertTrue(url instanceof WSRPResourceURL);
WSRPResourceURL resource = (WSRPResourceURL)url;
Modified: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/WSRPConsumerImpl.java
===================================================================
--- components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/WSRPConsumerImpl.java 2010-11-18 11:22:08 UTC (rev 5157)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/WSRPConsumerImpl.java 2010-11-18 11:55:43 UTC (rev 5158)
@@ -121,6 +121,8 @@
private final static Logger log = LoggerFactory.getLogger(WSRPConsumer.class);
+ private final static String PORTLET_INFO_KEY = "wsrp_portlet_info";
+
static
{
REGISTRATION_NOT_NEEDED.setConsumerAgent("INVALID AGENT");
@@ -493,7 +495,17 @@
public WSRPPortletInfo getPortletInfo(PortletInvocation invocation) throws PortletInvokerException
{
- return (WSRPPortletInfo)getWSRPPortlet(getPortletContext(invocation)).getInfo();
+ // first try to get the info from the invocation
+ Object info = invocation.getAttribute(PORTLET_INFO_KEY);
+
+ // if the portlet info is not in the invocation, set it so that it can be used in further calls
+ if (info == null)
+ {
+ info = getWSRPPortlet(getPortletContext(invocation)).getInfo();
+ invocation.setAttribute(PORTLET_INFO_KEY, info);
+ }
+
+ return (WSRPPortletInfo)info;
}
WSRPPortlet getWSRPPortlet(PortletContext portletContext) throws PortletInvokerException
Added: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/DirectResourceServingHandler.java
===================================================================
--- components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/DirectResourceServingHandler.java (rev 0)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/DirectResourceServingHandler.java 2010-11-18 11:55:43 UTC (rev 5158)
@@ -0,0 +1,142 @@
+/*
+ * 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.wsrp.consumer.handlers;
+
+import org.apache.commons.httpclient.Cookie;
+import org.gatein.common.io.IOTools;
+import org.gatein.common.net.media.MediaType;
+import org.gatein.common.net.media.SubtypeDef;
+import org.gatein.common.net.media.TypeDef;
+import org.gatein.common.util.MultiValuedPropertyMap;
+import org.gatein.common.util.Tools;
+import org.gatein.pc.api.invocation.response.ResponseProperties;
+import org.gatein.wsrp.WSRPTypeFactory;
+import org.gatein.wsrp.consumer.WSRPConsumerImpl;
+import org.gatein.wsrp.handler.CookieUtil;
+import org.oasis.wsrp.v2.GetResource;
+import org.oasis.wsrp.v2.ResourceContext;
+import org.oasis.wsrp.v2.ResourceResponse;
+
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class DirectResourceServingHandler extends ResourceHandler
+{
+ protected DirectResourceServingHandler(WSRPConsumerImpl consumer)
+ {
+ super(consumer);
+ }
+
+ @Override
+ protected ResourceResponse performRequest(GetResource getResource) throws Exception
+ {
+ // if we perform the request with this handler, that means that the invocation was dispatched this way
+ // and the initiliazation of the request done in ResourceHandler.prepareRequest put the URL in the resource ID
+ String resourceURL = getResource.getResourceParams().getResourceID();
+
+ URL url = new URL(resourceURL);
+ URLConnection urlConnection = url.openConnection();
+ String contentType = urlConnection.getContentType();
+
+ // init ResponseProperties for ContentResponse result
+ Map<String, List<String>> headers = urlConnection.getHeaderFields();
+ ResponseProperties props = new ResponseProperties();
+ MultiValuedPropertyMap<String> transportHeaders = props.getTransportHeaders();
+ for (Map.Entry<String, List<String>> entry : headers.entrySet())
+ {
+ String key = entry.getKey();
+ if (key != null)
+ {
+ List<String> values = entry.getValue();
+ if (values != null)
+ {
+ if (CookieUtil.SET_COOKIE.equals(key))
+ {
+ Cookie[] cookies = CookieUtil.extractCookiesFrom(url, values.toArray(new String[values.size()]));
+ List<javax.servlet.http.Cookie> propCookies = props.getCookies();
+ for (Cookie cookie : cookies)
+ {
+ propCookies.add(CookieUtil.convertFrom(cookie));
+ }
+ }
+ else
+ {
+ for (String value : values)
+ {
+ transportHeaders.addValue(key, value);
+ }
+ }
+ }
+ }
+ }
+
+ int length = urlConnection.getContentLength();
+ // if length is not known, use a default value
+ length = (length > 0 ? length : Tools.DEFAULT_BUFFER_SIZE * 8);
+ byte[] bytes = IOTools.getBytes(urlConnection.getInputStream(), length);
+
+
+ ResourceContext resourceContext;
+ MediaType type = MediaType.create(contentType);
+ if (TypeDef.TEXT.equals(type.getType()))
+ {
+ // determine the charset of the content, if any
+ String charset = "UTF-8";
+ if (contentType != null)
+ {
+ for (String part : contentType.split(";"))
+ {
+ if (part.startsWith("charset="))
+ {
+ charset = part.substring("charset=".length());
+ }
+ }
+ }
+
+ String markup = new String(bytes, charset);
+
+ resourceContext = WSRPTypeFactory.createResourceContext(contentType, markup, null);
+
+ // process markup if needed
+ SubtypeDef subtype = type.getSubtype();
+ if (SubtypeDef.HTML.equals(subtype) || SubtypeDef.CSS.equals(subtype) || SubtypeDef.JAVASCRIPT.equals(subtype) || SubtypeDef.XML.equals(subtype))
+ {
+ resourceContext.setRequiresRewriting(true);
+ }
+ }
+ else
+ {
+ resourceContext = WSRPTypeFactory.createResourceContext(contentType, null, bytes);
+ resourceContext.setRequiresRewriting(false);
+ }
+
+ return WSRPTypeFactory.createResourceResponse(resourceContext);
+ }
+}
Modified: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/InvocationDispatcher.java
===================================================================
--- components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/InvocationDispatcher.java 2010-11-18 11:22:08 UTC (rev 5157)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/InvocationDispatcher.java 2010-11-18 11:55:43 UTC (rev 5158)
@@ -23,13 +23,7 @@
package org.gatein.wsrp.consumer.handlers;
-import org.apache.commons.httpclient.Cookie;
-import org.gatein.common.io.IOTools;
-import org.gatein.common.net.media.MediaType;
-import org.gatein.common.net.media.TypeDef;
-import org.gatein.common.util.MultiValuedPropertyMap;
import org.gatein.common.util.ParameterValidation;
-import org.gatein.common.util.Tools;
import org.gatein.pc.api.PortletInvokerException;
import org.gatein.pc.api.invocation.ActionInvocation;
import org.gatein.pc.api.invocation.EventInvocation;
@@ -37,21 +31,13 @@
import org.gatein.pc.api.invocation.PortletInvocation;
import org.gatein.pc.api.invocation.RenderInvocation;
import org.gatein.pc.api.invocation.ResourceInvocation;
-import org.gatein.pc.api.invocation.response.ContentResponse;
import org.gatein.pc.api.invocation.response.ErrorResponse;
import org.gatein.pc.api.invocation.response.PortletInvocationResponse;
-import org.gatein.pc.api.invocation.response.ResponseProperties;
import org.gatein.wsrp.WSRPResourceURL;
import org.gatein.wsrp.WSRPRewritingConstants;
import org.gatein.wsrp.consumer.WSRPConsumerImpl;
-import org.gatein.wsrp.handler.CookieUtil;
import org.gatein.wsrp.spec.v2.WSRP2RewritingConstants;
-import java.io.IOException;
-import java.net.URL;
-import java.net.URLConnection;
-import java.util.Collections;
-import java.util.List;
import java.util.Map;
/**
@@ -65,6 +51,7 @@
private final ResourceHandler resourceHandler;
private final EventHandler eventHandler;
private final WSRPConsumerImpl consumer;
+ private final DirectResourceServingHandler directResourceHandler;
public InvocationDispatcher(WSRPConsumerImpl consumer)
{
@@ -73,6 +60,7 @@
renderHandler = new RenderHandler(consumer);
resourceHandler = new ResourceHandler(consumer);
eventHandler = new EventHandler(consumer);
+ directResourceHandler = new DirectResourceServingHandler(consumer);
}
public PortletInvocationResponse dispatchAndHandle(PortletInvocation invocation) throws PortletInvokerException
@@ -101,11 +89,16 @@
resourceId = resourceMap.get(WSRP2RewritingConstants.RESOURCE_ID);
resourceURL = resourceMap.get(WSRPRewritingConstants.RESOURCE_URL);
preferOperationAsString = resourceMap.get(WSRP2RewritingConstants.RESOURCE_PREFER_OPERATION);
+
+ // put the values in the invocation so that we don't need to redecode the resource id
+ resourceInvocation.setAttribute(WSRPRewritingConstants.RESOURCE_URL, resourceURL);
+ resourceInvocation.setAttribute(WSRP2RewritingConstants.RESOURCE_ID, resourceId);
+ resourceInvocation.setAttribute(WSRP2RewritingConstants.RESOURCE_PREFER_OPERATION, preferOperationAsString);
}
else
{
// GateIn-specific: WSRP-specific URL parameters might also be put as attributes by UIPortlet when the invocation is created
- resourceId = (String)resourceInvocation.getAttribute(WSRP2RewritingConstants.RESOURCE_ID);
+ resourceId = null;
resourceURL = (String)resourceInvocation.getAttribute(WSRPRewritingConstants.RESOURCE_URL);
preferOperationAsString = (String)resourceInvocation.getAttribute(WSRP2RewritingConstants.RESOURCE_PREFER_OPERATION);
}
@@ -118,7 +111,7 @@
}
else if (resourceURL != null)
{
- return performDirectURLRequest(resourceURL);
+ handler = directResourceHandler;
}
else
{
@@ -136,83 +129,4 @@
return handler.handle(invocation);
}
-
- private PortletInvocationResponse performDirectURLRequest(String resourceURL)
- {
- try
- {
- URL url = new URL(resourceURL);
- URLConnection urlConnection = url.openConnection();
- String contentType = urlConnection.getContentType();
-
- // init ResponseProperties for ContentResponse result
- Map<String, List<String>> headers = urlConnection.getHeaderFields();
- ResponseProperties props = new ResponseProperties();
- MultiValuedPropertyMap<String> transportHeaders = props.getTransportHeaders();
- for (Map.Entry<String, List<String>> entry : headers.entrySet())
- {
- String key = entry.getKey();
- if (key != null)
- {
- List<String> values = entry.getValue();
- if (values != null)
- {
- if (CookieUtil.SET_COOKIE.equals(key))
- {
- Cookie[] cookies = CookieUtil.extractCookiesFrom(url, values.toArray(new String[values.size()]));
- List<javax.servlet.http.Cookie> propCookies = props.getCookies();
- for (Cookie cookie : cookies)
- {
- propCookies.add(CookieUtil.convertFrom(cookie));
- }
- }
- else
- {
- for (String value : values)
- {
- transportHeaders.addValue(key, value);
- }
- }
- }
- }
- }
-
- int length = urlConnection.getContentLength();
- // if length is not known, use a default value
- length = (length > 0 ? length : Tools.DEFAULT_BUFFER_SIZE * 8);
- byte[] bytes = IOTools.getBytes(urlConnection.getInputStream(), length);
-
- ContentResponse result;
- MediaType type = MediaType.create(contentType);
- if (TypeDef.TEXT.equals(type.getType()))
- {
- // determine the charset of the content, if any
- String charset = "UTF-8";
- if (contentType != null)
- {
- for (String part : contentType.split(";"))
- {
- if (part.startsWith("charset="))
- {
- charset = part.substring("charset=".length());
- }
- }
- }
-
- // build a String-based content response
- result = new ContentResponse(props, Collections.<String, Object>emptyMap(), contentType, null, new String(bytes, charset), null);
- }
- else
- {
- // build a byte-based content response
- result = new ContentResponse(props, Collections.<String, Object>emptyMap(), contentType, bytes, null, null);
- }
-
- return result;
- }
- catch (IOException e)
- {
- return new ErrorResponse(e);
- }
- }
}
Modified: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/InvocationHandler.java
===================================================================
--- components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/InvocationHandler.java 2010-11-18 11:22:08 UTC (rev 5157)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/InvocationHandler.java 2010-11-18 11:55:43 UTC (rev 5158)
@@ -145,7 +145,7 @@
if (runtimeContext != null)
{
WindowContext windowContext = invocation.getWindowContext();
- runtimeContext.setNamespacePrefix(getNamespaceFrom(windowContext));
+ runtimeContext.setNamespacePrefix(WSRPTypeFactory.getNamespaceFrom(windowContext));
InstanceContext instanceContext = invocation.getInstanceContext();
runtimeContext.setPortletInstanceKey(instanceContext == null ? null : instanceContext.getId());
@@ -197,16 +197,6 @@
return response;
}
- protected static String getNamespaceFrom(WindowContext windowContext)
- {
- if (windowContext != null)
- {
- return windowContext.getNamespace();
- }
-
- return null;
- }
-
/**
* Deals with common error conditions.
*
@@ -347,13 +337,9 @@
ParameterValidation.throwIllegalArgExceptionIfNull(securityContext, SECURITY_CONTEXT);
String authType = WSRPUtils.convertRequestAuthTypeToWSRPAuthType(securityContext.getAuthType());
- String portletInstanceKey = invocation.getInstanceContext().getId();
- String namespacePrefix = getNamespaceFrom(invocation.getWindowContext());
+ String portletInstanceKey = WSRPTypeFactory.getPortletInstanceKey(invocation.getInstanceContext());
- if (namespacePrefix == null)
- {
- namespacePrefix = getPortletHandle();
- }
+ String namespacePrefix = WSRPTypeFactory.getNamespacePrefix(invocation.getWindowContext(), getPortletHandle());
runtimeContext = WSRPTypeFactory.createRuntimeContext(authType, portletInstanceKey, namespacePrefix);
Modified: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/MimeResponseHandler.java
===================================================================
--- components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/MimeResponseHandler.java 2010-11-18 11:22:08 UTC (rev 5157)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/MimeResponseHandler.java 2010-11-18 11:55:43 UTC (rev 5158)
@@ -24,6 +24,7 @@
package org.gatein.wsrp.consumer.handlers;
import org.gatein.common.text.TextTools;
+import org.gatein.common.util.ParameterValidation;
import org.gatein.pc.api.PortletInvokerException;
import org.gatein.pc.api.URLFormat;
import org.gatein.pc.api.cache.CacheScope;
@@ -36,8 +37,8 @@
import org.gatein.wsrp.WSRPConstants;
import org.gatein.wsrp.WSRPConsumer;
import org.gatein.wsrp.WSRPPortletURL;
-import org.gatein.wsrp.WSRPResourceURL;
import org.gatein.wsrp.WSRPRewritingConstants;
+import org.gatein.wsrp.WSRPTypeFactory;
import org.gatein.wsrp.consumer.ProducerInfo;
import org.gatein.wsrp.consumer.WSRPConsumerImpl;
import org.oasis.wsrp.v2.CacheControl;
@@ -92,13 +93,13 @@
}
}
- if (markup != null && markup.length() > 0)
+ if (!ParameterValidation.isNullOrEmpty(markup))
{
if (Boolean.TRUE.equals(mimeResponse.isRequiresRewriting()))
{
markup = processMarkup(
markup,
- getNamespaceFrom(invocation.getWindowContext()),
+ WSRPTypeFactory.getNamespaceFrom(invocation.getWindowContext()),
invocation.getContext(),
invocation.getTarget(),
new URLFormat(invocation.getSecurityContext().isSecure(), invocation.getSecurityContext().isAuthenticated(), true, true),
@@ -108,7 +109,7 @@
}
String mimeType = mimeResponse.getMimeType();
- if (mimeType == null || mimeType.length() == 0)
+ if (ParameterValidation.isNullOrEmpty(mimeType))
{
return new ErrorResponse(new IllegalArgumentException("No MIME type was provided for portlet content."));
}
@@ -216,19 +217,5 @@
WSRPPortletURL portletURL = WSRPPortletURL.create(match, supportedCustomModes, supportedCustomWindowStates, true);
return context.renderURL(portletURL, format);
}
-
-
- static String getResourceURL(String urlAsString, WSRPResourceURL resource)
- {
- String resourceURL = resource.getResourceURL().toExternalForm();
- if (log.isDebugEnabled())
- {
- log.debug("URL '" + urlAsString + "' refers to a resource which are not currently well supported. " +
- "Attempting to craft a URL that we might be able to work with: '" + resourceURL + "'");
- }
-
- // right now the resourceURL should be output as is, because it will be used directly but it really should be encoded
- return resourceURL;
- }
}
}
Modified: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/ResourceHandler.java
===================================================================
--- components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/ResourceHandler.java 2010-11-18 11:22:08 UTC (rev 5157)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/ResourceHandler.java 2010-11-18 11:55:43 UTC (rev 5158)
@@ -28,7 +28,7 @@
import org.gatein.pc.api.invocation.ResourceInvocation;
import org.gatein.pc.api.spi.InstanceContext;
import org.gatein.pc.api.state.AccessMode;
-import org.gatein.wsrp.WSRPResourceURL;
+import org.gatein.wsrp.WSRPRewritingConstants;
import org.gatein.wsrp.WSRPTypeFactory;
import org.gatein.wsrp.WSRPUtils;
import org.gatein.wsrp.consumer.WSRPConsumerImpl;
@@ -92,10 +92,21 @@
@Override
protected GetResource prepareRequest(RequestPrecursor<ResourceInvocation> requestPrecursor, ResourceInvocation invocation)
{
- String resourceInvocationId = invocation.getResourceId();
+ /*String resourceInvocationId = invocation.getResourceId();
Map<String, String> resourceMap = WSRPResourceURL.decodeResource(resourceInvocationId);
- String resourceId = resourceMap.get(WSRP2RewritingConstants.RESOURCE_ID);
+ String resourceId = resourceMap.get(WSRP2RewritingConstants.RESOURCE_ID);*/
+ // get the resource id from the invocation attributes so that we don't need to redecode the original encoded resource id
+ String resourceId = (String)invocation.getAttribute(WSRP2RewritingConstants.RESOURCE_ID);
+
+ // if we didn't get a resource id, that means we need to use a resource URL, so get it and use it as the resource id
+ // note that the InvocationDispatcher should properly handle which handler will be used so this should be safe
+ // if we had a resource id anyway but are using WSRP 1, we need to reset it to use the URL instead
+ if (resourceId == null || !consumer.isUsingWSRP2())
+ {
+ resourceId = (String)invocation.getAttribute(WSRPRewritingConstants.RESOURCE_URL);
+ }
+
PortletContext portletContext = requestPrecursor.getPortletContext();
// since we actually extracted the data into MarkupParams in the RequestPrecursor, use that! :)
Modified: components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/handlers/processors/WSRPPortletInvocationContext.java
===================================================================
--- components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/handlers/processors/WSRPPortletInvocationContext.java 2010-11-18 11:22:08 UTC (rev 5157)
+++ components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/handlers/processors/WSRPPortletInvocationContext.java 2010-11-18 11:55:43 UTC (rev 5158)
@@ -36,8 +36,11 @@
import org.gatein.pc.portlet.impl.spi.AbstractClientContext;
import org.gatein.pc.portlet.impl.spi.AbstractPortletInvocationContext;
import org.gatein.pc.portlet.impl.spi.AbstractServerContext;
+import org.gatein.registration.Registration;
+import org.gatein.registration.RegistrationLocal;
import org.gatein.wsrp.WSRPPortletURL;
import org.gatein.wsrp.WSRPRewritingConstants;
+import org.gatein.wsrp.WSRPTypeFactory;
import org.gatein.wsrp.WSRPUtils;
import org.gatein.wsrp.servlet.ServletAccess;
@@ -131,7 +134,18 @@
{
Boolean wantSecureBool = urlFormat.getWantSecure();
boolean wantSecure = (wantSecureBool != null ? wantSecureBool : false);
- WSRPPortletURL url = WSRPPortletURL.create(containerURL, wantSecure);
+ WSRPPortletURL.URLContext context = new WSRPPortletURL.URLContext(WSRPPortletURL.URLContext.SERVER_ADDRESS,
+ URLTools.getServerAddressFrom(request), WSRPPortletURL.URLContext.PORTLET_CONTEXT, instanceContext.getPortletContext());
+
+ Registration registration = RegistrationLocal.getRegistration();
+ if (registration != null)
+ {
+ context.setValueFor(WSRPPortletURL.URLContext.REGISTRATION_HANDLE, registration.getRegistrationHandle());
+ }
+ context.setValueFor(WSRPPortletURL.URLContext.INSTANCE_KEY, WSRPTypeFactory.getPortletInstanceKey(instanceContext));
+ context.setValueFor(WSRPPortletURL.URLContext.NAMESPACE, WSRPTypeFactory.getNamespacePrefix(windowContext, instanceContext.getPortletContext().getId()));
+
+ WSRPPortletURL url = WSRPPortletURL.create(containerURL, wantSecure, context);
return url.toString();
}
return null;
Added: components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/resources/ResourceServingServlet.java
===================================================================
--- components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/resources/ResourceServingServlet.java (rev 0)
+++ components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/resources/ResourceServingServlet.java 2010-11-18 11:55:43 UTC (rev 5158)
@@ -0,0 +1,78 @@
+/*
+ * 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.wsrp.producer.resources;
+
+import org.gatein.common.util.ParameterValidation;
+import org.gatein.wsrp.ResourceServingUtil;
+import org.gatein.wsrp.producer.ProducerHolder;
+import org.gatein.wsrp.producer.v2.WSRP2Producer;
+import org.oasis.wsrp.v2.GetResource;
+import org.oasis.wsrp.v2.ResourceContext;
+import org.oasis.wsrp.v2.ResourceResponse;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class ResourceServingServlet extends HttpServlet
+{
+ @Override
+ protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
+ {
+ WSRP2Producer producer = ProducerHolder.getProducer();
+
+ GetResource getResource = ResourceServingUtil.decode(req);
+
+ try
+ {
+ ResourceResponse resource = producer.getResource(getResource);
+ ResourceContext resourceContext = resource.getResourceContext();
+ byte[] itemBinary = resourceContext.getItemBinary();
+ String itemString = resourceContext.getItemString();
+
+ resp.setContentType(resourceContext.getMimeType());
+
+ if (itemBinary != null && itemBinary.length > 0)
+ {
+ resp.getOutputStream().write(itemBinary);
+ }
+
+ if (!ParameterValidation.isNullOrEmpty(itemString))
+ {
+ resp.getWriter().write(itemString);
+ }
+ }
+ catch (Exception exception)
+ {
+ throw new ServletException("Couldn't get resource " + getResource.getResourceParams().getResourceID()
+ + " for portlet " + getResource.getPortletContext(), exception);
+ }
+ }
+}
Modified: components/wsrp/trunk/wsrp-producer-war/src/main/webapp/WEB-INF/web.xml
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/main/webapp/WEB-INF/web.xml 2010-11-18 11:22:08 UTC (rev 5157)
+++ components/wsrp/trunk/wsrp-producer-war/src/main/webapp/WEB-INF/web.xml 2010-11-18 11:55:43 UTC (rev 5158)
@@ -54,7 +54,18 @@
<load-on-startup>1</load-on-startup>
</servlet>-->
+ <!-- Resource serving -->
+ <servlet>
+ <servlet-name>ResourceService</servlet-name>
+ <servlet-class>org.gatein.wsrp.producer.resources.ResourceServingServlet</servlet-class>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>ResourceService</servlet-name>
+ <url-pattern>/resource/*</url-pattern>
+ </servlet-mapping>
+
+
<!-- WSRP 2 Endpoints -->
<servlet>
<servlet-name>V2ServiceDescriptionService</servlet-name>
15 years, 5 months
gatein SVN: r5157 - exo/portal/branches/3.1.x/webui/core/src/main/java/org/exoplatform/webui/application.
by do-not-reply@jboss.org
Author: hoang_to
Date: 2010-11-18 06:22:08 -0500 (Thu, 18 Nov 2010)
New Revision: 5157
Modified:
exo/portal/branches/3.1.x/webui/core/src/main/java/org/exoplatform/webui/application/ConfigurationManager.java
Log:
EXOGTN-129: Apply updated patch
Modified: exo/portal/branches/3.1.x/webui/core/src/main/java/org/exoplatform/webui/application/ConfigurationManager.java
===================================================================
--- exo/portal/branches/3.1.x/webui/core/src/main/java/org/exoplatform/webui/application/ConfigurationManager.java 2010-11-18 10:48:25 UTC (rev 5156)
+++ exo/portal/branches/3.1.x/webui/core/src/main/java/org/exoplatform/webui/application/ConfigurationManager.java 2010-11-18 11:22:08 UTC (rev 5157)
@@ -19,6 +19,14 @@
package org.exoplatform.webui.application;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
import org.exoplatform.webui.config.Component;
import org.exoplatform.webui.config.ComponentHandle;
import org.exoplatform.webui.config.Event;
@@ -40,14 +48,6 @@
import org.jibx.runtime.IBindingFactory;
import org.jibx.runtime.IUnmarshallingContext;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
/**
* May 10, 2006
* <p/>
@@ -57,7 +57,7 @@
*/
public class ConfigurationManager
{
- private volatile Map<String, Component> configs_ = new HashMap<String, Component>();
+ private final Map<String, Component> configs_ = new ConcurrentHashMap<String, Component>();
/** The logger. */
private final Logger log;
@@ -108,14 +108,12 @@
*
* @param configs An array of Component
*/
- synchronized void setComponentConfigs(Component[] configs)
+ void setComponentConfigs(Component[] configs)
{
- Map<String, Component> tmpConfigs = new HashMap<String, Component>(configs_);
for (Component component : configs)
{
- tmpConfigs.put(component.getKey(), component);
+ configs_.put(component.getKey(), component);
}
- this.configs_ = tmpConfigs;
}
/**
15 years, 5 months
gatein SVN: r5156 - portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium.
by do-not-reply@jboss.org
Author: hangnguyen
Date: 2010-11-18 05:48:25 -0500 (Thu, 18 Nov 2010)
New Revision: 5156
Modified:
portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_PRL_03_04_002_DeleteGroupWithoutConfirmation.html
Log:
TestVN-356:Clean and Improve existing Selenium for GateIn
Modified: portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_PRL_03_04_002_DeleteGroupWithoutConfirmation.html
===================================================================
--- portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_PRL_03_04_002_DeleteGroupWithoutConfirmation.html 2010-11-18 10:48:11 UTC (rev 5155)
+++ portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_PRL_03_04_002_DeleteGroupWithoutConfirmation.html 2010-11-18 10:48:25 UTC (rev 5156)
@@ -127,6 +127,11 @@
<td></td>
</tr>
<tr>
+ <td>chooseCancelOnNextConfirmation</td>
+ <td></td>
+ <td></td>
+</tr>
+<tr>
<td>waitForElementPresent</td>
<td>//div[@id='UIOrganizationPortlet']/div[2]/div[2]/div[1]/div[2]/div[1]/div[1]/a[1]</td>
<td></td>
@@ -137,11 +142,6 @@
<td></td>
</tr>
<tr>
- <td>chooseCancelOnNextConfirmation</td>
- <td></td>
- <td></td>
-</tr>
-<tr>
<td>assertConfirmation</td>
<td>Are you sure you want to delete this group?</td>
<td></td>
15 years, 5 months
gatein SVN: r5155 - exo/portal/branches/3.1.x/component/resources/src/main/java/org/exoplatform/services/resources/impl.
by do-not-reply@jboss.org
Author: hoang_to
Date: 2010-11-18 05:48:11 -0500 (Thu, 18 Nov 2010)
New Revision: 5155
Modified:
exo/portal/branches/3.1.x/component/resources/src/main/java/org/exoplatform/services/resources/impl/BaseResourceBundleService.java
Log:
EXOGTN-131: Apply updated patch
Modified: exo/portal/branches/3.1.x/component/resources/src/main/java/org/exoplatform/services/resources/impl/BaseResourceBundleService.java
===================================================================
--- exo/portal/branches/3.1.x/component/resources/src/main/java/org/exoplatform/services/resources/impl/BaseResourceBundleService.java 2010-11-18 10:45:34 UTC (rev 5154)
+++ exo/portal/branches/3.1.x/component/resources/src/main/java/org/exoplatform/services/resources/impl/BaseResourceBundleService.java 2010-11-18 10:48:11 UTC (rev 5155)
@@ -395,6 +395,15 @@
id = name + "_" + locale.getLanguage();
}
+ boolean isClasspathResource = isClasspathResource(name);
+ boolean isCacheable = !isClasspathResource || !PropertyManager.isDevelopping();
+
+ if(isClasspathResource)
+ {
+ //Avoid naming collision
+ id += "_" + cl.toString();
+ }
+
try
{
ResourceBundle rb = cache_.get(id);
@@ -408,11 +417,11 @@
}
// Case 1: ResourceBundle of portlets, standard java API is used
- if (isClasspathResource(name))
+ if (isClasspathResource)
{
ResourceBundle res = ResourceBundleLoader.load(name, locale, cl);
//Cache classpath resource bundle while running portal in non-dev mode
- if(!PropertyManager.isDevelopping())
+ if(isCacheable)
cache_.put(id, res);
return res;
}
15 years, 5 months
gatein SVN: r5154 - portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium.
by do-not-reply@jboss.org
Author: hangnguyen
Date: 2010-11-18 05:45:34 -0500 (Thu, 18 Nov 2010)
New Revision: 5154
Modified:
portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_PRL_03_03_007_EditDescriptionOfGroupWithOverMaxLength.html
portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_PRL_03_04_003_DeleteGroupWithoutSelectingGroup.html
portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_PRL_03_04_007_CheckExistingOfDeletedGroupNavigation.html
portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_PRL_03_04_008_DeleteGroupWhenItIsBeingUsedByHimself.html
portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_PRL_03_04_010_DeleteGroupWhichIsMandatory.html
portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_PRL_03_05_001_AdduserIntoGroupWithoutSpecifyAnyone.html
portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_PRL_03_05_002_AddUnAvaibaleUserIntoGroup.html
portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_PRL_03_05_006_AddUserIntoGroupWithTheSameExitingRole.html
portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_PRL_03_05_007_AddDuplicateUserIntoAgroupWithTheSameRole.html
portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_PRL_03_05_010_AddUserIntoGroupWIthoutSelectCheckboxUserInSelectUserForm.html
portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_PRL_03_05_012_AddSomeUsersIntoGroupInCaseAfterCommaHasSpace.html
portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_PRL_03_06_002_EditMembershipWithExisting.html
portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_PRL_03_07_004_CheckShowGroupPageListAfterUserWasRemovedFromGroupWith1Role.html
portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_PRL_03_07_005_CheckEditMembershipOfUserWhichRemvoedFromGroup.html
Log:
TestVN-356:Clean and Improve existing Selenium for GateIn
Modified: portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_PRL_03_03_007_EditDescriptionOfGroupWithOverMaxLength.html
===================================================================
--- portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_PRL_03_03_007_EditDescriptionOfGroupWithOverMaxLength.html 2010-11-18 10:31:44 UTC (rev 5153)
+++ portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_PRL_03_03_007_EditDescriptionOfGroupWithOverMaxLength.html 2010-11-18 10:45:34 UTC (rev 5154)
@@ -142,23 +142,23 @@
<td></td>
</tr>
<tr>
- <td>waitForElementPresent</td>
- <td>//div[2]/div[2]/div/div/div/div/div[2]</td>
+ <td>waitForTextPresent</td>
<td>The length of the text in field "Description" must be between "0" and "255" characters.</td>
+ <td></td>
</tr>
<tr>
- <td>verifyText</td>
- <td>//div[2]/div[2]/div/div/div/div/div[2]</td>
+ <td>verifyTextPresent</td>
<td>The length of the text in field "Description" must be between "0" and "255" characters.</td>
+ <td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
- <td>//div[2]/div[2]/div/div[2]/div/div/div/div/div/div[3]/div/table/tbody/tr/td/div/div/div/div/a</td>
+ <td>//div[3]/div/div[2]/div/div/div/div/div/div[3]/div/table/tbody/tr/td/div/div/div/div/a</td>
<td></td>
</tr>
<tr>
<td>click</td>
- <td>//div[2]/div[2]/div/div[2]/div/div/div/div/div/div[3]/div/table/tbody/tr/td/div/div/div/div/a</td>
+ <td>//div[3]/div/div[2]/div/div/div/div/div/div[3]/div/table/tbody/tr/td/div/div/div/div/a</td>
<td></td>
</tr>
<tr>
Modified: portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_PRL_03_04_003_DeleteGroupWithoutSelectingGroup.html
===================================================================
--- portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_PRL_03_04_003_DeleteGroupWithoutSelectingGroup.html 2010-11-18 10:31:44 UTC (rev 5153)
+++ portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_PRL_03_04_003_DeleteGroupWithoutSelectingGroup.html 2010-11-18 10:45:34 UTC (rev 5154)
@@ -98,25 +98,30 @@
</tr>
<tr>
<td>waitForTextPresent</td>
- <td>You must select a group. </td>
+ <td>You must select a group.</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
- <td>You must select a group. </td>
+ <td>You must select a group.</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
- <td>//div[2]/div[2]/div/div[2]/div/div/div/div/div/div[3]/div/table/tbody/tr/td/div/div/div/div/a</td>
+ <td>//div[3]/div/div[2]/div/div/div/div/div/div[3]/div/table/tbody/tr/td/div/div/div/div/a</td>
<td></td>
</tr>
<tr>
<td>click</td>
- <td>//div[2]/div[2]/div/div[2]/div/div/div/div/div/div[3]/div/table/tbody/tr/td/div/div/div/div/a</td>
+ <td>//div[3]/div/div[2]/div/div/div/div/div/div[3]/div/table/tbody/tr/td/div/div/div/div/a</td>
<td></td>
</tr>
<tr>
+ <td>waitForElementPresent</td>
+ <td>link=Sign out</td>
+ <td></td>
+</tr>
+<tr>
<td>clickAndWait</td>
<td>link=Sign out</td>
<td></td>
Modified: portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_PRL_03_04_007_CheckExistingOfDeletedGroupNavigation.html
===================================================================
--- portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_PRL_03_04_007_CheckExistingOfDeletedGroupNavigation.html 2010-11-18 10:31:44 UTC (rev 5153)
+++ portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_PRL_03_04_007_CheckExistingOfDeletedGroupNavigation.html 2010-11-18 10:45:34 UTC (rev 5154)
@@ -118,12 +118,12 @@
</tr>
<tr>
<td>waitForElementPresent</td>
- <td>//div[3]/div/div/div[1]/div/div/div/div/div/div/div/div[2]/div/div[2]/div/div/div/div/div/div[3]/div/table/tbody/tr/td/div/div/div/div/a</td>
+ <td>//div[3]/div/div[2]/div/div/div/div/div/div[3]/div/table/tbody/tr/td/div/div/div/div/a</td>
<td></td>
</tr>
<tr>
<td>click</td>
- <td>//div[3]/div/div/div[1]/div/div/div/div/div/div/div/div[2]/div/div[2]/div/div/div/div/div/div[3]/div/table/tbody/tr/td/div/div/div/div/a</td>
+ <td>//div[3]/div/div[2]/div/div/div/div/div/div[3]/div/table/tbody/tr/td/div/div/div/div/a</td>
<td></td>
</tr>
<tr>
@@ -137,6 +137,21 @@
<td></td>
</tr>
<tr>
+ <td>clickAndWait</td>
+ <td>link=Users and groups management</td>
+ <td></td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>link=Users and groups management</td>
+ <td></td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>link=Users and groups management</td>
+ <td></td>
+</tr>
+<tr>
<td>echo</td>
<td>-- Choose group management --</td>
<td></td>
@@ -527,26 +542,6 @@
<td></td>
</tr>
<tr>
- <td>waitForTextPresent</td>
- <td>No result found.</td>
- <td></td>
-</tr>
-<tr>
- <td>verifyTextPresent</td>
- <td>No result found.</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForElementPresent</td>
- <td>//div[4]/div/div[2]/div/div/div/div/div/div[3]/div/table/tbody/tr/td/div/div/div/div/a</td>
- <td></td>
-</tr>
-<tr>
- <td>click</td>
- <td>//div[4]/div/div[2]/div/div/div/div/div/div[3]/div/table/tbody/tr/td/div/div/div/div/a</td>
- <td></td>
-</tr>
-<tr>
<td>clickAndWait</td>
<td>link=Sign out</td>
<td></td>
Modified: portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_PRL_03_04_008_DeleteGroupWhenItIsBeingUsedByHimself.html
===================================================================
--- portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_PRL_03_04_008_DeleteGroupWhenItIsBeingUsedByHimself.html 2010-11-18 10:31:44 UTC (rev 5153)
+++ portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_PRL_03_04_008_DeleteGroupWhenItIsBeingUsedByHimself.html 2010-11-18 10:45:34 UTC (rev 5154)
@@ -163,12 +163,12 @@
</tr>
<tr>
<td>waitForElementPresent</td>
- <td>//div[2]/div[2]/div/div[2]/div/div/div/div/div/div[3]/div/table/tbody/tr/td/div/div/div/div</td>
+ <td>//div[3]/div/div[2]/div/div/div/div/div/div[3]/div/table/tbody/tr/td/div/div/div/div/a</td>
<td></td>
</tr>
<tr>
<td>click</td>
- <td>//div[2]/div[2]/div/div[2]/div/div/div/div/div/div[3]/div/table/tbody/tr/td/div/div/div/div</td>
+ <td>//div[3]/div/div[2]/div/div/div/div/div/div[3]/div/table/tbody/tr/td/div/div/div/div/a</td>
<td></td>
</tr>
<tr>
Modified: portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_PRL_03_04_010_DeleteGroupWhichIsMandatory.html
===================================================================
--- portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_PRL_03_04_010_DeleteGroupWhichIsMandatory.html 2010-11-18 10:31:44 UTC (rev 5153)
+++ portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_PRL_03_04_010_DeleteGroupWhichIsMandatory.html 2010-11-18 10:45:34 UTC (rev 5154)
@@ -92,23 +92,23 @@
<td></td>
</tr>
<tr>
- <td>waitForElementPresent</td>
- <td>//div[3]/div/div/div/div/div[2]</td>
+ <td>waitForTextPresent</td>
<td>You can't delete this group because it (or its child) is mandatory.</td>
+ <td></td>
</tr>
<tr>
- <td>verifyText</td>
- <td>//div[3]/div/div/div/div/div[2]</td>
+ <td>verifyTextPresent</td>
<td>You can't delete this group because it (or its child) is mandatory.</td>
+ <td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
- <td>//div[2]/div[2]/div/div[2]/div/div/div/div/div/div[3]/div/table/tbody/tr/td/div/div/div/div/a</td>
+ <td>//div[3]/div/div[2]/div/div/div/div/div/div[3]/div/table/tbody/tr/td/div/div/div/div</td>
<td></td>
</tr>
<tr>
<td>click</td>
- <td>//div[2]/div[2]/div/div[2]/div/div/div/div/div/div[3]/div/table/tbody/tr/td/div/div/div/div/a</td>
+ <td>//div[3]/div/div[2]/div/div/div/div/div/div[3]/div/table/tbody/tr/td/div/div/div/div</td>
<td></td>
</tr>
<tr>
@@ -117,7 +117,7 @@
<td></td>
</tr>
<tr>
- <td>click</td>
+ <td>clickAndWait</td>
<td>link=Sign out</td>
<td></td>
</tr>
Modified: portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_PRL_03_05_001_AdduserIntoGroupWithoutSpecifyAnyone.html
===================================================================
--- portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_PRL_03_05_001_AdduserIntoGroupWithoutSpecifyAnyone.html 2010-11-18 10:31:44 UTC (rev 5153)
+++ portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_PRL_03_05_001_AdduserIntoGroupWithoutSpecifyAnyone.html 2010-11-18 10:45:34 UTC (rev 5154)
@@ -108,25 +108,30 @@
</tr>
<tr>
<td>waitForTextPresent</td>
- <td>The field "User Name" is required. </td>
+ <td>The field "User Name" is required.</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
- <td>The field "User Name" is required. </td>
+ <td>The field "User Name" is required.</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
- <td>//div[2]/div[2]/div/div[2]/div/div/div/div/div/div[3]/div/table/tbody/tr/td/div/div/div/div/a</td>
+ <td>//div[3]/div/div[2]/div/div/div/div/div/div[3]/div/table/tbody/tr/td/div/div/div/div/a</td>
<td></td>
</tr>
<tr>
<td>click</td>
- <td>//div[2]/div[2]/div/div[2]/div/div/div/div/div/div[3]/div/table/tbody/tr/td/div/div/div/div/a</td>
+ <td>//div[3]/div/div[2]/div/div/div/div/div/div[3]/div/table/tbody/tr/td/div/div/div/div/a</td>
<td></td>
</tr>
<tr>
+ <td>waitForElementPresent</td>
+ <td>link=Sign out</td>
+ <td></td>
+</tr>
+<tr>
<td>clickAndWait</td>
<td>link=Sign out</td>
<td></td>
Modified: portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_PRL_03_05_002_AddUnAvaibaleUserIntoGroup.html
===================================================================
--- portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_PRL_03_05_002_AddUnAvaibaleUserIntoGroup.html 2010-11-18 10:31:44 UTC (rev 5153)
+++ portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_PRL_03_05_002_AddUnAvaibaleUserIntoGroup.html 2010-11-18 10:45:34 UTC (rev 5154)
@@ -103,12 +103,12 @@
</tr>
<tr>
<td>waitForElementPresent</td>
- <td>//div[2]/div[2]/div/div[2]/div/div/div/div/div/div[3]/div/table/tbody/tr/td/div/div/div/div/a</td>
+ <td>//div[3]/div/div[2]/div/div/div/div/div/div[3]/div/table/tbody/tr/td/div/div/div/div/a</td>
<td></td>
</tr>
<tr>
<td>click</td>
- <td>//div[2]/div[2]/div/div[2]/div/div/div/div/div/div[3]/div/table/tbody/tr/td/div/div/div/div/a</td>
+ <td>//div[3]/div/div[2]/div/div/div/div/div/div[3]/div/table/tbody/tr/td/div/div/div/div/a</td>
<td></td>
</tr>
<tr>
Modified: portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_PRL_03_05_006_AddUserIntoGroupWithTheSameExitingRole.html
===================================================================
--- portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_PRL_03_05_006_AddUserIntoGroupWithTheSameExitingRole.html 2010-11-18 10:31:44 UTC (rev 5153)
+++ portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_PRL_03_05_006_AddUserIntoGroupWithTheSameExitingRole.html 2010-11-18 10:45:34 UTC (rev 5154)
@@ -158,22 +158,22 @@
</tr>
<tr>
<td>waitForTextPresent</td>
- <td>User "root" has already the same membership in the group "customers", please select an other membership. </td>
+ <td>User "root" has already the same membership in the group "customers", please select an other membership.</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
- <td>User "root" has already the same membership in the group "customers", please select an other membership. </td>
+ <td>User "root" has already the same membership in the group "customers", please select an other membership.</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
- <td>//div[2]/div[2]/div/div[2]/div/div/div/div/div/div[3]/div/table/tbody/tr/td/div/div/div/div/a</td>
+ <td>//div[3]/div/div[2]/div/div/div/div/div/div[3]/div/table/tbody/tr/td/div/div/div/div/a</td>
<td></td>
</tr>
<tr>
<td>click</td>
- <td>//div[2]/div[2]/div/div[2]/div/div/div/div/div/div[3]/div/table/tbody/tr/td/div/div/div/div/a</td>
+ <td>//div[3]/div/div[2]/div/div/div/div/div/div[3]/div/table/tbody/tr/td/div/div/div/div/a</td>
<td></td>
</tr>
<tr>
Modified: portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_PRL_03_05_007_AddDuplicateUserIntoAgroupWithTheSameRole.html
===================================================================
--- portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_PRL_03_05_007_AddDuplicateUserIntoAgroupWithTheSameRole.html 2010-11-18 10:31:44 UTC (rev 5153)
+++ portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_PRL_03_05_007_AddDuplicateUserIntoAgroupWithTheSameRole.html 2010-11-18 10:45:34 UTC (rev 5154)
@@ -118,22 +118,22 @@
</tr>
<tr>
<td>waitForTextPresent</td>
- <td>Some users is duplicated. Please re-check it! </td>
+ <td>Some users is duplicated. Please re-check it!</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
- <td>Some users is duplicated. Please re-check it! </td>
+ <td>Some users is duplicated. Please re-check it!</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
- <td>//div[2]/div[2]/div/div[2]/div/div/div/div/div/div[3]/div/table/tbody/tr/td/div/div/div/div</td>
+ <td>//div[3]/div/div[2]/div/div/div/div/div/div[3]/div/table/tbody/tr/td/div/div/div/div/a</td>
<td></td>
</tr>
<tr>
<td>click</td>
- <td>//div[2]/div[2]/div/div[2]/div/div/div/div/div/div[3]/div/table/tbody/tr/td/div/div/div/div</td>
+ <td>//div[3]/div/div[2]/div/div/div/div/div/div[3]/div/table/tbody/tr/td/div/div/div/div/a</td>
<td></td>
</tr>
<tr>
@@ -141,11 +141,6 @@
<td>link=Sign out</td>
<td></td>
</tr>
-<tr>
- <td>close</td>
- <td></td>
- <td></td>
-</tr>
</tbody></table>
</body>
Modified: portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_PRL_03_05_010_AddUserIntoGroupWIthoutSelectCheckboxUserInSelectUserForm.html
===================================================================
--- portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_PRL_03_05_010_AddUserIntoGroupWIthoutSelectCheckboxUserInSelectUserForm.html 2010-11-18 10:31:44 UTC (rev 5153)
+++ portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_PRL_03_05_010_AddUserIntoGroupWIthoutSelectCheckboxUserInSelectUserForm.html 2010-11-18 10:45:34 UTC (rev 5154)
@@ -113,22 +113,22 @@
</tr>
<tr>
<td>verifyTextPresent</td>
- <td>Please check at least one user. </td>
+ <td>Please check at least one user.</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
- <td>Please check at least one user. </td>
+ <td>Please check at least one user.</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
- <td>//div[2]/div[2]/div/div[2]/div/div/div/div/div/div[3]/div/table/tbody/tr/td/div/div/div/div/a</td>
+ <td>//div[3]/div/div[2]/div/div/div/div/div/div[3]/div/table/tbody/tr/td/div/div/div/div</td>
<td></td>
</tr>
<tr>
<td>click</td>
- <td>//div[2]/div[2]/div/div[2]/div/div/div/div/div/div[3]/div/table/tbody/tr/td/div/div/div/div/a</td>
+ <td>//div[3]/div/div[2]/div/div/div/div/div/div[3]/div/table/tbody/tr/td/div/div/div/div</td>
<td></td>
</tr>
<tr>
Modified: portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_PRL_03_05_012_AddSomeUsersIntoGroupInCaseAfterCommaHasSpace.html
===================================================================
--- portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_PRL_03_05_012_AddSomeUsersIntoGroupInCaseAfterCommaHasSpace.html 2010-11-18 10:31:44 UTC (rev 5153)
+++ portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_PRL_03_05_012_AddSomeUsersIntoGroupInCaseAfterCommaHasSpace.html 2010-11-18 10:45:34 UTC (rev 5154)
@@ -112,12 +112,12 @@
<td>label=validator</td>
</tr>
<tr>
- <td>mouseOver</td>
+ <td>waitForElementPresent</td>
<td>link=Save</td>
<td></td>
</tr>
<tr>
- <td>waitForElementPresent</td>
+ <td>click</td>
<td>link=Save</td>
<td></td>
</tr>
Modified: portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_PRL_03_06_002_EditMembershipWithExisting.html
===================================================================
--- portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_PRL_03_06_002_EditMembershipWithExisting.html 2010-11-18 10:31:44 UTC (rev 5153)
+++ portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_PRL_03_06_002_EditMembershipWithExisting.html 2010-11-18 10:45:34 UTC (rev 5154)
@@ -143,22 +143,22 @@
</tr>
<tr>
<td>waitForTextPresent</td>
- <td>"Membership type already exists, please enter another one. </td>
+ <td>"Membership type already exists, please enter another one.</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
- <td>"Membership type already exists, please enter another one. </td>
+ <td>"Membership type already exists, please enter another one.</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
- <td>//div[2]/div[2]/div/div[2]/div/div/div/div/div/div[3]/div/table/tbody/tr/td/div/div/div/div/a</td>
+ <td>//div[3]/div/div[2]/div/div/div/div/div/div[3]/div/table/tbody/tr/td/div/div/div/div</td>
<td></td>
</tr>
<tr>
<td>click</td>
- <td>//div[2]/div[2]/div/div[2]/div/div/div/div/div/div[3]/div/table/tbody/tr/td/div/div/div/div/a</td>
+ <td>//div[3]/div/div[2]/div/div/div/div/div/div[3]/div/table/tbody/tr/td/div/div/div/div</td>
<td></td>
</tr>
<tr>
Modified: portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_PRL_03_07_004_CheckShowGroupPageListAfterUserWasRemovedFromGroupWith1Role.html
===================================================================
--- portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_PRL_03_07_004_CheckShowGroupPageListAfterUserWasRemovedFromGroupWith1Role.html 2010-11-18 10:31:44 UTC (rev 5153)
+++ portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_PRL_03_07_004_CheckShowGroupPageListAfterUserWasRemovedFromGroupWith1Role.html 2010-11-18 10:45:34 UTC (rev 5154)
@@ -108,22 +108,22 @@
</tr>
<tr>
<td>verifyTextPresent</td>
- <td>You have registered a new account. </td>
+ <td>You have registered a new account.</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
- <td>You have registered a new account. </td>
+ <td>You have registered a new account.</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
- <td>//div[3]/div/div/div[1]/div/div/div/div/div/div/div/div[2]/div/div[2]/div/div/div/div/div/div[3]/div/table/tbody/tr/td/div/div/div/div</td>
+ <td>//div[3]/div/div[2]/div/div/div/div/div/div[3]/div/table/tbody/tr/td/div/div/div/div/a</td>
<td></td>
</tr>
<tr>
<td>click</td>
- <td>//div[3]/div/div/div[1]/div/div/div/div/div/div/div/div[2]/div/div[2]/div/div/div/div/div/div[3]/div/table/tbody/tr/td/div/div/div/div</td>
+ <td>//div[3]/div/div[2]/div/div/div/div/div/div[3]/div/table/tbody/tr/td/div/div/div/div/a</td>
<td></td>
</tr>
<tr>
@@ -347,6 +347,11 @@
<td></td>
</tr>
<tr>
+ <td>waitForElementPresent</td>
+ <td>//div[@id='UIPageEditor']/div[1]/div/div/div/a[2]</td>
+ <td></td>
+</tr>
+<tr>
<td>clickAndWait</td>
<td>//div[@id='UIPageEditor']/div[1]/div/div/div/a[2]</td>
<td></td>
Modified: portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_PRL_03_07_005_CheckEditMembershipOfUserWhichRemvoedFromGroup.html
===================================================================
--- portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_PRL_03_07_005_CheckEditMembershipOfUserWhichRemvoedFromGroup.html 2010-11-18 10:31:44 UTC (rev 5153)
+++ portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_PRL_03_07_005_CheckEditMembershipOfUserWhichRemvoedFromGroup.html 2010-11-18 10:45:34 UTC (rev 5154)
@@ -158,25 +158,30 @@
</tr>
<tr>
<td>waitForTextPresent</td>
- <td>Can't save, membership removed!. </td>
+ <td>Can't save, membership removed!.</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
- <td>Can't save, membership removed!. </td>
+ <td>Can't save, membership removed!.</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
- <td>//div[2]/div[2]/div/div[2]/div/div/div/div/div/div[3]/div/table/tbody/tr/td/div/div/div/div/a</td>
+ <td>//div[3]/div/div[2]/div/div/div/div/div/div[3]/div/table/tbody/tr/td/div/div/div/div</td>
<td></td>
</tr>
<tr>
<td>click</td>
- <td>//div[2]/div[2]/div/div[2]/div/div/div/div/div/div[3]/div/table/tbody/tr/td/div/div/div/div/a</td>
+ <td>//div[3]/div/div[2]/div/div/div/div/div/div[3]/div/table/tbody/tr/td/div/div/div/div</td>
<td></td>
</tr>
<tr>
+ <td>waitForElementPresent</td>
+ <td>link=Sign out</td>
+ <td></td>
+</tr>
+<tr>
<td>clickAndWait</td>
<td>link=Sign out</td>
<td></td>
15 years, 5 months
gatein SVN: r5153 - exo/portal/branches/3.1.x/component/web/src/main/java/org/exoplatform/upload.
by do-not-reply@jboss.org
Author: phuong_vu
Date: 2010-11-18 05:31:44 -0500 (Thu, 18 Nov 2010)
New Revision: 5153
Modified:
exo/portal/branches/3.1.x/component/web/src/main/java/org/exoplatform/upload/UploadService.java
Log:
EXOGTN-174 IE7: name of uploaded file is its local path.
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-18 09:31:56 UTC (rev 5152)
+++ exo/portal/branches/3.1.x/component/web/src/main/java/org/exoplatform/upload/UploadService.java 2010-11-18 10:31:44 UTC (rev 5153)
@@ -111,6 +111,9 @@
DiskFileItem fileItem = (DiskFileItem)itemList.get(0);
String fileName = fileItem.getName();
+ if (fileName == null)
+ fileName = uploadId;
+ fileName = fileName.substring(fileName.lastIndexOf('\\') + 1);
String storeLocation = uploadLocation_ + "/" + uploadId + "." + fileName;
// commons-fileupload will store the temp file with name *.tmp
15 years, 5 months
gatein SVN: r5152 - portal/branches/branch-GTNPORTAL-1643/component/web/security/src/main/java/org/exoplatform/web/login.
by do-not-reply@jboss.org
Author: hoang_to
Date: 2010-11-18 04:31:56 -0500 (Thu, 18 Nov 2010)
New Revision: 5152
Modified:
portal/branches/branch-GTNPORTAL-1643/component/web/security/src/main/java/org/exoplatform/web/login/PortalLoginController.java
Log:
Remove silly if check
Modified: portal/branches/branch-GTNPORTAL-1643/component/web/security/src/main/java/org/exoplatform/web/login/PortalLoginController.java
===================================================================
--- portal/branches/branch-GTNPORTAL-1643/component/web/security/src/main/java/org/exoplatform/web/login/PortalLoginController.java 2010-11-18 09:05:54 UTC (rev 5151)
+++ portal/branches/branch-GTNPORTAL-1643/component/web/security/src/main/java/org/exoplatform/web/login/PortalLoginController.java 2010-11-18 09:31:56 UTC (rev 5152)
@@ -85,20 +85,16 @@
String rememberme = req.getParameter("rememberme");
if ("true".equals(rememberme))
{
- boolean isRemember = "true".equals(req.getParameter(InitiateLoginServlet.COOKIE_NAME));
- if (isRemember)
- {
//Create token
- AbstractTokenService tokenService = AbstractTokenService.getInstance(CookieTokenService.class);
- String cookieToken = tokenService.createToken(credentials);
+ AbstractTokenService tokenService = AbstractTokenService.getInstance(CookieTokenService.class);
+ String cookieToken = tokenService.createToken(credentials);
- log.debug("Found a remember me request parameter, created a persistent token " + cookieToken + " for it and set it up " +
- "in the next response");
- Cookie cookie = new Cookie(InitiateLoginServlet.COOKIE_NAME, cookieToken);
- cookie.setPath(req.getContextPath());
- cookie.setMaxAge((int)tokenService.getValidityTime() / 1000);
- resp.addCookie(cookie);
- }
+ log.debug("Found a remember me request parameter, created a persistent token " + cookieToken
+ + " for it and set it up " + "in the next response");
+ Cookie cookie = new Cookie(InitiateLoginServlet.COOKIE_NAME, cookieToken);
+ cookie.setPath(req.getContextPath());
+ cookie.setMaxAge((int) tokenService.getValidityTime() / 1000);
+ resp.addCookie(cookie);
}
//
15 years, 5 months
gatein SVN: r5151 - portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest.
by do-not-reply@jboss.org
Author: hangnguyen
Date: 2010-11-18 04:05:54 -0500 (Thu, 18 Nov 2010)
New Revision: 5151
Modified:
portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_35_ChangeApplicationWhenEditPropertiesOfNodeInPortalNavigation.html
portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_51_ManageGadget.html
portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_53_DragAndDropGadget.html
Log:
TestVN-356:Clean and Improve existing Selenium for GateIn
Modified: portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_35_ChangeApplicationWhenEditPropertiesOfNodeInPortalNavigation.html
===================================================================
--- portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_35_ChangeApplicationWhenEditPropertiesOfNodeInPortalNavigation.html 2010-11-18 07:58:06 UTC (rev 5150)
+++ portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_35_ChangeApplicationWhenEditPropertiesOfNodeInPortalNavigation.html 2010-11-18 09:05:54 UTC (rev 5151)
@@ -432,14 +432,14 @@
<td></td>
</tr>
<tr>
- <td>waitForTextPresent</td>
+ <td>waitForText</td>
+ <td>//div[2]/div/div/div[2]/div/div/div/div/div/div/div[2]</td>
<td>Test_SNF_PRL_35</td>
- <td></td>
</tr>
<tr>
- <td>verifyTextPresent</td>
+ <td>verifyText</td>
+ <td>//div[2]/div/div/div[2]/div/div/div/div/div/div/div[2]</td>
<td>Test_SNF_PRL_35</td>
- <td></td>
</tr>
<tr>
<td>echo</td>
Modified: portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_51_ManageGadget.html
===================================================================
--- portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_51_ManageGadget.html 2010-11-18 07:58:06 UTC (rev 5150)
+++ portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_51_ManageGadget.html 2010-11-18 09:05:54 UTC (rev 5151)
@@ -97,6 +97,11 @@
<td></td>
</tr>
<tr>
+ <td>pause</td>
+ <td>1000</td>
+ <td></td>
+</tr>
+<tr>
<td>echo</td>
<td>-- Close Dashboard Workspace--</td>
<td></td>
Modified: portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_53_DragAndDropGadget.html
===================================================================
--- portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_53_DragAndDropGadget.html 2010-11-18 07:58:06 UTC (rev 5150)
+++ portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_53_DragAndDropGadget.html 2010-11-18 09:05:54 UTC (rev 5151)
@@ -58,7 +58,7 @@
</tr>
<tr>
<td>echo</td>
- <td>--By drag and drop</td>
+ <td>--Click Add gadget --</td>
<td></td>
</tr>
<tr>
@@ -72,6 +72,16 @@
<td></td>
</tr>
<tr>
+ <td>pause</td>
+ <td>1000</td>
+ <td></td>
+</tr>
+<tr>
+ <td>echo</td>
+ <td>-- Drag & drop gadget --</td>
+ <td></td>
+</tr>
+<tr>
<td>waitForElementPresent</td>
<td>xpath=//div[@class='UIDashboardContainer']/div/div/div[2]</td>
<td></td>
@@ -92,6 +102,11 @@
<td></td>
</tr>
<tr>
+ <td>echo</td>
+ <td>-- Change position of gadget --</td>
+ <td></td>
+</tr>
+<tr>
<td>waitForElementPresent</td>
<td>xpath=//div[@class='UIDashboardContainer']/div/div/div[3]</td>
<td></td>
@@ -102,6 +117,11 @@
<td>xpath=//div[@class='UIDashboardContainer']/div/div/div[3]</td>
</tr>
<tr>
+ <td>echo</td>
+ <td>-- Delete gadget --</td>
+ <td></td>
+</tr>
+<tr>
<td>waitForElementPresent</td>
<td>//div[@onclick='eXo.gadget.UIGadget.deleteGadget(this)']</td>
<td></td>
15 years, 5 months
gatein SVN: r5150 - in exo/portal/branches/3.1.x: web/eXoResources/src/main/webapp/javascript/eXo/webui and 2 other directories.
by do-not-reply@jboss.org
Author: phuong_vu
Date: 2010-11-18 02:58:06 -0500 (Thu, 18 Nov 2010)
New Revision: 5150
Modified:
exo/portal/branches/3.1.x/web/eXoResources/src/main/webapp/javascript/eXo/core/UIMaskLayer.js
exo/portal/branches/3.1.x/web/eXoResources/src/main/webapp/javascript/eXo/webui/UIPopupWindow.js
exo/portal/branches/3.1.x/web/portal/src/main/webapp/groovy/webui/core/UIPopupMessages.gtmpl
exo/portal/branches/3.1.x/webui/core/src/main/java/org/exoplatform/webui/core/UIPopupMessages.java
Log:
EXOGTN-164 [PLF] Still click Abort/Finish on Edit Inline Composer when pop-up mesage still is open
Modified: exo/portal/branches/3.1.x/web/eXoResources/src/main/webapp/javascript/eXo/core/UIMaskLayer.js
===================================================================
--- exo/portal/branches/3.1.x/web/eXoResources/src/main/webapp/javascript/eXo/core/UIMaskLayer.js 2010-11-18 07:41:14 UTC (rev 5149)
+++ exo/portal/branches/3.1.x/web/eXoResources/src/main/webapp/javascript/eXo/core/UIMaskLayer.js 2010-11-18 07:58:06 UTC (rev 5150)
@@ -107,7 +107,8 @@
UIMaskLayer.prototype.createMask = function(blockContainerId, object, opacity, position) {
try {
var Browser = eXo.core.Browser ;
- var blockContainer = document.getElementById(blockContainerId) ;
+ if(typeof(blockContainerId) == "string") blockContainerId = document.getElementById(blockContainerId) ;
+ var blockContainer = blockContainerId ;
var maskLayer = document.createElement("div") ;
this.object = object ;
@@ -121,12 +122,11 @@
* reference with method eXo.core.UIMaskLayer.doScroll()
*/
document.getElementById("MaskLayer").id = "subMaskLayer";
- }
- blockContainer.appendChild(maskLayer) ;
-
+ }
+ blockContainer.appendChild(maskLayer) ;
maskLayer.className = "MaskLayer" ;
- maskLayer.id = "MaskLayer" ;
- maskLayer.maxZIndex = 4; //3 ;
+ maskLayer.id = "MaskLayer" ;
+ maskLayer.maxZIndex = eXo.webui.UIPopup.zIndex + 1; //3 ;
maskLayer.style.width = Browser.getBrowserWidth() + "px";
maskLayer.style.height = Browser.getBrowserHeight() + "px";
maskLayer.style.top = "0px" ;
@@ -137,14 +137,14 @@
Browser.setOpacity(maskLayer, opacity) ;
}
- if(object != null){
- if(object.nextSibling) {
- maskLayer.nextSiblingOfObject = object.nextSibling ;
- maskLayer.parentOfObject = null ;
+ if(object != null) {
+ var tempNextSibling = document.createElement("span");
+ if(object.nextSibling) {
+ object.parentNode.insertBefore(tempNextSibling, object.nextSibling);
} else {
- maskLayer.nextSiblingOfObject = null ;
- maskLayer.parentOfObject = object.parentNode ;
+ object.parentNode.appendChild(tempNextSibling);
}
+ maskLayer.nextSiblingOfObject = tempNextSibling ;
//object.style.zIndex = maskLayer.maxZIndex + 1 ;
object.style.zIndex = maskLayer.maxZIndex;
@@ -185,27 +185,31 @@
maskLayer.id = object.id + "MaskLayer" ;
maskLayer.maxZIndex = 3 ;
maskLayer.style.width = blockContainer.offsetWidth + "px" ;
- maskLayer.style.height = blockContainer.offsetHeight + eXo.core.Browser.findPosY(blockContainer) + "px" ;
- maskLayer.style.top = "0px" ;
- maskLayer.style.left = "0px" ;
+ maskLayer.style.height = blockContainer.offsetHeight + "px" ;
+ var parentOfBlockContainer = eXo.core.DOMUtil.findAncestorById(blockContainer, "UIMaskWorkspace");
+ if (!parentOfBlockContainer) {
+ parentOfBlockContainer = document.getElementById("UIWorkingWorkspace");
+ }
+ maskLayer.style.top = eXo.core.Browser.findPosYInContainer(blockContainer, parentOfBlockContainer) + "px" ;
+ maskLayer.style.left = eXo.core.Browser.findPosXInContainer(blockContainer, parentOfBlockContainer) + "px" ;
maskLayer.style.zIndex = maskLayer.maxZIndex ;
if(opacity) {
Browser.setOpacity(maskLayer, opacity) ;
}
if(object != null){
- if(object.nextSibling) {
- maskLayer.nextSiblingOfObject = object.nextSibling ;
- maskLayer.parentOfObject = null ;
- } else {
- maskLayer.nextSiblingOfObject = null ;
- maskLayer.parentOfObject = object.parentNode ;
- }
+ var tempNextSibling = document.createElement("span");
+ if(object.nextSibling) {
+ object.parentNode.insertBefore(tempNextSibling, object.nextSibling);
+ } else {
+ object.parentNode.appendChild(tempNextSibling);
+ }
+ maskLayer.nextSiblingOfObject = tempNextSibling ;
+
+ object.style.zIndex = maskLayer.maxZIndex + 1 ;
+ object.style.display = "block" ;
- object.style.zIndex = maskLayer.maxZIndex + 1 ;
- object.style.display = "block" ;
-
- blockContainer.appendChild(object) ;
+ blockContainer.appendChild(object) ;
}
}catch(err) {}
@@ -278,17 +282,12 @@
if (maskLayer) {
var parentNode = maskLayer.parentNode ;
maskLayer.nextSibling.style.display = "none" ;
-
- if (maskLayer.nextSiblingOfObject) {
- maskLayer.nextSiblingOfObject.parentNode.insertBefore(maskLayer.nextSibling, maskLayer.nextSiblingOfObject) ;
- maskLayer.nextSiblingOfObject = null ;
- } else {
- maskLayer.parentOfObject.appendChild(maskLayer.nextSibling) ;
- maskLayer.parentOfObject = null ;
- }
-
- parentNode.removeChild(maskLayer) ;
+
+ maskLayer.nextSiblingOfObject.parentNode.insertBefore(maskLayer.nextSibling, maskLayer.nextSiblingOfObject) ;
+ maskLayer.nextSiblingOfObject.parentNode.removeChild(maskLayer.nextSiblingOfObject);
+ maskLayer.nextSiblingOfObject = null ;
+ parentNode.removeChild(maskLayer) ;
}
} ;
Modified: exo/portal/branches/3.1.x/web/eXoResources/src/main/webapp/javascript/eXo/webui/UIPopupWindow.js
===================================================================
--- exo/portal/branches/3.1.x/web/eXoResources/src/main/webapp/javascript/eXo/webui/UIPopupWindow.js 2010-11-18 07:41:14 UTC (rev 5149)
+++ exo/portal/branches/3.1.x/web/eXoResources/src/main/webapp/javascript/eXo/webui/UIPopupWindow.js 2010-11-18 07:58:06 UTC (rev 5150)
@@ -71,12 +71,21 @@
} ;
UIPopupWindow.prototype.showMask = function(popup, isShowPopup) {
- var maskId = popup.id + "MaskLayer" ;
- var mask = document.getElementById(maskId) ;
+ var mask = popup.previousSibling;
+ //Make sure mask is not TextNode because of previousSibling property
+ if (mask && mask.className != "MaskLayer") {
+ mask = null;
+ }
if(isShowPopup) {
- if (mask == null) eXo.core.UIMaskLayer.createMaskForFrame(popup.parentNode, popup, 1) ;
+ //Modal if popup is portal component
+ if (eXo.core.DOMUtil.findAncestorByClass(popup, "PORTLET-FRAGMENT") == null) {
+ if(!mask) eXo.core.UIMaskLayer.createMask(popup.parentNode, popup, 1) ;
+ } else {
+ //If popup is portlet's component, modal with just its parent
+ if(!mask) eXo.core.UIMaskLayer.createMaskForFrame(popup.parentNode, popup, 1) ;
+ }
} else {
- if(mask != null) eXo.core.UIMaskLayer.removeMask(mask) ;
+ if(mask) eXo.core.UIMaskLayer.removeMask(mask) ;
}
} ;
Modified: exo/portal/branches/3.1.x/web/portal/src/main/webapp/groovy/webui/core/UIPopupMessages.gtmpl
===================================================================
--- exo/portal/branches/3.1.x/web/portal/src/main/webapp/groovy/webui/core/UIPopupMessages.gtmpl 2010-11-18 07:41:14 UTC (rev 5149)
+++ exo/portal/branches/3.1.x/web/portal/src/main/webapp/groovy/webui/core/UIPopupMessages.gtmpl 2010-11-18 07:58:06 UTC (rev 5150)
@@ -155,9 +155,9 @@
</div>
</div>
<%
- rcontext.getJavascriptManager().addJavascript("eXo.webui.UIPopupWindow.init('$popupId', false);");
+ rcontext.getJavascriptManager().addJavascript("eXo.webui.UIPopupWindow.init('$popupId', false, null, null, $uicomponent.showMask);");
if(uicomponent.hasMessage()){
- rcontext.getJavascriptManager().addJavascript("eXo.webui.UIPopupWindow.show('$popupId');");
+ rcontext.getJavascriptManager().addJavascript("eXo.webui.UIPopupWindow.show('$popupId', $uicomponent.showMask);");
rcontext.getJavascriptManager().addJavascript("window.setTimeout(\"eXo.webui.UIPopupWindow.increasezIndex('$popupId')\", 100);");
}
%>
\ No newline at end of file
Modified: exo/portal/branches/3.1.x/webui/core/src/main/java/org/exoplatform/webui/core/UIPopupMessages.java
===================================================================
--- exo/portal/branches/3.1.x/webui/core/src/main/java/org/exoplatform/webui/core/UIPopupMessages.java 2010-11-18 07:41:14 UTC (rev 5149)
+++ exo/portal/branches/3.1.x/webui/core/src/main/java/org/exoplatform/webui/core/UIPopupMessages.java 2010-11-18 07:58:06 UTC (rev 5150)
@@ -63,6 +63,7 @@
errors_ = new ArrayList<ApplicationMessage>();
warnings_ = new ArrayList<ApplicationMessage>();
infos_ = new ArrayList<ApplicationMessage>();
+ setShowMask(true);
setShow(true);
}
15 years, 5 months