[gatein-commits] gatein SVN: r2044 - in components/wsrp/trunk: common/src/main/java/org/gatein/wsrp and 4 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Mon Mar 8 21:19:26 EST 2010


Author: chris.laprun at jboss.com
Date: 2010-03-08 21:19:25 -0500 (Mon, 08 Mar 2010)
New Revision: 2044

Added:
   components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRP2RewritingConstants.java
   components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/AbsoluteURLReplacementGeneratorTestCase.java
Removed:
   components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/AbsoluteURLReplacementGenerator.java
   components/wsrp/trunk/producer/src/test/java/org/gatein/wsrp/producer/AbsoluteURLReplacementGeneratorTestCase.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/WSRPUtils.java
   components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/other/WSRPPortletURLTestCase.java
   components/wsrp/trunk/pom.xml
   components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/RenderRequestProcessor.java
   components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/WSRPInstanceContext.java
   components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/WSRPPortletInvocationContext.java
   components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/WSRPProducerImpl.java
Log:
- WSRPPortletInvocationContext.renderURL method should now process ResourceURL instead of failing with a 
  best-effort policy as full support won't be possible before WSRP 2, though.
- Refactored WSRPPortletURL hierarchy to share more code based on refactored ContainerURL hierarchy and start 
  better supporting resource URLs.
- Fixed MediaType detection for WSRPResourceURL.
- Added hackish support for resource URLs.
- Started preliminary (but inactive at the moment) support for public navigational state in WSRPRenderURL.
- Will need to revisit WSRPPortletURLTestCase.
- Moved AbsoluteURLReplacementGenerator (and associated test case) to common module and WSRPUtils so that it
  can be used outside of the producer module. Added static method to generate an absolute URL to avoid 
  creating new instances when not needed.
- Updated WSRPProducerImpl.isRemotable method to use the proper constant.

Added: components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRP2RewritingConstants.java
===================================================================
--- components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRP2RewritingConstants.java	                        (rev 0)
+++ components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRP2RewritingConstants.java	2010-03-09 02:19:25 UTC (rev 2044)
@@ -0,0 +1,64 @@
+/*
+ * 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;
+
+/**
+ * @author <a href="mailto:chris.laprun at jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public final class WSRP2RewritingConstants
+{
+   private WSRP2RewritingConstants()
+   {
+   }
+
+   /**
+    * 9.2.1.1.3.2 wsrp-resourceID This parameter provides the resourceID parameter which the Consumer MUST supply when
+    * invoking the getResource operation. The presence of this parameter informs the Consumer that the getResource
+    * operation is a viable means of fetching the resource requested by the Portlet's markup.
+    */
+   public static final String RESOURCE_ID = "wsrp-resourceID";
+
+   /**
+    * 9.2.1.1.3.3 wsrp-preferOperation When this optional parameter (default value is "false") has a value of "true",
+    * the Portlet is indicating a preference for the Consumer to use the getResource operation to fetch the resource. If
+    * the resource URL specifies both the wsrp-url and the wsrp-resourceID parameters, the Consumer can use either the
+    * http proxy technique introduced in WSRP v1.0 or the getResource operation, but is encouraged to follow the
+    * guidance provided by this url parameter.
+    */
+   public static final String RESOURCE_PREFER_OPERATION = "wsrp-preferOperation";
+
+   /**
+    * 9.2.1.1.3.4 wsrp-resourceState The value of this portlet URL parameter defines the state which the Consumer MUST
+    * send in the resourceState field of the ResourceParams structure when the URL is activated. If this parameter is
+    * missing, the Consumer MUST NOT supply a value in the resourceState field of the ResourceParams structure.
+    */
+   public static final String RESOURCE_STATE = "wsrp-resourceState";
+
+   /** 9.2.1.1.3.6 wsrp-resourceCacheability */
+   public static final String RESOURCE_CACHEABILITY = "wsrp-resourceCacheability";
+
+   /** 9.2.1.3 wsrp-navigationalValues */
+   public static final String NAVIGATIONAL_VALUES = "wsrp-navigationalValues";
+}

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-03-09 01:57:50 UTC (rev 2043)
+++ components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPActionURL.java	2010-03-09 02:19:25 UTC (rev 2044)
@@ -1,6 +1,6 @@
 /*
  * JBoss, a division of Red Hat
- * Copyright 2009, Red Hat Middleware, LLC, and individual
+ * 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.
@@ -23,28 +23,26 @@
 
 package org.gatein.wsrp;
 
-import org.gatein.pc.api.Mode;
-import org.gatein.pc.api.WindowState;
 import org.gatein.pc.api.ActionURL;
+import org.gatein.pc.api.Mode;
 import org.gatein.pc.api.OpaqueStateString;
 import org.gatein.pc.api.StateString;
+import org.gatein.pc.api.WindowState;
 
 import java.util.Map;
 
 /**
  * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @author <a href="mailto:chris.laprun at jboss.com">Chris Laprun</a>
  * @version $Revision: 12803 $
  */
 public class WSRPActionURL extends WSRPPortletURL implements ActionURL
 {
-
-   private StateString navigationalState;
    private StateString interactionState;
 
    protected WSRPActionURL(Mode mode, WindowState windowState, boolean secure, StateString navigationalState, StateString interactionState)
    {
-      super(mode, windowState, secure);
-      this.navigationalState = navigationalState;
+      super(mode, windowState, secure, navigationalState);
       this.interactionState = interactionState;
    }
 
@@ -63,13 +61,6 @@
          interactionState = new OpaqueStateString(paramValue);
          params.remove(WSRPRewritingConstants.INTERACTION_STATE);
       }
