WO Context() null in Session Constructor
Hi all, I'm probably not remembering my WO request/response loop correctly. When a WO Session is created I'd like to find out the host name of the request so I tried to log that info in the Session's constructor (see code snippet below). Unfortunately, the context() is null at this point. Where's the best place to figure out the remote host that created a session if not in the session's constructor? Thanks, Joe public Session() { super(); NSLog.debug.appendln(== Session Created ==); this.setStoresIDsInCookies(true); this.setStoresIDsInURLs(false); this.setDefaultEditingContext( ERXEC.newEditingContext() ); String remoteHostName = this.context().request().headerForKey(remote_host); NSLog.debug.appendln(Remote host name = + remoteHostName); } ___ 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: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: WO Context() null in Session Constructor
That information is not available until awake() is called. On Oct 25, 2010, at 10:55 AM, Joe Moreno wrote: Hi all, I'm probably not remembering my WO request/response loop correctly. When a WO Session is created I'd like to find out the host name of the request so I tried to log that info in the Session's constructor (see code snippet below). Unfortunately, the context() is null at this point. Where's the best place to figure out the remote host that created a session if not in the session's constructor? Thanks, Joe public Session() { super(); NSLog.debug.appendln(== Session Created ==); this.setStoresIDsInCookies(true); this.setStoresIDsInURLs(false); this.setDefaultEditingContext( ERXEC.newEditingContext() ); String remoteHostName = this.context().request().headerForKey(remote_host); NSLog.debug.appendln(Remote host name = + remoteHostName); } ___ 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: http://lists.apple.com/mailman/options/webobjects-dev/chill%40global-village.net This email sent to ch...@global-village.net -- Chuck Hill Senior Consultant / VP Development 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 smime.p7s Description: S/MIME cryptographic signature ___ 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: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: WO Context() null in Session Constructor
On 2010-10-25, at 3:37 PM, Chuck Hill wrote: That information is not available until awake() is called. And assuming you don't need it until after that anyway, why not either just ask for it when you need it or lazily obtain and the cache its value in the accessor? i.e: public String remoteHostName() { if (_remoteHostName == null) { _remoteHostName = ...; } return _remoteHostName; } On Oct 25, 2010, at 10:55 AM, Joe Moreno wrote: Hi all, I'm probably not remembering my WO request/response loop correctly. When a WO Session is created I'd like to find out the host name of the request so I tried to log that info in the Session's constructor (see code snippet below). Unfortunately, the context() is null at this point. Where's the best place to figure out the remote host that created a session if not in the session's constructor? Thanks, Joe public Session() { super(); NSLog.debug.appendln(== Session Created ==); this.setStoresIDsInCookies(true); this.setStoresIDsInURLs(false); this.setDefaultEditingContext( ERXEC.newEditingContext() ); String remoteHostName = this.context().request().headerForKey(remote_host); NSLog.debug.appendln(Remote host name = + remoteHostName); } ___ 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: http://lists.apple.com/mailman/options/webobjects-dev/chill%40global-village.net This email sent to ch...@global-village.net -- Chuck Hill Senior Consultant / VP Development 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 (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/dleber_wodev%40codeferous.com This email sent to dleber_wo...@codeferous.com ;david -- David LeBer Codeferous Software 'co-def-er-ous' adj. Literally 'code-bearing' site: http://codeferous.com blog: http://davidleber.net profile:http://www.linkedin.com/in/davidleber twitter:http://twitter.com/rebeld -- Toronto Area Cocoa / WebObjects developers group: http://tacow.org ___ 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: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com