You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Hubert Rabago <hr...@gmail.com> on 2005/06/04 18:27:03 UTC

Transient ActionServlet in Action class

I would like to commit the change illustrated below this message, but
I'm checking first if anybody would object.  This should provide add'l
flexibility in the handling of Action classes.

Hubert


Index: apache/struts/action/Action.java
===================================================================
--- apache/struts/action/Action.java	(revision 179983)
+++ apache/struts/action/Action.java	(working copy)
@@ -93,7 +93,7 @@
     /**
      * <p>The servlet to which we are attached.</p>
      */
-    protected ActionServlet servlet = null;
+    protected transient ActionServlet servlet = null;
 
 
Index: apache/struts/chain/commands/servlet/CreateAction.java
===================================================================
--- apache/struts/chain/commands/servlet/CreateAction.java	(revision 179983)
+++ apache/struts/chain/commands/servlet/CreateAction.java	(working copy)
@@ -65,13 +65,15 @@
             if (action == null) {
                 log.info("Initialize action of type: " + type);
                 action = (Action) ClassUtils.getApplicationInstance(type);
-                ServletActionContext saContext =
(ServletActionContext) context;
-                ActionServlet actionServlet = saContext.getActionServlet();
-                action.setServlet(actionServlet);
                 actions.put(type, action);
             }
         }
 
+        if (action.getServlet() == null) {
+            ServletActionContext saContext = (ServletActionContext) context;
+            ActionServlet actionServlet = saContext.getActionServlet();
+            action.setServlet(actionServlet);
+        }
 
         return (action);
 
Index: apache/struts/action/RequestProcessor.java
===================================================================
--- apache/struts/action/RequestProcessor.java	(revision 179983)
+++ apache/struts/action/RequestProcessor.java	(working copy)
@@ -296,10 +296,13 @@
                 return (null);
             }
 
-            instance.setServlet(this.servlet);
             actions.put(className, instance);
         }
 
+        if (instance.getServlet() == null) {
+            instance.setServlet(this.servlet);
+        }
+
         return (instance);
 
     }

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Re: Transient ActionServlet in Action class

Posted by Joe Germuska <Jo...@Germuska.com>.
At 11:27 AM -0500 6/4/05, Hubert Rabago wrote:
>I would like to commit the change illustrated below this message, but
>I'm checking first if anybody would object.  This should provide add'l
>flexibility in the handling of Action classes.

I thought I had done that already!  -- No, I think I did it for 
ActionForm.  In any case, I think it's good.

Joe


>Hubert
>
>
>Index: apache/struts/action/Action.java
>===================================================================
>--- apache/struts/action/Action.java	(revision 179983)
>+++ apache/struts/action/Action.java	(working copy)
>@@ -93,7 +93,7 @@
>      /**
>       * <p>The servlet to which we are attached.</p>
>       */
>-    protected ActionServlet servlet = null;
>+    protected transient ActionServlet servlet = null;
>
>
>Index: apache/struts/chain/commands/servlet/CreateAction.java
>===================================================================
>--- apache/struts/chain/commands/servlet/CreateAction.java 
>	(revision 179983)
>+++ apache/struts/chain/commands/servlet/CreateAction.java	(working copy)
>@@ -65,13 +65,15 @@
>              if (action == null) {
>                  log.info("Initialize action of type: " + type);
>                  action = (Action) ClassUtils.getApplicationInstance(type);
>-                ServletActionContext saContext =
>(ServletActionContext) context;
>-                ActionServlet actionServlet = saContext.getActionServlet();
>-                action.setServlet(actionServlet);
>                  actions.put(type, action);
>              }
>          }
>
>+        if (action.getServlet() == null) {
>+            ServletActionContext saContext = (ServletActionContext) context;
>+            ActionServlet actionServlet = saContext.getActionServlet();
>+            action.setServlet(actionServlet);
>+        }
>
>          return (action);
>
>Index: apache/struts/action/RequestProcessor.java
>===================================================================
>--- apache/struts/action/RequestProcessor.java	(revision 179983)
>+++ apache/struts/action/RequestProcessor.java	(working copy)
>@@ -296,10 +296,13 @@
>                  return (null);
>              }
>
>-            instance.setServlet(this.servlet);
>              actions.put(className, instance);
>          }
>
>+        if (instance.getServlet() == null) {
>+            instance.setServlet(this.servlet);
>+        }
>+
>          return (instance);
>
>      }
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
>For additional commands, e-mail: dev-help@struts.apache.org


-- 
Joe Germuska            
Joe@Germuska.com  
http://blog.germuska.com    
"Narrow minds are weapons made for mass destruction"  -The Ex

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org