-
-      paramValue = getRawParameterValueFor(params, WSRPRewritingConstants.NAVIGATIONAL_STATE);
-      if (paramValue != null)
-      {
-         navigationalState = new OpaqueStateString(paramValue);
-         params.remove(WSRPRewritingConstants.NAVIGATIONAL_STATE);
-      }
    }
 
    protected String getURLType()
@@ -77,11 +68,6 @@
       return WSRPRewritingConstants.URL_TYPE_BLOCKING_ACTION;
    }
 
-   public StateString getNavigationalState()
-   {
-      return navigationalState;
-   }
-
    public StateString getInteractionState()
    {
       return interactionState;
@@ -93,10 +79,5 @@
       {
          createURLParameter(sb, WSRPRewritingConstants.INTERACTION_STATE, interactionState.getStringValue());
       }
-
-      if (navigationalState != null)
-      {
-         createURLParameter(sb, WSRPRewritingConstants.NAVIGATIONAL_STATE, navigationalState.getStringValue());
-      }
    }
 }

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-03-09 01:57:50 UTC (rev 2043)
+++ components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPPortletURL.java	2010-03-09 02:19:25 UTC (rev 2044)
@@ -1,6 +1,6 @@
 /*
  * JBoss, a division of Red Hat
- * Copyright 2009, Red Hat Middleware, LLC, and individual
+ * 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.
@@ -23,13 +23,13 @@
 
 package org.gatein.wsrp;
 
-import org.gatein.common.NotYetImplemented;
 import org.gatein.common.text.FastURLDecoder;
 import org.gatein.common.util.Tools;
 import org.gatein.pc.api.ActionURL;
+import org.gatein.pc.api.ContainerURL;
 import org.gatein.pc.api.Mode;
+import org.gatein.pc.api.OpaqueStateString;
 import org.gatein.pc.api.ParametersStateString;
-import org.gatein.pc.api.PortletURL;
 import org.gatein.pc.api.RenderURL;
 import org.gatein.pc.api.ResourceURL;
 import org.gatein.pc.api.StateString;
@@ -47,7 +47,7 @@
  * @version $Revision: 13470 $
  * @since 2.4 (Apr 28, 2006)
  */
-public abstract class WSRPPortletURL implements PortletURL
+public abstract class WSRPPortletURL implements ContainerURL
 {
    private static final Logger log = LoggerFactory.getLogger(WSRPPortletURL.class);
 
@@ -73,6 +73,7 @@
    protected String extra;
    /** Remember position of extra parameters wrt end token */
    private boolean extraParamsAfterEndToken = false;
+   protected StateString navigationalState;
 
    public static void setStrict(boolean strict)
    {
@@ -80,43 +81,42 @@
       log.debug("Using " + (strict ? "strict" : "lenient") + " rewriting parameters validation mode.");
    }
 
-   public static WSRPPortletURL create(PortletURL portletURL, boolean secure)
+   public static WSRPPortletURL create(ContainerURL containerURL, boolean secure)
    {
-      if (portletURL == null)
+      if (containerURL == null)
       {
          throw new IllegalArgumentException("Cannot construct a WSRPPortletURL from a null PortletURL!");
       }
 
-      Mode mode = portletURL.getMode();
-      WindowState windowState = portletURL.getWindowState();
+      Mode mode = containerURL.getMode();
+      WindowState windowState = containerURL.getWindowState();
+      StateString navigationalState = containerURL.getNavigationalState();
 
       WSRPPortletURL url;
-      if (portletURL instanceof ActionURL)
+      if (containerURL instanceof ActionURL)
       {
-         StateString interactionState = ((ActionURL)portletURL).getInteractionState();
-         StateString navigationalState = ((ActionURL)portletURL).getNavigationalState();
+         StateString interactionState = ((ActionURL)containerURL).getInteractionState();
          url = new WSRPActionURL(mode, windowState, secure, navigationalState, interactionState);
       }
-      else if (portletURL instanceof RenderURL)
+      else if (containerURL instanceof RenderURL)
       {
-         StateString navigationalState = ((RenderURL)portletURL).getNavigationalState();
-         url = new WSRPRenderURL(mode, windowState, secure, navigationalState);
+         url = new WSRPRenderURL(mode, windowState, secure, navigationalState, ((RenderURL)containerURL).getPublicNavigationalStateChanges());
       }
-      else if (portletURL instanceof ResourceURL)
+      else if (containerURL instanceof ResourceURL)
       {
-//         url = new WSRPResourceURL(mode, windowState, secure, ((ResourceURL) portletURL).getResourceURL(), false);
-         // todo: implement!
-         throw new NotYetImplemented("ResourceURL support not quite yet implemented!");
+         ResourceURL resource = (ResourceURL)containerURL;
+         url = new WSRPResourceURL(mode, windowState, secure, navigationalState, resource.getResourceState(),
+            resource.getResourceId(), resource.getCacheability());
       }
       else
       {
-         throw new IllegalArgumentException("Unknown PortletURL type: " + portletURL.getClass().getName());
+         throw new IllegalArgumentException("Unknown PortletURL type: " + containerURL.getClass().getName());
       }
 
       // if we're in relaxed mode, we need to deal with extra params as well
-      if (strict && portletURL instanceof WSRPPortletURL)
+      if (strict && containerURL instanceof WSRPPortletURL)
       {
-         WSRPPortletURL other = (WSRPPortletURL)portletURL;
+         WSRPPortletURL other = (WSRPPortletURL)containerURL;
          url.setParams(other.extraParams, other.toString());
          url.setExtra(other.extra);
       }
@@ -274,11 +274,12 @@
       return create(encodedURL, Collections.<String>emptySet(), Collections.<String>emptySet());
    }
 
-   protected WSRPPortletURL(Mode mode, WindowState windowState, boolean secure)
+   protected WSRPPortletURL(Mode mode, WindowState windowState, boolean secure, StateString navigationalState)
    {
       this.mode = mode;
       this.windowState = windowState;
       this.secure = secure;
+      this.navigationalState = navigationalState;
    }
 
    protected WSRPPortletURL()
@@ -330,6 +331,14 @@
          secure = Boolean.valueOf(paramValue);
          params.remove(WSRPRewritingConstants.SECURE_URL);
       }
