Commits

Anonymous committed 9bee7c0

Issue number: WW-1331

Fixed problems with initialization of portlet support, and broken validation.

git-svn-id: http://svn.opensymphony.com/svn/webwork/trunk@2685573baa09-0c28-0410-bef9-dab3c582ae83

Comments (0)

Files changed (3)

src/java/com/opensymphony/webwork/dispatcher/DispatcherUtils.java

             LOG.debug("Parameter access work-around disabled.");
         }
 
-        // Check wether portlet support is active or not by trying to get "javax.portlet.PortletRequest"
-        try {
-            Class clazz = ClassLoaderUtil.loadClass("javax.portlet.PortletRequest", DispatcherUtils.class);
-            portletSupportActive = true;
-            if (LOG.isInfoEnabled()) {
-                LOG.info("Found portlet-api. Activating webwork's portlet support");
-            }
-        } catch (Exception e) {
-            if (LOG.isInfoEnabled()) {
-                LOG.info("Could not load portlet-api, disabling webwork's portlet support.");
-            }
-        }
     }
 
     /**
         return portletSupportActive;
     }
 
+    /**
+     * Set the flag that portlet support is active or not.
+     * @param portletSupportActive <tt>true</tt> or <tt>false</tt>
+     */
+    public static void setPortletSupportActive(boolean portletSupportActive) {
+        DispatcherUtils.portletSupportActive = portletSupportActive;
+    }
 }

src/java/com/opensymphony/webwork/portlet/dispatcher/DirectRenderFromEventAction.java

  */
 package com.opensymphony.webwork.portlet.dispatcher;
 
-import com.opensymphony.xwork.ActionSupport;
+import com.opensymphony.xwork.Action;
 
 /**
  * When a portlet is targetted for an <code>event</code>, the portlet will receive two 
  * 
  * @author Nils-Helge Garli
  */
-public class DirectRenderFromEventAction extends ActionSupport {
+public class DirectRenderFromEventAction implements Action {
+    
     private String location = null;
 
     /**
     public void setLocation(String location) {
         this.location = location;
     }
+
+    /**
+     * @see com.opensymphony.xwork.Action#execute()
+     */
+    public String execute() throws Exception {
+        return SUCCESS;
+    }
 }

src/java/com/opensymphony/webwork/portlet/dispatcher/Jsr168Dispatcher.java

 import com.opensymphony.webwork.WebWorkConstants;
 import com.opensymphony.webwork.config.Configuration;
 import com.opensymphony.webwork.dispatcher.ApplicationMap;
+import com.opensymphony.webwork.dispatcher.DispatcherUtils;
 import com.opensymphony.webwork.dispatcher.RequestMap;
 import com.opensymphony.webwork.dispatcher.SessionMap;
 import com.opensymphony.webwork.dispatcher.mapper.ActionMapping;
     private Map actionMap = new HashMap(3);
 
     private String portletNamespace = null;
+    
+    private boolean devMode = false;
 
     /**
      * Initialize the portlet with the init parameters from <tt>portlet.xml</tt>
                 .getString(WebWorkConstants.WEBWORK_CONFIGURATION_XML_RELOAD))) {
             FileManager.setReloadingConfigs(true);
         }
+        
+        if ("true".equals(Configuration.get(WebWorkConstants.WEBWORK_DEVMODE))) {
+            devMode = true;
+            Configuration.set(WebWorkConstants.WEBWORK_I18N_RELOAD, "true");
+            Configuration.set(WebWorkConstants.WEBWORK_CONFIGURATION_XML_RELOAD, "true");
+        }
 
         if (Configuration.isSet(WebWorkConstants.WEBWORK_OBJECTFACTORY)) {
             String className = (String) Configuration
                         + ". Using default ObjectFactory.", e);
             }
         }
+        DispatcherUtils.setPortletSupportActive(true);
     }
 
     /**
         }
         extraContext.put(ActionContext.LOCALE, locale);
 
+        extraContext.put(ActionContext.DEV_MODE, Boolean.valueOf(devMode));
         extraContext.put(WebWorkConstants.WEBWORK_PORTLET_CONTEXT, getPortletContext());
         extraContext.put(REQUEST, request);
         extraContext.put(RESPONSE, response);
                 ActionProxy action = (ActionProxy) request.getPortletSession()
                         .getAttribute(EVENT_ACTION);
                 if (action != null) {
-                    Action currentAction = (Action)proxy.getInvocation().getAction();
                     OgnlValueStack stack = proxy.getInvocation().getStack();
                     Object top = stack.pop();
                     stack.push(action.getInvocation().getAction());
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.