Session ID and REST calls

2012-07-06 Thread Pascal Robert
Tip: if you are using sessions for your REST calls, and you need to read that 
session ID from your JavaScript client application, be aware that the path in 
the cookie will be /cgi-bin/WebObjects/something.woa/..., so if you try to 
check if the cookie is available in your JavaScript app, it won't work since 
the path of your JS app is probably not in /cgi-bin/WebObjects. 

So don't forget to change the path of the cookie, with a call like this in your 
Session class:

public void _appendCookieToResponse(WOResponse aResponse) {
  super._appendCookieToResponse(aResponse);
  if (storesIDsInCookies()) {
for (WOCookie cookie: aResponse.cookies()) {
  if (wosid.equals(cookie.name())) {
cookie.setPath(/);
  }
}
  }
}
 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Session ID and REST calls

2012-07-06 Thread Ted Archibald
Is there a reason you are setting the path like that, instead of overriding
domainForIDCookies()?

e.g.

@Override

  public String domainForIDCookies() {

return ERXApplication.isDevelopmentModeSafe() ? super.domainForIDCookies()
: / + AppName ;

  }

On Fri, Jul 6, 2012 at 9:59 AM, Pascal Robert prob...@macti.ca wrote:

 Tip: if you are using sessions for your REST calls, and you need to read
 that sesesion ID from your JavaScript client application, be aware that the
 path in the cookie will be /cgi-bin/WebObjects/something.woa/..., so if you
 try to check if the cookie is available in your JavaScript app, it won't
 work since the path of your JS app is probably not in /cgi-bin/WebObjects.

 So don't forget to change the path of the cookie, with a call like this in
 your Session class:

 public void _appendCookieToResponse(WOResponse aResponse) {
   super._appendCookieToResponse(aResponse);
   if (storesIDsInCookies()) {
 for (WOCookie cookie: aResponse.cookies()) {
   if (wosid.equals(cookie.name())) {
 cookie.setPath(/);
   }
 }
   }
 }
  ___
 Do not post admin requests to the list. They will be ignored.
 Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
 Help/Unsubscribe/Update your Subscription:

 https://lists.apple.com/mailman/options/webobjects-dev/ted.archibald%40gmail.com

 This email sent to ted.archib...@gmail.com

 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Session ID and REST calls

2012-07-06 Thread Pascal Robert
The only reason is that I didn't know that method :-)

 Is there a reason you are setting the path like that, instead of overriding 
 domainForIDCookies()?
 
 e.g. 
 @Override
   public String domainForIDCookies() {
 return ERXApplication.isDevelopmentModeSafe() ? 
 super.domainForIDCookies() : / + AppName ;
   }
 
 On Fri, Jul 6, 2012 at 9:59 AM, Pascal Robert prob...@macti.ca wrote:
 Tip: if you are using sessions for your REST calls, and you need to read that 
 sesesion ID from your JavaScript client application, be aware that the path 
 in the cookie will be /cgi-bin/WebObjects/something.woa/..., so if you try to 
 check if the cookie is available in your JavaScript app, it won't work since 
 the path of your JS app is probably not in /cgi-bin/WebObjects.
 
 So don't forget to change the path of the cookie, with a call like this in 
 your Session class:
 
 public void _appendCookieToResponse(WOResponse aResponse) {
   super._appendCookieToResponse(aResponse);
   if (storesIDsInCookies()) {
 for (WOCookie cookie: aResponse.cookies()) {
   if (wosid.equals(cookie.name())) {
 cookie.setPath(/);
   }
 }
   }
 }
  ___
 Do not post admin requests to the list. They will be ignored.
 Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/webobjects-dev/ted.archibald%40gmail.com
 
 This email sent to ted.archib...@gmail.com
 


 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com