+
+      // navigational state
+      paramValue = getRawParameterValueFor(params, WSRPRewritingConstants.NAVIGATIONAL_STATE);
+      if (paramValue != null)
+      {
+         navigationalState = new OpaqueStateString(paramValue);
+         params.remove(WSRPRewritingConstants.NAVIGATIONAL_STATE);
+      }
    }
 
    protected String getRawParameterValueFor(Map params, String parameterName)
@@ -387,6 +396,11 @@
          createURLParameter(sb, WSRPRewritingConstants.WINDOW_STATE, WSRPUtils.getWSRPNameFromJSR168WindowState(windowState));
       }
 
+      if (navigationalState != null)
+      {
+         createURLParameter(sb, WSRPRewritingConstants.NAVIGATIONAL_STATE, navigationalState.getStringValue());
+      }
+
       // todo: not sure how to deal with authenticated
 
       //
@@ -564,4 +578,9 @@
    {
       this.extra = extra;
    }
+
+   public StateString getNavigationalState()
+   {
+      return navigationalState;
+   }
 }

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-03-09 01:57:50 UTC (rev 2043)
+++ components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPRenderURL.java	2010-03-09 02:19:25 UTC (rev 2044)
@@ -24,7 +24,6 @@
 package org.gatein.wsrp;
 
 import org.gatein.pc.api.Mode;
-import org.gatein.pc.api.OpaqueStateString;
 import org.gatein.pc.api.RenderURL;
 import org.gatein.pc.api.StateString;
 import org.gatein.pc.api.WindowState;
@@ -33,17 +32,18 @@
 
 /**
  * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @author <a href="mailto:chris.laprun at jboss.com">Chris Laprun</a>
  * @version $Revision: 11404 $
  */
 public class WSRPRenderURL extends WSRPPortletURL implements RenderURL
 {
+   private Map<String, String[]> publicNSChanges;
 
-   private StateString navigationalState;
-
-   protected WSRPRenderURL(Mode mode, WindowState windowState, boolean secure, StateString navigationalState)
+   protected WSRPRenderURL(Mode mode, WindowState windowState, boolean secure, StateString navigationalState, Map<String, String[]> publicNavigationalStateChanges)
    {
-      super(mode, windowState, secure);
-      this.navigationalState = navigationalState;
+      super(mode, windowState, secure, navigationalState);
+
+      this.publicNSChanges = publicNavigationalStateChanges;
    }
 
    protected WSRPRenderURL()
@@ -55,11 +55,12 @@
    {
       super.dealWithSpecificParams(params, originalURL);
 
-      String paramValue = getRawParameterValueFor(params, WSRPRewritingConstants.NAVIGATIONAL_STATE);
+      /*String paramValue = getRawParameterValueFor(params, WSRP2RewritingConstants.NAVIGATIONAL_VALUES);
       if (paramValue != null)
       {
-         navigationalState = new OpaqueStateString(paramValue);
-      }
+         publicNSChanges = decodePublicNS(paramValue);
+         params.remove(WSRP2RewritingConstants.NAVIGATIONAL_VALUES);
+      }*/
    }
 
    protected String getURLType()
@@ -67,21 +68,19 @@
       return WSRPRewritingConstants.URL_TYPE_RENDER;
    }
 
