Last modified by Pascal Robert on 2010/09/13 00:29

From version 8.1
edited by Pascal Robert
on 2010/09/13 00:29
Change comment: There is no comment for this version
To version 9.2
edited by Pascal Robert
on 2023/11/13 11:56
Change comment: Updated the relative links.

Summary

Details

Page properties
Parent
... ... @@ -1,0 +1,1 @@
1 +DirectActions Architecture
Content
... ... @@ -1,24 +1,24 @@
1 1  == Overview ==
2 2  
3 -Direct Actions are action methods that can be called without a WOSession. As opposed to Component Actions, where a WOSession is required and various form values are bound as objects, Direct Actions perform much more like traditional web frameworks where the form values are accessed via WORequest's formValues dictionary and cookies. Direct Actions are very useful for building stateless, high-performing websites, though you lose some of the easy-of-development that makes WebObjects provides with [[Component Actions>>Development-Component Actions]].
3 +Direct Actions are action methods that can be called without a WOSession. As opposed to Component Actions, where a WOSession is required and various form values are bound as objects, Direct Actions perform much more like traditional web frameworks where the form values are accessed via WORequest's formValues dictionary and cookies. Direct Actions are very useful for building stateless, high-performing websites, though you lose some of the easy-of-development that makes WebObjects provides with [[Component Actions>>doc:documentation.Development-Component Actions]].
4 4  
5 5  Pages are still generated in the usual way, but if you want the links generated in the page to employ Direct Actions when clicked, ie. to create Direct Action URLs, you must make appropriate bindings.
6 6  
7 7  Direct Actions can be used in conjunction with Sessions if desired, in much the same way that Sessions work with other web technologies - the correct Session object will be located automatically from information in the URL or in a cookie, and state can be obtained and altered in it.
8 8  
9 -Among other things, Direct Actions are typically used if no Session whatsoever is desired (uses less resource), or if bookmarkable or easily created URLs are required. DirectActions are also often used to provide multiple entry points to your application, each with it's own URL~-~--but then subsequently returning components that use the ordinary [[Component Actions>>Development-Component Actions]].
9 +Among other things, Direct Actions are typically used if no Session whatsoever is desired (uses less resource), or if bookmarkable or easily created URLs are required. DirectActions are also often used to provide multiple entry points to your application, each with it's own URL~-~--but then subsequently returning components that use the ordinary [[Component Actions>>doc:documentation.Development-Component Actions]].
10 10  
11 -Direct Actions would also be good to use if you don't need the additional convenience of the [[Component Actions>>Development-Component Actions]], simply because they come without any of its disadvantages. However, it's quite difficult to create a whole WO application without creating a WOSession and most of the time, you're going to need it anyway.
11 +Direct Actions would also be good to use if you don't need the additional convenience of the [[Component Actions>>doc:documentation.Development-Component Actions]], simply because they come without any of its disadvantages. However, it's quite difficult to create a whole WO application without creating a WOSession and most of the time, you're going to need it anyway.
12 12  
13 13  == David LeBer's Articles ==
14 14  
15 15  David LeBer has a great series of articles on using Direct Actions:
16 16  
17 -1. [[Using WebObjects DirectActions pt. 1>>http://david.codeferous.com/?p=63]]
18 -1. [[Using WebObjects DirectActions pt. 2>>http://david.codeferous.com/?p=70]]
19 -1. [[Calling a DirectAction with values from a form>>http://david.codeferous.com/?p=77]]
20 -1. [[Calling a DirectAction with values from a WOHyperlink>>http://david.codeferous.com/?p=91]]
21 -1. [[Calling a DirectAction with values from a WORedirect>>http://david.codeferous.com/?p=105]]
17 +1. [[Using WebObjects DirectActions pt. 1>>url:http://david.codeferous.com/?p=63||shape="rect"]]
18 +1. [[Using WebObjects DirectActions pt. 2>>url:http://david.codeferous.com/?p=70||shape="rect"]]
19 +1. [[Calling a DirectAction with values from a form>>url:http://david.codeferous.com/?p=77||shape="rect"]]
20 +1. [[Calling a DirectAction with values from a WOHyperlink>>url:http://david.codeferous.com/?p=91||shape="rect"]]
21 +1. [[Calling a DirectAction with values from a WORedirect>>url:http://david.codeferous.com/?p=105||shape="rect"]]
22 22  
23 23  == Notes ==
24 24  
... ... @@ -25,4 +25,4 @@
25 25  This page is a place to put notes and tips you've found useful when using direct actions.
26 26  
27 27  * For a quick tour using direct actions see (on Mac OS X, WO 5.x): /Developer/Examples/JavaWebObjects/ThinkMovies
28 -* When using direct actions in conjunction with a form that contains WOText or textarea elements you'll have to remove any (soft returns) that are sent back from the client yourself. In a component action page the WOText element takes care of this for you, but when you pull the value from the request's form values yourself you need to handle the soft returns on your own. You should likely just convert them to .
28 +* When using direct actions in conjunction with a form that contains WOText or textarea elements you'll have to remove any \r\n (soft returns) that are sent back from the client yourself. In a component action page the WOText element takes care of this for you, but when you pull the value from the request's form values yourself you need to handle the soft returns on your own. You should likely just convert them to \n.