Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: Direct Action App Editing Context management?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Direct Action App Editing Context management?



I guess that I did not do that because that page is used in other circumstances too. It could probably be made to work there too.

Chuck


On Feb 9, 2005, at 1:24 PM, Anjo Krank wrote:


Am 09.02.2005 um 21:42 schrieb Chuck Hill:

You might find the sections in Practical WebObjects on this topic of use.

If you are using direct actions _without_ a session, there is only the appendToResponse phase. If the page generated contains component actions then a session is created and so you would handle locking normally. If the page contains only direct actions, the pattern is:

- create the EC,
- lock the EC
- create and configure the return page
- call generateResponse on the return page
- unlock the ec
- dispose the ec
- return the previously generated response _NOT_ the page!

You might as well override appendToResponse in your page:

public void appendToResponse(..) {
	ec = new EOEditingContext();
	ec.lock();
	try {
		// pull values from request, configure, whatever
		super.appendToResponse(..);
	} finally {
		ec.unlock();
	}
}

and return the page. Looks a lot easier to me, and all the code is in one place...

Cheers, Anjo


--
Practical WebObjects - a book for intermediate WebObjects developers who want to increase their overall knowledge of WebObjects, or those who are trying to solve specific application development 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


References: 
 >Direct Action App Editing Context management? (From: Kieran Kelleher <email@hidden>)
 >Re: Direct Action App Editing Context management? (From: Chuck Hill <email@hidden>)
 >Re: Direct Action App Editing Context management? (From: Anjo Krank <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.