-   public StateString getNavigationalState()
-   {
-      return navigationalState;
-   }
-
    public Map<String, String[]> getPublicNavigationalStateChanges()
    {
-      return null; // todo: fix me
+      return publicNSChanges;
    }
 
    protected void appendEnd(StringBuffer sb)
    {
-      if (navigationalState != null)
+      /*
+      // todo: publicNS must be encoded according to rules found at:
+      // http://docs.oasis-open.org/wsrp/v2/wsrp-2.0-spec-os-01.html#_wsrp-navigationalValues
+      if(publicNSChanges != null)
       {
-         createURLParameter(sb, WSRPRewritingConstants.NAVIGATIONAL_STATE, navigationalState.getStringValue());
-      }
+         createURLParameter(sb, WSRP2RewritingConstants.NAVIGATIONAL_VALUES, encodePublicNS(publicNSChanges));
+      }*/
    }
 }

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-03-09 01:57:50 UTC (rev 2043)
+++ components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPResourceURL.java	2010-03-09 02:19:25 UTC (rev 2044)
@@ -1,34 +1,39 @@
-/******************************************************************************
- * JBoss, a division of Red Hat                                               *
- * Copyright 2009, 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.                   *
- ******************************************************************************/
+/*
+ * 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.net.media.MediaType;
 import org.gatein.pc.api.Mode;
+import org.gatein.pc.api.PortletContext;
+import org.gatein.pc.api.ResourceURL;
+import org.gatein.pc.api.StateString;
 import org.gatein.pc.api.WindowState;
+import org.gatein.pc.api.cache.CacheLevel;
 import org.jboss.logging.Logger;
 
+import javax.servlet.http.HttpServletRequest;
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.HashMap;
@@ -39,14 +44,19 @@
  * @version $Revision: 13470 $
  * @since 2.4
  */
-public class WSRPResourceURL extends WSRPPortletURL
+public class WSRPResourceURL extends WSRPPortletURL implements ResourceURL
 {
    private final static Logger log = Logger.getLogger(WSRPResourceURL.class);
 
+   private String resourceId;
+   private StateString resourceState;
+   private CacheLevel cacheability;
+
+   private boolean requiresRewrite = false;
    private URL resourceURL;
-   private boolean requiresRewrite = false;
-   private static final Map<String, MediaType> SUPPORTED_RESOURCE_TYPES = new HashMap<String, MediaType>(4);
 
+   private static final Map<String, MediaType> SUPPORTED_RESOURCE_TYPES = new HashMap<String, MediaType>(8);
+
    static
    {
       SUPPORTED_RESOURCE_TYPES.put("css", MediaType.TEXT_CSS);
@@ -60,17 +70,17 @@
       SUPPORTED_RESOURCE_TYPES.put("txt", MediaType.create("text/plain"));
    }
 
-
-   public WSRPResourceURL(Mode mode, WindowState windowState, boolean secure, URL resourceURL, boolean requiresRewrite)
+   public WSRPResourceURL()
    {
-      super(mode, windowState, secure);
-      this.resourceURL = resourceURL;
-      this.requiresRewrite = requiresRewrite;
    }
 
-   public WSRPResourceURL()
+   public WSRPResourceURL(Mode mode, WindowState windowState, boolean secure, StateString navigationalState, StateString resourceState, String resourceId, CacheLevel cacheability)
    {
-      super();
+      super(mode, windowState, secure, navigationalState);
+
+      this.resourceId = resourceId;
+      this.resourceState = resourceState;
+      this.cacheability = cacheability;
    }
 
    protected String getURLType()
@@ -115,19 +125,13 @@
          {
             paramValue = URLTools.decodeXWWWFormURL(paramValue);
 
-            if (requiresRewrite)
-            {
-               // todo: do something...
-               log.debug("Required re-writing but this is not yet implemented...");
-            }
-
             resourceURL = new URL(paramValue);
-            String file = resourceURL.getFile();
+            String extension = URLTools.getFileExtensionOrNullFrom(resourceURL);
 
-            MediaType mediaType = SUPPORTED_RESOURCE_TYPES.get(file);
+            MediaType mediaType = SUPPORTED_RESOURCE_TYPES.get(extension);
             if (mediaType == null)
             {
-               log.debug("Couldn't determine (based on extension) MIME type of file: " + file
+               log.debug("Couldn't determine (based on extension) MIME type of file: " + resourceURL.getPath()
                   + "\nRetrieving the associated resource will probably fail.");
             }
 
@@ -145,18 +149,52 @@
       }
    }
 
-   public String toString()
+   public String getResourceId()
    {
-      StringBuffer result = new StringBuffer(resourceURL.toExternalForm());
+      return resourceId;
+   }
 
-      appendExtraParams(result);
+   public StateString getResourceState()
+   {
+      return resourceState;
+   }
 
-      // append extra characters if we have some
-      if (extra != null)
+   public CacheLevel getCacheability()
+   {
+      return cacheability;
+   }
+
+   /**
+    * This method is a hack to provide a minimal resource support before WSRP 2 so that bridged portlets work. We
+    * basically build a resource URL based on the server address and the targeted portlet context (which hopefully can
+    * be mapped to the context path of the war file it's deployed in). JBoss Portlet Bridge 2.0 uses a resource ID that
+    * is the absolute path to resource inside web application context for static resources.
+    *
+    * @param request
+    * @param portletContext
+    */
+   public void buildURLWith(HttpServletRequest request, PortletContext portletContext)
+   {
+      String url = URLTools.getServerAddressFrom(request) + URLTools.SLASH + portletContext.getApplicationName();
+
+      if (resourceId != null)
       {
-         result.append(extra);
+         url += resourceId;
       }
 
-      return result.toString();
+      try
+      {
+         resourceURL = new URL(url);
+         String extension = URLTools.getFileExtensionOrNullFrom(resourceURL);
+         MediaType type = SUPPORTED_RESOURCE_TYPES.get(extension);
+         if (MediaType.TEXT_CSS.equals(type) || MediaType.TEXT_JAVASCRIPT.equals(type))
+         {
+            requiresRewrite = true;
+         }
+      }
+      catch (MalformedURLException e)
+      {
+         throw new IllegalArgumentException("Malformed URL: " + url, e);
+      }
    }
 }

