• 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: Can't retrieve cookies
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can't retrieve cookies


  • Subject: Re: Can't retrieve cookies
  • From: Chuck Hill <email@hidden>
  • Date: Mon, 7 Jan 2008 10:29:11 -0800


On Jan 6, 2008, at 2:49 PM, Jeff Schmitz wrote:

Hello,
I'm trying to retrieve a previously set cookie from my browser with the following code on my developement machine. I do see the cookie my browser when I do Show Cookies. I'm launching my app from WOLIPS (i.e. it uses the randomly generated port number instead of 80),

Not quite. The correct statement is "I'm launching my app in Direct Connect mode, so it uses the randomly generated port number instead of 80". Look on the WO tab of the launch configuration and uncheck WODirectConnectEnabled true.



but I never see the cookies. Does using the different ports mess the cookie processing up in the browser?

It might, I am not sure. I don't use direct connect.


I'm setting and trying to read the cookie on the same run, so the port isn't changing between when the cookie is set and when I try to access it. Note also that I'm just using the hardcoded IP address of my development machine for the domain, should this be ok?

More details - Here's the code I'm using (inside my DirectAction class) to just try and retrieve and print the cookie data. The Form parameters come over fine, but I never see the cookies:

	public WOActionResults loginAction() {
		// Using formValues()
		WOActionResults returnPage;
		NSDictionary formVals = this.request().formValues();
		System.out.println("login Hyperlink values: " + formVals);
		System.out.println("login cookie values: "
				+ this.request().cookieValues().toString());
         }

I've tried setting the cookie various ways (shown below), and they all seem to work as I can show the cookie in my browser, although they end up with different domains (192.168.15.106, vs . 192.168.15.106) and paths depending on the method used to set the cookie:

public void appendToResponse(WOResponse response, WOContext context) {
// set cookies to remember details
System.out.println("In append to Response pool login: " + session.poolName);
if (savePoolInfo) {


NSTimestamp expires = new NSTimestamp()
.timestampByAddingGregorianUnits(1, 0, 0, 0, 0, 0);
WOCookie poolCookie = new WOCookie("POOL", session.poolName, "/", "192.168.15.106", expires, true);

Try using null instead of the IP address, let the browser figure out what the correct value is.




// WOCookie poolCookie = new WOCookie("POOL", session.poolName);
// poolCookie.setExpires(expires);


            // set timeOuts
            response.addCookie(poolCookie);
        }
        super.appendToResponse(response, context);
    }

Any ideas?


Chuck

--

Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
http://www.global-village.net/products/practical_webobjects






_______________________________________________
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: Can't retrieve cookies
      • From: Guido Neitzer <email@hidden>
References: 
 >Question about WODirectConnectEnabled=false/true (From: "Ren, Kevin" <email@hidden>)
 >Re: Question about WODirectConnectEnabled=false/true (From: Chuck Hill <email@hidden>)
 >Can't retrieve cookies (From: Jeff Schmitz <email@hidden>)

  • Prev by Date: Re: WOComponent children
  • Next by Date: Tips for deployment under jBoss 5.2.2, Java 1.5?
  • Previous by thread: Re: Can't retrieve cookies
  • Next by thread: Re: Can't retrieve cookies
  • Index(es):
    • Date
    • Thread