svn commit: r1087987 - in /struts/sandbox/trunk/struts2-portlet2-plugin/src/main/java/org/apache/struts2/portlet/util: PortletUrlHelper.java PortletUrlHelperJSR286.java

2011-04-02 Thread rgielen
Author: rgielen
Date: Sat Apr  2 10:00:30 2011
New Revision: 1087987

URL: http://svn.apache.org/viewvc?rev=1087987&view=rev
Log:
- Ignore mode namespace for serveResource-URLS, since there is no mode context 
for this type of URL
- refactored out some constants

Modified:

struts/sandbox/trunk/struts2-portlet2-plugin/src/main/java/org/apache/struts2/portlet/util/PortletUrlHelper.java

struts/sandbox/trunk/struts2-portlet2-plugin/src/main/java/org/apache/struts2/portlet/util/PortletUrlHelperJSR286.java

Modified: 
struts/sandbox/trunk/struts2-portlet2-plugin/src/main/java/org/apache/struts2/portlet/util/PortletUrlHelper.java
URL: 
http://svn.apache.org/viewvc/struts/sandbox/trunk/struts2-portlet2-plugin/src/main/java/org/apache/struts2/portlet/util/PortletUrlHelper.java?rev=1087987&r1=1087986&r2=1087987&view=diff
==
--- 
struts/sandbox/trunk/struts2-portlet2-plugin/src/main/java/org/apache/struts2/portlet/util/PortletUrlHelper.java
 (original)
+++ 
struts/sandbox/trunk/struts2-portlet2-plugin/src/main/java/org/apache/struts2/portlet/util/PortletUrlHelper.java
 Sat Apr  2 10:00:30 2011