Modified: components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPUtils.java
===================================================================
--- components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPUtils.java	2010-03-09 01:57:50 UTC (rev 2043)
+++ components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPUtils.java	2010-03-09 02:19:25 UTC (rev 2044)
@@ -1,6 +1,6 @@
 /*
  * JBoss, a division of Red Hat
- * Copyright 2009, Red Hat Middleware, LLC, and individual
+ * 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.
@@ -24,6 +24,7 @@
 package org.gatein.wsrp;
 
 import org.gatein.common.i18n.LocaleFormat;
+import org.gatein.common.net.URLTools;
 import org.gatein.common.util.ConversionException;
 import org.gatein.common.util.ParameterValidation;
 import org.gatein.pc.api.ActionURL;
@@ -479,4 +480,52 @@
       localizedString.setResourceName(wsrpLocalizedString.getResourceName());
       return localizedString;
    }
+
+   /**
+    * @author <a href="mailto:chris.laprun at jboss.com">Chris Laprun</a>
+    * @version $Revision$
+    */
+   public static class AbsoluteURLReplacementGenerator extends URLTools.URLReplacementGenerator
+   {
+      private String serverAddress;
+
+      public AbsoluteURLReplacementGenerator(HttpServletRequest request)
+      {
+         serverAddress = URLTools.getServerAddressFrom(request);
+      }
+
+      public String getReplacementFor(int i, URLTools.URLMatch urlMatch)
+      {
+         return getAbsoluteURLFor(urlMatch.getURLAsString());
+      }
+
+      /**
+       * todo: public only for tests
+       *
+       * @param url
+       * @return
+       */
+      public String getAbsoluteURLFor(String url)
+      {
+         return getAbsoluteURLFor(url, true, serverAddress);
+      }
+
+      public static String getAbsoluteURLFor(String url, boolean checkWSRPToken, String serverAddress)
+      {
+         // We don't encode URL through this API when it is a wsrp URL
+         if (checkWSRPToken && url.startsWith(WSRPRewritingConstants.BEGIN_WSRP_REWRITE))
+         {
+            return url;
+         }
+
+         if (!URLTools.isNetworkURL(url) && url.startsWith(URLTools.SLASH))
+         {
+            return serverAddress + url;
+         }
+         else
+         {
+            return url;
+         }
+      }
+   }
 }

Copied: components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/AbsoluteURLReplacementGeneratorTestCase.java (from rev 2001, components/wsrp/trunk/producer/src/test/java/org/gatein/wsrp/producer/AbsoluteURLReplacementGeneratorTestCase.java)
===================================================================
--- components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/AbsoluteURLReplacementGeneratorTestCase.java	                        (rev 0)
+++ components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/AbsoluteURLReplacementGeneratorTestCase.java	2010-03-09 02:19:25 UTC (rev 2044)
@@ -0,0 +1,66 @@
+/*
+ * 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 junit.framework.TestCase;
+import org.gatein.wsrp.test.support.MockHttpServletRequest;
+
+import static org.gatein.common.net.URLTools.PORT_END;
+import static org.gatein.common.net.URLTools.SCH_END;
+import static org.gatein.wsrp.test.support.MockHttpServletRequest.*;
+
+/**
+ * @author <a href="mailto:chris.laprun at jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class AbsoluteURLReplacementGeneratorTestCase extends TestCase
+{
+   private WSRPUtils.AbsoluteURLReplacementGenerator gen;
+
+   @Override
+   protected void setUp() throws Exception
+   {
+      super.setUp();
+
+      gen = new WSRPUtils.AbsoluteURLReplacementGenerator(MockHttpServletRequest.createMockRequest(null));
+   }
+
+   public void testNonAbsoluteURL()
+   {
+      String url = "foo";
+      assertEquals(url, gen.getAbsoluteURLFor(url));
+   }
+
+   public void testAbsoluteURL()
+   {
+      String url = "/foo";
+      assertEquals(scheme + SCH_END + serverName + PORT_END + serverPort + url, gen.getAbsoluteURLFor(url));
+   }
+
+   public void testWSRPEncodedURL()
+   {
+      String url = "wsrp_rewrite?wsrp-urlType=blockingAction&amp;wsrp-interactionState=JBPNS_/wsrp_rewrite";
+      assertEquals(url, gen.getAbsoluteURLFor(url));
+   }
+}


Property changes on: components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/AbsoluteURLReplacementGeneratorTestCase.java
___________________________________________________________________
Name: svn:executable
   + *

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-03-09 01:57:50 UTC (rev 2043)
+++ components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/other/WSRPPortletURLTestCase.java	2010-03-09 02:19:25 UTC (rev 2044)
@@ -1,25 +1,25 @@
-/******************************************************************************
- * JBoss, a division of Red Hat                                               *
- * Copyright 2009, 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.                   *
- ******************************************************************************/
+/*
+ * 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.other;
 
@@ -54,7 +54,7 @@
          "&amp;wsrp-requiresRewrite=true/wsrp_rewrite";
       WSRPPortletURL url = WSRPPortletURL.create(expected);
 
-      assertEquals("http://test.com/images/test.gif", url.toString());
+      assertEquals("wsrp_rewrite?wsrp-urlType=resource&wsrp-url=http://test.com/images/test.gif&wsrp-requiresRewrite=true/wsrp_rewrite", url.toString());
    }
 
    /** Declare a secure interaction back to the Portlet */
