Author: woonsan
Date: Wed Oct  3 20:54:22 2007
New Revision: 581768

URL: http://svn.apache.org/viewvc?rev=581768&view=rev
Log:
[PB-74] Safe creation of context in GenericVelocityPortlet for JS2's new 
feature, auto-dispatching for edit_defaults mode.
GenericVelocityPortlet#setupPreferencesEdit() method invoked in doEdit() phase. 
I added safer method, getContext(RenderRequest, RenderResponse). So, if the 
context is null, then it will initialize the context. (The context can be null 
when GenericVelocityPortlet#render() is not called.)

Modified:
    
portals/bridges/trunk/velocity/src/java/org/apache/portals/bridges/velocity/GenericVelocityPortlet.java

Modified: 
portals/bridges/trunk/velocity/src/java/org/apache/portals/bridges/velocity/GenericVelocityPortlet.java
URL: 
http://svn.apache.org/viewvc/portals/bridges/trunk/velocity/src/java/org/apache/portals/bridges/velocity/GenericVelocityPortlet.java?rev=581768&r1=581767&r2=581768&view=diff
==============================================================================
--- 
portals/bridges/trunk/velocity/src/java/org/apache/portals/bridges/velocity/GenericVelocityPortlet.java
 (original)
+++ 
portals/bridges/trunk/velocity/src/java/org/apache/portals/bridges/velocity/GenericVelocityPortlet.java
 Wed Oct  3 20:54:22 2007
@@ -187,10 +187,22 @@
     {
         return (Context) request.getAttribute(PORTLET_BRIDGE_CONTEXT);
     }
+    
+    public Context getContext(RenderRequest request, RenderResponse response)
+    {
+        Context context = (Context) 
request.getAttribute(PORTLET_BRIDGE_CONTEXT);
+        
+        if (context == null)
+        {
+            context = createPortletVelocityContext(request, response);
+        }
+        
+        return context;
+    }
 
     public void setupPreferencesEdit(RenderRequest request, RenderResponse 
response)
     {
-        Context context = getContext(request);
+        Context context = getContext(request, response);
         PortletPreferences prefs = request.getPreferences();
         Map map = prefs.getMap();
         Iterator it = map.entrySet().iterator();



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to