On 01/04/2008, at 2:14 PM, Mike Schrag wrote:
We have something similar to Rails routes/controllers coming to Wonder sometime soon for the more directaction-y case ... We've been using them for a couple months, but it just hasn't made it upstream yet. So you can do things likeNo -- this is a component action, not a direct action (it has to have the object being referenced).Right, overlooked that.If you want to do it on a direct action, just do a normal hyperlink with ?personID=person.primaryKey and reload the person in the DA.Yeah, that's what I was doing but I liked the elegance of ERXDataHyperlink.<wo:EntityLink record = "$person">link to person</wo:EntityLink><wo:EntityLink record = "$person" type = "xml">link to person</ wo:EntityLink> <wo:EntityLink entityName = "Person" action = "list">people</ wo:EntityLink> <wo:EntityLink entityName = "Person" action = "create">people</ wo:EntityLink>
Nice. Yeah I've got something similar...
BatchLink : DynamicDirectAction {
object = parentPage.pageTag;
actionClass = "List";
directActionName = pluralEntityName.toLowerCase;
queryPrefix = "tag"; /* creates e.g., ?tag=234[&tag=34...] */
?page = listItem;
}
which is later transformed, IIRC, to .../pluralEntityName/path/to/tag
and it will look for page components (named by convention, though they must implement a particular interface as a security measure). So for instance it will look for PersonListXmlPage, or PersonListPage (for standard HTML) and generate URLs like /entity/ Person/5 or /entity/Person/list or /entity/Person/create. You can also map query string parameters to component methods by annotating certain methods of your component with an @EntityParameter annotation. In code, you can have your action methods return things like:return EntityActionFactory.redirectForEntity(EntityRouter.LIST, AdCategory.ENTITY_NAME, context(), false);so you can easily redirect to nice URLs after performing certain actions. You can also register custom entity routers so you can process the "id" part in special ways (for instance we have it hooked to ERTaggable with a custom EntityRouter that does /entity/ Tag/accounting and it will return the entities tagged "accounting".None of this is magic by any means, it's just a convenient handful of classes for doing it easily. What I like about them is that it makes it very easy to mix and match normal component actions with easy RESTful style URLs whenever it makes sense to do so.
Cool. That will be nice.If it's of any interest what I did was override the direct action request handler to figure out which DirectAction class to use (Detail, List). You can see this in action here, for example: http://www.sydneycommunitycollege.com.au/
The rules are quite simple:- if DirectAction action class and actionName exist use as is (e.g., .../wa/[DirectAction/]default)
- else if we have a plural entity name to start --> List
e.g., http://www.sydneycommunitycollege.com.au/courses/arts/drama
- else if we have a singular entity name to start --> Detail
http://www.sydneycommunitycollege.com.au/course/ardr1
- else assume we might have a tag-path name --> Detail (e.g.,
'history' tag with parent 'about')
http://www.sydneycommunitycollege.com.au/about/history
The remainder of the url, i.e., beyond the first /.../, is deciphered
according to custom rules depending on whether it's List or Detail.
All in all, the urls are quite short and easier to remember + there's hardly any fiddling in apache.
with regards, -- Lachlan Deck
ISHDirectActionRequestHandler.java
Description: Binary data
_______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list ([email protected]) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