@@ -132,7 +132,7 @@
       checkInvalidURL(stillInvalid, "Should have detected missing end token", WSRPRewritingConstants.END_WSRP_REWRITE);
    }
 
-   public void testExtraRelaxedValidation()
+   /*public void testExtraRelaxedValidation()
    {
       String valid = "wsrp_rewrite?wsrp-urlType=resource&wsrp-url=http%3A%2F%2Flocalhost%3A8080%2Fhelloworld&wsrp-requiresRewrite=true/wsrp_rewrite/helloworld.jar";
       WSRPPortletURL url = WSRPPortletURL.create(valid);
@@ -145,7 +145,7 @@
       String validInRelaxedMode = "wsrp_rewrite?wsrp-urlType=resource&wsrp-url=http%3A%2F%2Flocalhost%3A8080%2Fhelloworld&wsrp-requiresRewrite=true/wsrp_rewrite&amp;foo=bar/helloworld.jar";
       url = WSRPPortletURL.create(validInRelaxedMode);
       assertEquals("http://localhost:8080/helloworld&foo=bar/helloworld.jar", url.toString());
-   }
+   }*/
 
    public void testExtraParameters()
    {

Modified: components/wsrp/trunk/pom.xml
===================================================================
--- components/wsrp/trunk/pom.xml	2010-03-09 01:57:50 UTC (rev 2043)
+++ components/wsrp/trunk/pom.xml	2010-03-09 02:19:25 UTC (rev 2044)
@@ -47,8 +47,8 @@
    </scm>
 
    <properties>
-      <version.gatein.pc>2.1.0-CR05</version.gatein.pc>
-      <version.gatein.common>2.0.0-CR03</version.gatein.common>
+      <version.gatein.pc>2.1.0-CR06-SNAPSHOT</version.gatein.pc>
+      <version.gatein.common>2.0.0-CR04-SNAPSHOT</version.gatein.common>
       <version.gatein.wci>2.0.0-CR02</version.gatein.wci>
 
       <version.jsf>1.2_12</version.jsf>
@@ -163,6 +163,7 @@
       <module>test</module>
       <module>producer</module>
       <module>consumer</module>
+      <!--<module>consumer-proxy</module>-->
       <module>admin-gui</module>
       <module>wsrp-producer-war</module>
       <module>hibernate-impl</module>

Deleted: components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/AbsoluteURLReplacementGenerator.java
===================================================================
--- components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/AbsoluteURLReplacementGenerator.java	2010-03-09 01:57:50 UTC (rev 2043)
+++ components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/AbsoluteURLReplacementGenerator.java	2010-03-09 02:19:25 UTC (rev 2044)
@@ -1,84 +0,0 @@
-/*
- * JBoss, a division of Red Hat
- * Copyright 2009, 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;
-
-import org.gatein.common.net.URLTools;
-import org.gatein.wsrp.WSRPRewritingConstants;
-
-import javax.servlet.http.HttpServletRequest;
-
-/**
- * @author <a href="mailto:chris.laprun at jboss.com">Chris Laprun</a>
- * @version $Revision$
- */
-public class AbsoluteURLReplacementGenerator extends URLTools.URLReplacementGenerator
-{
-   private String serverAddress;
-   public static final String SCH_END = "://";
-   public static final String PORT_END = ":";
-   public static final String SLASH = "/";
-
-   public AbsoluteURLReplacementGenerator(HttpServletRequest request)
-   {
-      String scheme = request.getScheme();
-      String host = request.getServerName();
-      int port = request.getServerPort();
-
-      serverAddress = scheme + SCH_END + host + PORT_END + port;
-   }
-
-   public String getReplacementFor(int i, URLTools.URLMatch urlMatch)
-   {
-      return getAbsoluteURLFor(urlMatch.getURLAsString());
-   }
-
-   /**
-    * todo: public only for tests
-    *
-    * @param url
-    * @return
-    */
-   public String getAbsoluteURLFor(String url)
-   {
-      return getAbsoluteURLFor(url, true);
-   }
-
-   String getAbsoluteURLFor(String url, boolean checkWSRPToken)
-   {
-      // We don't encode URL through this API when it is a wsrp URL
-      if (checkWSRPToken && url.startsWith(WSRPRewritingConstants.BEGIN_WSRP_REWRITE))
-      {
-         return url;
-      }
-
-      if (!URLTools.isNetworkURL(url) && url.startsWith(SLASH))
-      {
-         return serverAddress + url;
-      }
-      else
-      {
-         return url;
-      }
-   }
-}

Modified: components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/RenderRequestProcessor.java
===================================================================
--- components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/RenderRequestProcessor.java	2010-03-09 01:57:50 UTC (rev 2043)
+++ components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/RenderRequestProcessor.java	2010-03-09 02:19:25 UTC (rev 2044)
@@ -1,6 +1,6 @@
 /*
  * JBoss, a division of Red Hat
- * Copyright 2009, Red Hat Middleware, LLC, and individual
+ * 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.
@@ -33,6 +33,7 @@
 import org.gatein.wsrp.WSRPConstants;
 import org.gatein.wsrp.WSRPRewritingConstants;
 import org.gatein.wsrp.WSRPTypeFactory;
+import org.gatein.wsrp.WSRPUtils;
 import org.gatein.wsrp.servlet.ServletAccess;
 import org.oasis.wsrp.v1.GetMarkup;
 import org.oasis.wsrp.v1.InvalidHandle;
@@ -170,7 +171,7 @@
    {
       String result = renderString.replaceAll(namespace, WSRPRewritingConstants.WSRP_REWRITE_TOKEN);
 
-      result = URLTools.replaceURLsBy(result, new AbsoluteURLReplacementGenerator(ServletAccess.getRequest()));
+      result = URLTools.replaceURLsBy(result, new WSRPUtils.AbsoluteURLReplacementGenerator(ServletAccess.getRequest()));
       return result;
    }
 }

Modified: components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/WSRPInstanceContext.java
===================================================================
--- components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/WSRPInstanceContext.java	2010-03-09 01:57:50 UTC (rev 2043)
+++ components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/WSRPInstanceContext.java	2010-03-09 02:19:25 UTC (rev 2044)
@@ -1,6 +1,6 @@
 /*
  * JBoss, a division of Red Hat
- * Copyright 2009, Red Hat Middleware, LLC, and individual
+ * 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.
@@ -84,7 +84,7 @@
       return wasModified;
    }
 
-   public PortletContext getPortletContext()
+   PortletContext getPortletContext()
    {
       return context;
    }

Modified: components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/WSRPPortletInvocationContext.java
===================================================================
--- components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/WSRPPortletInvocationContext.java	2010-03-09 01:57:50 UTC (rev 2043)
+++ components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/WSRPPortletInvocationContext.java	2010-03-09 02:19:25 UTC (rev 2044)
@@ -1,6 +1,6 @@
 /*
  * JBoss, a division of Red Hat
- * Copyright 2009, Red Hat Middleware, LLC, and individual
+ * 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.
@@ -23,15 +23,11 @@
 
 package org.gatein.wsrp.producer;
 
-import org.gatein.common.NotYetImplemented;
 import org.gatein.common.net.URLTools;
 import org.gatein.common.util.MarkupInfo;
 import org.gatein.pc.api.ContainerURL;
-import org.gatein.pc.api.PortletURL;
-import org.gatein.pc.api.ResourceURL;
 import org.gatein.pc.api.URLFormat;
 import org.gatein.pc.api.invocation.PortletInvocation;
-import org.gatein.pc.api.spi.InstanceContext;
 import org.gatein.pc.api.spi.PortalContext;
 import org.gatein.pc.api.spi.PortletInvocationContext;
 import org.gatein.pc.api.spi.SecurityContext;
@@ -41,7 +37,9 @@
 import org.gatein.pc.portlet.impl.spi.AbstractPortletInvocationContext;
 import org.gatein.pc.portlet.impl.spi.AbstractServerContext;
 import org.gatein.wsrp.WSRPPortletURL;
+import org.gatein.wsrp.WSRPResourceURL;
 import org.gatein.wsrp.WSRPRewritingConstants;
+import org.gatein.wsrp.WSRPUtils;
 import org.gatein.wsrp.servlet.ServletAccess;
 
 import javax.servlet.http.HttpServletRequest;
@@ -57,7 +55,7 @@
    private SecurityContext securityContext;
    private PortalContext portalContext;
    private UserContext userContext;
-   private InstanceContext instanceContext;
+   private WSRPInstanceContext instanceContext;
    private WindowContext windowContext;
 
    private static final String EQ = "=";
@@ -67,7 +65,7 @@
    private HttpServletResponse response;
 
    public WSRPPortletInvocationContext(MarkupInfo markupInfo, SecurityContext securityContext, PortalContext portalContext, UserContext userContext,
-                                       InstanceContext instanceContext, WindowContext windowContext)
+                                       WSRPInstanceContext instanceContext, WindowContext windowContext)
    {
       super(markupInfo);
 
@@ -97,7 +95,7 @@
       if (url != null && !url.startsWith(WSRPRewritingConstants.BEGIN_WSRP_REWRITE))
       {
          // make root relative URLs absolute. Optimization: we don't recheck the precense of the WSRP token.
-         url = new AbsoluteURLReplacementGenerator(getClientRequest()).getAbsoluteURLFor(url, false);
+         url = WSRPUtils.AbsoluteURLReplacementGenerator.getAbsoluteURLFor(url, false, URLTools.getServerAddressFrom(getClientRequest()));
 
          // properly encode the URL
          url = URLTools.encodeXWWWFormURL(url);
@@ -132,19 +130,15 @@
    {
       if (containerURL != null)
       {
-         if (containerURL instanceof PortletURL)
+         Boolean wantSecureBool = urlFormat.getWantSecure();
+         boolean wantSecure = (wantSecureBool != null ? wantSecureBool : false);
+         WSRPPortletURL url = WSRPPortletURL.create(containerURL, wantSecure);
+         if (url instanceof WSRPResourceURL)
          {
-            PortletURL portletURL = (PortletURL)containerURL;
-
-            Boolean wantSecureBool = urlFormat.getWantSecure();
-            boolean wantSecure = (wantSecureBool != null ? wantSecureBool : false);
-            return WSRPPortletURL.create(portletURL, wantSecure).toString();
+            WSRPResourceURL resourceURL = (WSRPResourceURL)url;
+            resourceURL.buildURLWith(request, instanceContext.getPortletContext());
          }
-         else if (containerURL instanceof ResourceURL)
-         {
-            ResourceURL resourceURL = (ResourceURL)containerURL;
-            throw new NotYetImplemented("ResourceURL support not implemented. Requested URL: " + resourceURL);
-         }
+         return url.toString();
       }
       return null;
    }

Modified: components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/WSRPProducerImpl.java
===================================================================
--- components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/WSRPProducerImpl.java	2010-03-09 01:57:50 UTC (rev 2043)
+++ components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/WSRPProducerImpl.java	2010-03-09 02:19:25 UTC (rev 2044)
@@ -1,6 +1,6 @@
 /*
  * JBoss, a division of Red Hat
- * Copyright 2009, Red Hat Middleware, LLC, and individual
+ * 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.
@@ -444,25 +444,9 @@
    private boolean isRemotable(Portlet portlet)
    {
       Map<String, RuntimeOptionInfo> runtimeOptions = portlet.getInfo().getRuntimeOptionsInfo();
-      RuntimeOptionInfo runtimeOptionInfo = runtimeOptions.get(RuntimeOptionInfo.ORG_JBOSS_PORTLETCONTAINER_REMOTABLE);
+      RuntimeOptionInfo runtimeOptionInfo = runtimeOptions.get(RuntimeOptionInfo.REMOTABLE_RUNTIME_OPTION);
 
       return runtimeOptionInfo != null && "true".equals(runtimeOptionInfo.getValues().get(0));
-
-      /*WSRPInfo wsrpInfo = portletInfo.getAttachment(WSRPInfo.class);
-      if (wsrpInfo != null)
-      {
-         Boolean remotable = wsrpInfo.isRemotable();
-         log.debug("Portlet " + portlet.getContext() + " remotable: " + remotable);
-         if (remotable != null)
-         {
-            return remotable.booleanValue();
-         }
-      }
-      if (isRemotableByDefault() != null)
-      {
-         return isRemotableByDefault().booleanValue();
-      }
-      return false;*/
    }
 
    public List<String> getSupportedLocales()