@@ -57,6 +57,13 @@ public class PortletUrlHelper {
 
 private static final Logger LOG = 
LoggerFactory.getLogger(PortletUrlHelper.class);
 
+protected static final String PORTLETMODE_NAME_EDIT = "edit";
+protected static final String PORTLETMODE_NAME_VIEW = "view";
+protected static final String PORTLETMODE_NAME_HELP = "help";
+
+protected static final String URLTYPE_NAME_ACTION = "action";
+protected static final String URLTYPE_NAME_RESOURCE = "resource";
+
 /**
  * Create a portlet URL with for the specified action and namespace.
  *
@@ -87,7 +94,7 @@ public class PortletUrlHelper {
 PortletRequest request = PortletActionContext.getRequest();
 LOG.debug("Creating url. Action = " + action + ", Namespace = "
 + namespace + ", Type = " + type);
-namespace = prependNamespace(namespace, portletMode);
+namespace = prependNamespace(namespace, portletMode, 
!URLTYPE_NAME_RESOURCE.equalsIgnoreCase(type));
 if (StringUtils.isEmpty(portletMode)) {
 portletMode = 
PortletActionContext.getRequest().getPortletMode().toString();
 }
@@ -142,7 +149,7 @@ public class PortletUrlHelper {
 protected Object createUrl( String scheme, String type, Map portletParams ) {
 RenderResponse response = PortletActionContext.getRenderResponse();
 PortletURL url;
-if ("action".equalsIgnoreCase(type)) {
+if (URLTYPE_NAME_ACTION.equalsIgnoreCase(type)) {
 if (LOG.isDebugEnabled()) LOG.debug("Creating action url");
 url = response.createActionURL();
 }
@@ -164,23 +171,32 @@ public class PortletUrlHelper {
 }
 
 /**
- *
  * Prepend the namespace configuration for the specified namespace and 
PortletMode.
  *
- * @param namespace The base namespace.
- * @param portletMode The PortletMode.
- *
+ * @param namespaceThe base namespace.
+ * @param portletMode  The PortletMode.
+ * @param prependModeNamespace In JSR286, the new URL type resource was 
added, which does not operate in the context
+ * of a portlet mode. If the URL to create is 
of type resource, this parameter should be
+ * set to false. Set it to true in any other 
case.
  * @return prepended namespace.
  */
-private String prependNamespace(String namespace, String portletMode) {
+private String prependNamespace(String namespace, String portletMode, 
boolean prependModeNamespace) {
 StringBuffer sb = new StringBuffer();
-PortletMode mode = PortletActionContext.getRequest().getPortletMode();
-if(StringUtils.isNotEmpty(portletMode)) {
-mode = new PortletMode(portletMode);
+String modeNamespace;
+if (prependModeNamespace) {
+PortletMode mode = 
PortletActionContext.getRequest().getPortletMode();
+if(StringUtils.isNotEmpty(portletMode)) {
+mode = new PortletMode(portletMode);
+}
+modeNamespace = 
(String)PortletActionContext.getModeNamespaceMap().get(mode);
+} else {
+modeNamespace = null;
 }
 String portletNamespace = PortletActionContext.getPortletNamespace();
-String modeNamespace = 
(String)PortletActionContext.getModeNamespaceMap().get(mode);
-if (LOG.isDebugEnabled()) LOG.debug("PortletNamespace: " + 
portletNamespace + ", modeNamespace: " + modeNamespace);
+if (LOG.isDebugEnabled()) {
+LOG.debug("PortletNamespace: " + portletNamespace + ", 
modeNamespace: "
++ (modeNamespace!=null ? modeNamespace : "IGNORED"));
+}
 if(StringUtils.isNotEmpty(portletNamespace)) {
 sb.app

[CONF] Confluence Changes in the last 24 hours

2011-04-02 Thread confluence
This is a daily summary of all recent changes in Confluence.

-
Updated Spaces:
-


Apache Camel (https://cwiki.apache.org/confluence/display/CAMEL)

Pages
-
Camel 2.8.0 Release edited by  davsclaus  (07:36 AM)
https://cwiki.apache.org/confluence/display/CAMEL/Camel+2.8.0+Release

Camel Test edited by  davsclaus  (07:11 AM)
https://cwiki.apache.org/confluence/display/CAMEL/Camel+Test

Cometd edited by  davsclaus  (06:35 AM)
https://cwiki.apache.org/confluence/display/CAMEL/Cometd

EDI edited by  davsclaus  (05:33 AM)
https://cwiki.apache.org/confluence/display/CAMEL/EDI

Smooks edited by  davsclaus  (05:32 AM)
https://cwiki.apache.org/confluence/display/CAMEL/Smooks

camel-jboss edited by  davsclaus  (05:28 AM)
https://cwiki.apache.org/confluence/display/CAMEL/camel-jboss

How do I configure the default maximum cache size for ProducerCache or 
ProducerTemplate edited by  davsclaus  (03:44 AM)
https://cwiki.apache.org/confluence/display/CAMEL/How+do+I+configure+the+default+maximum+cache+size+for+ProducerCache+or+ProducerTemplate

How do I configure the maximum endpoint cache size for CamelContext created by 
davsclaus (03:43 AM)
https://cwiki.apache.org/confluence/display/CAMEL/How+do+I+configure+the+maximum+endpoint+cache+size+for+CamelContext



Apache CXF (https://cwiki.apache.org/confluence/display/CXF)

Pages
-
Setting up Eclipse edited by  gliesian  (09:05 PM)
https://cwiki.apache.org/confluence/display/CXF/Setting+up+Eclipse

Roadmap edited by  gliesian  (08:48 PM)
https://cwiki.apache.org/confluence/display/CXF/Roadmap



OODT (https://cwiki.apache.org/confluence/display/OODT)

Pages
-
OODT Easy Install Development Page edited by  good...@oodt.apache.org  (04:12 
PM)
https://cwiki.apache.org/confluence/display/OODT/OODT+Easy+Install+Development+Page




Change your notification preferences: 
https://cwiki.apache.org/confluence/users/viewnotifications.action