I like that idea actually, moving this logic into an interceptor, but i still think ActionContext.getContext().getSession() should not be returning null when used in a sitemesh decorator.

Jason Carreira wrote:
You could have it populate this boolean during execution, or pull this
into an Interceptor. I don't think leaving around leftover state in a
ThreadLocal is the way to go, though...


-----Original Message-----
From: Francisco Hernandez [mailto:[EMAIL PROTECTED] Sent: Friday, December 05, 2003 11:23 AM
To: [EMAIL PROTECTED]
Subject: Re: [OS-webwork] in DefaultActionProxy.execute() whats the purpose of the nestedContext and WW-407?



the tags work fine in sitemesh decorators as it stands, but the problem is that i need to use
ActionContext.getContext().getSession() and that returns null when used inside of a sitemesh decorator


Im using ActionContext.getContext().getSession() inside the decorator to do the typical checking of the session to see if theres a user logged in or not and display the appropriate links ie: login, register or logout, edit profile

all of this checking of the user is implemented as a method getLoggedInUser in my BaseAction, this is what I was using before I started using sitemesh and using ugly includes.


Jason Carreira wrote:


The purpose is for each ActionInvocation to have its own

ActionContext


which is only active while the ActionInvocation is being

executed (as


managed by the ActionProxy).

If, for instance, you chain to another Action, that nested Action should have its own ActionContext which is available while it is executing, and which should be reset to the parent

ActionInvocation's


ActionContext when the nested Action is done.

The problem you're seeing is probably due to not having

gone through


any type of Dispatcher yet to set the request and response into the ActionContext. The reason you're seeing 1 of 2 objects is probably because your servlet container has just 2 execution threads

which is


cycles through, and each one has a default ActionContext

ThreadLocal


(which is probably never used, except for in your Sitemesh filters, because a new one will be created and associated for the ActionInvocation when it gets to the ServletDispatcher to

execute an


Action, and then the default set back after it's done executing the result, but before the Sitemesh filter activates).

I think the solution to your problem is to use the request

directly in


your sitemesh code... I'll let Patrick comment more, since he was refactoring the tags and stuff to work with Sitemesh.

Jason



-----Original Message-----
From: Francisco Hernandez [mailto:[EMAIL PROTECTED]
Sent: Friday, December 05, 2003 12:22 AM
To: [EMAIL PROTECTED]
Subject: [OS-webwork] in DefaultActionProxy.execute() whats the purpose of the nestedContext and WW-407?



the issue: http://jira.opensymphony.com/secure/ViewIssue.jspa?key=WW-407


heres the method, whats the purpose of nestedContext?
-------------
public String execute() throws Exception {
ActionContext nestedContext = ActionContext.getContext();

ActionContext.setContext(invocation.getInvocationContext());


String retCode = null;

       try {
           retCode = invocation.invoke();
       } finally {
           ActionContext.setContext(nestedContext);
       }

       return retCode;
   }
--------------


the problems im having and described and shown in the app attached for WW-407 go away after i comment out the line: ActionContext.setContext(nestedContext);

another thing i've noticed is that with
ActionContext.getContext always returns either one of two objects, always alternating for every request (this is when used inside a sitemesh decorator)







-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/ _______________________________________________
Opensymphony-webwork mailing list [EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork





-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help

you create


better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/ _______________________________________________
Opensymphony-webwork mailing list [EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork









-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/ _______________________________________________
Opensymphony-webwork mailing list [EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork





------------------------------------------------------- This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/ _______________________________________________ Opensymphony-webwork mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork








------------------------------------------------------- This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/ _______________________________________________ Opensymphony-webwork mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork

Reply via email to