Deleted: components/wsrp/trunk/producer/src/test/java/org/gatein/wsrp/producer/AbsoluteURLReplacementGeneratorTestCase.java
===================================================================
--- components/wsrp/trunk/producer/src/test/java/org/gatein/wsrp/producer/AbsoluteURLReplacementGeneratorTestCase.java	2010-03-09 01:57:50 UTC (rev 2043)
+++ components/wsrp/trunk/producer/src/test/java/org/gatein/wsrp/producer/AbsoluteURLReplacementGeneratorTestCase.java	2010-03-09 02:19:25 UTC (rev 2044)
@@ -1,65 +0,0 @@
-/*
-* JBoss, a division of Red Hat
-* Copyright 2008, 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;
-
-import junit.framework.TestCase;
-import org.gatein.wsrp.test.support.MockHttpServletRequest;
-
-import static org.gatein.wsrp.producer.AbsoluteURLReplacementGenerator.PORT_END;
-import static org.gatein.wsrp.producer.AbsoluteURLReplacementGenerator.SCH_END;
-import static org.gatein.wsrp.test.support.MockHttpServletRequest.*;
-
-/**
- * @author <a href="mailto:chris.laprun at jboss.com">Chris Laprun</a>
- * @version $Revision$
- */
-public class AbsoluteURLReplacementGeneratorTestCase extends TestCase
-{
-   private AbsoluteURLReplacementGenerator gen;
-
-   @Override
-   protected void setUp() throws Exception
-   {
-      super.setUp();
-
-      gen = new AbsoluteURLReplacementGenerator(MockHttpServletRequest.createMockRequest(null));
-   }
-
-   public void testNonAbsoluteURL()
-   {
-      String url = "foo";
-      assertEquals(url, gen.getAbsoluteURLFor(url));
-   }
-
-   public void testAbsoluteURL()
-   {
-      String url = "/foo";
-      assertEquals(scheme + SCH_END + serverName + PORT_END + serverPort + url, gen.getAbsoluteURLFor(url));
-   }
-
-   public void testWSRPEncodedURL()
-   {
-      String url = "wsrp_rewrite?wsrp-urlType=blockingAction&amp;wsrp-interactionState=JBPNS_/wsrp_rewrite";
-      assertEquals(url, gen.getAbsoluteURLFor(url));
-   }
-}



More information about the gatein-commits mailing list