getting to know Mr. ERXRoute
getting to know Mr. ERXRoute
- Subject: getting to know Mr. ERXRoute
- From: Jesse Tayler <email@hidden>
- Date: Wed, 29 Dec 2010 19:10:14 -0500
I'm just getting to know Mr. ERXRoute - very nice fellow - and I ran into some likely simple questions of approach, in what must be a typical situation
I added a route that would return user info based on username which I got working fine:
routeRequestHandler.addRoute(new ERXRoute(User.ENTITY_NAME, "/u/{username:String}", ERXRoute.Method.Get, UserController.class, "username"));
but now I wonder about approach for things like creating a new post for a specific user - not sure if it's easier to pass along a user/pass or work on authentication - I figured I could write a new route method like this:
routeRequestHandler.addRoute(new ERXRoute(User.ENTITY_NAME, "/MakePost", ERXRoute.Method.Post, UserController.class, "createPost"));
to which I figured I could say:
curl -X POST -d "{ title:'New Post'; username:'demo'; password:'d';}" http://10.0.1.3:5999/cgi-bin/WebObjects/WOMan.woa/ra/MakePost.json
but this runs into exception during the init method of the post, I had set the author and assignee to the session user in the eo init like so:
setAssigneeRelationship((User) ((User)ERCoreBusinessLogic.actor()).localInstanceIn(editingContext()));
which of course, raises because there's no core business user while I'm calling from curl right?
so, if someone with some more experience setting up ERRest would kindly guide me on these few steps, I'd be much obliged!
_______________________________________________
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