Actually, that does exactly the same thing.
routeRequestHandler.addRoute(new ERXRoute(NotificationType.ENTITY_NAME,
"/NotificationType/{name:String}/fetchByName", ERXRoute.Method.Get,
NotificationTypeController.class, "fetchByName"));
still results in:
Mar 30 13:55:12 myApp[9001] ERROR er.rest.routes.ERXRouteController - Request
failed: /cgi-bin/WebObjects/myApp.woa/ra/NotificationType/alert/fetchByName.json
ValidationException: Error encountered converting value of class
java.lang.String to type specified in attribute 'notificationTypeId' of entity
'NotificationType'
at com.webobjects.eoaccess.EOAttribute.validateValue(EOAttribute.java:2572)
at
er.rest.ERXEORestDelegate._fetchObjectOfEntityWithID(ERXEORestDelegate.java:89)
at
er.rest.ERXAbstractRestDelegate.objectOfEntityWithID(ERXAbstractRestDelegate.java:96)
at er.rest.ERXRestUtils.coerceValueToTypeNamed(ERXRestUtils.java:258)
at er.rest.routes.ERXRoute.keysWithObjects(ERXRoute.java:370)
at er.rest.routes.ERXRouteController.routeObjects(ERXRouteController.java:348)
at
er.rest.routes.ERXRouteController.routeObjectForKey(ERXRouteController.java:327)
at
com.myApp.controllers.NotificationTypeController.fetchByNameAction(NotificationTypeController.java:114)
... skipped 4 stack elements
at
er.rest.routes.ERXRouteController.performActionNamed(ERXRouteController.java:1368)
at
er.rest.routes.ERXRouteController.performActionNamed(ERXRouteController.java:1234)
... skipped 8 stack elements
Apparently there might be something wrong in my setup, but I am at a loss.
On Mar 30, 2011, at 1:50 PM, Pascal Robert wrote:
>
> Le 2011-03-30 à 13:33, Andrew Kinnie a écrit :
>
>> Yes, I should have remembered that about query parameters I suppose. Though
>> it's been a while.
>>
>> I would still prefer doing it via REST, because that is what they asked me
>> to provide as an interface. However, as I just found out no one here
>> actually knows anything about REST my motivation is waning.
>>
>> So, for those keeping score, I do now know how to pass in the string as a
>> variable, but currently, with this action method:
>>
>> public WOActionResults fetchByNameAction() {
>> String typeName = routeObjectForKey("name");
>> NotificationType type =
>> NotificationType.fetchNotificationType(editingContext(),
>> NotificationType.TYPE_NAME.eq(typeName));
>> return response(type, showFilter());
>> }
>>
>> Registered this way:
>>
>> routeRequestHandler.addRoute(new
>> ERXRoute(NotificationType.ENTITY_NAME, "/NotificationType/{name:String}",
>> ERXRoute.Method.Get, NotificationTypeController.class, "fetchByName"));
>>
>> I get this exception:
>>
>> Mar 30 13:21:33 MyApp[9001] ERROR er.rest.routes.ERXRouteController -
>> Request failed:
>> /cgi-bin/WebObjects/MyApp.woa/ra/NotificationType/alert/fetchByName.json
>
> If you want to call your URL like this, you have to rework your route to be
> like this:
>
> new ERXRoute(NotificationType.ENTITY_NAME,
> "/NotificationType/{name:String}/fetchByName"
_______________________________________________
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]