• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Component action context().hasSession() returns false? [Was Re: context().hasSession() returns false... then true?]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Component action context().hasSession() returns false? [Was Re: context().hasSession() returns false... then true?]


  • Subject: Re: Component action context().hasSession() returns false? [Was Re: context().hasSession() returns false... then true?]
  • From: Rams <email@hidden>
  • Date: Mon, 30 Jun 2008 11:51:14 -0400

I'd like to say upfront that I'm no longer considering Tomcat a viable option for me. I will detail my problems with it further for anyone interested, but I now need to work through the Java Monitor/wotaskd tutorials to replace my appserver. I'm hoping that replacing the appserver will yield behavior that is more consistent with the development environment.

On Jun 29, 2008, at 8:43 PM, Lachlan Deck wrote:

On 28/06/2008, at 1:20 AM, Rams wrote:

Hi everyone...

I should add, I am currently using component actions. I'm not defaulting to direct actions yet... so I'm under the impression that there should always be a session present.

Not always so. But you can force a session to be invoked by referencing session() in your component.

The only time session() is called in my Main WO or any of it's embedded components, is in the authenticated method.


public Boolean authenticated() {
return (context().hasSession() && session().valueForKey(User.ENTITY_NAME.toLowerCase()) != null);
}


But since I'm logging session creation in the Session() constructor, I know one should already exists. context().hasSession() is returning false even though a session exists. Here's what my Main WO looks like:

<wo:PageWrapper>
	<ul>
	<wo:if condition = "$authenticated>
		<wo:link directActionName = "logout" 1
		2
		3
	</wo:if>
	<wo:else>
		<wo:link pageName = "Login" 4
		5
		6
	</wo:else>
	<wo:link 7>

	<wo:ERXBatchNavigationBar>
	<wo:loop>
	<wo:MyStatelessDisplayItem authenticated = "$authenticated" >
	</wo:loop>

</wo:PageWrapper>

I only check context().hasSession() now because I had planned to move to direct actions at a future date. At least Tomcat is failing consistently at the same places, so I guess that's a small ray of hope.

Failing how?


Miserably! ;-) I click my login link (let's say link 4), which takes me to my login component. I'm returned to my main page after submitting valid credentials to a component action. There I am presented with links 1, 2, 3. After that, failures begin. For example, clicking my logout directaction link, context().hasSession() evals to false and logout fails to session().terminate().

	public WOActionResults logoutAction() {
		if(context().hasSession()) {
			NSLog.out.appendln("Terminating session: " + session().sessionID());
			session().terminate();
		}

WORedirect mainPage = (WORedirect) pageWithName(WORedirect.class.getName());
mainPage.setUrl(
context().directActionURLForActionNamed(
"default", new NSDictionary<Object,Object>(Boolean.FALSE, "wosid")));


	    return mainPage;
	}

When I come back to main, the first call to $auth evals to false, then subsequent calls eval to true making all MyStatelessDisplayItems display as logged in. I log session creation in the Session constructor, so I know there is no new session being created. What I find even more wonky is that clicking link 4 to go to the login page again does not take me to my login component at all. It refreshes main and gives me link 1, 2, 3.

All of this works fine on the dev machine. It fails consistently, in the same places, on the Tomcat deployment.

But at this point, I think using Tomcat is just going to be a thoroughly bad idea. Aside from the app simply not working in a manner consistent with the development environment, I have other reservations about using Tomcat. The JSessionID, in particular, bothers me. I *have* to have a second, useless session object adding overhead to my app? AND it's probably going to bork my search engine rankings by adding that uselessness to the URL when cookies are disabled?

Needless to say, my patience with Tomcat is pretty much exhausted. I'm hoping Java Monitor and wotaskd can give me results that are a little more consistent with the development environment :-)

However, thanks again to everyone who has responded! I do appreciate all the help.

Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Component action context().hasSession() returns false? [Was Re: context().hasSession() returns false... then true?]
      • From: Lachlan Deck <email@hidden>
References: 
 >context().hasSession() returns false... then true? (From: Rams <email@hidden>)
 >Re: context().hasSession() returns false... then true? (From: Don Lindsay <email@hidden>)
 >Re: context().hasSession() returns false... then true? (From: Rams <email@hidden>)
 >Component action context().hasSession() returns false? [Was Re: context().hasSession() returns false... then true?] (From: Rams <email@hidden>)
 >Re: Component action context().hasSession() returns false? [Was Re: context().hasSession() returns false... then true?] (From: Lachlan Deck <email@hidden>)

  • Prev by Date: Fwd: WebObjects take on GWT?
  • Next by Date: Re: Problems deploying app on Leopard server
  • Previous by thread: Re: Component action context().hasSession() returns false? [Was Re: context().hasSession() returns false... then true?]
  • Next by thread: Re: Component action context().hasSession() returns false? [Was Re: context().hasSession() returns false... then true?]
  • Index(es):
    • Date
    • Thread