• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: ERRest and to many relationships
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ERRest and to many relationships


  • Subject: Re: ERRest and to many relationships
  • From: Andrew Kinnie <email@hidden>
  • Date: Wed, 30 Mar 2011 14:19:24 -0400

No such luck.  I get:

Mar 30 14:18:45 PoliticoAPNs[9001] ERROR er.rest.routes.ERXRouteController  - Request failed: /cgi-bin/WebObjects/PoliticoAPNs.woa/ra/NotificationType/fetchByName/alert
FileNotFoundException: There is no action named 'alertAction' on 'NotificationTypeController'.
  at er.rest.routes.ERXRouteController.performUnknownAction(ERXRouteController.java:1229)
  at er.rest.routes.ERXRouteController.performActionNamed(ERXRouteController.java:1356)
  at er.rest.routes.ERXRouteController.performActionNamed(ERXRouteController.java:1234)
  ... skipped 8 stack elements

On Mar 30, 2011, at 2:10 PM, Pascal Robert wrote:


Le 2011-03-30 à 14:02, Andrew Kinnie a écrit :

Actually, that does exactly the same thing.

routeRequestHandler.addRoute(new ERXRoute(NotificationType.ENTITY_NAME, "/NotificationType/{name:String}/fetchByName", ERXRoute.Method.Get, NotificationTypeController.class, "fetchByName"));

Try that instead:

 requestHandler.addRoute(new ERXRoute(NotificationType.ENTITY_NAME, "/NotificationType/fetchByName/{name:String}", ERXRoute.Method.Get, UsersController.class, "fetchByName"));

And reverse the last two parts of your GET request:

  /cgi-bin/WebObjects/myApp.woa/ra/NotificationType/fetchByName/alert

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@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: ERRest and to many relationships
      • From: Pascal Robert <email@hidden>
References: 
 >ERRest and to many relationships (From: Andrew Kinnie <email@hidden>)
 >Re: ERRest and to many relationships (From: Pascal Robert <email@hidden>)
 >Re: ERRest and to many relationships (From: Andrew Kinnie <email@hidden>)
 >Re: ERRest and to many relationships (From: Pascal Robert <email@hidden>)
 >Re: ERRest and to many relationships (From: Andrew Kinnie <email@hidden>)
 >Re: ERRest and to many relationships (From: Pascal Robert <email@hidden>)
 >Re: ERRest and to many relationships (From: Andrew Kinnie <email@hidden>)
 >Re: ERRest and to many relationships (From: Mike Schrag <email@hidden>)
 >Re: ERRest and to many relationships (From: Andrew Kinnie <email@hidden>)
 >Re: ERRest and to many relationships (From: Mike Schrag <email@hidden>)
 >Re: ERRest and to many relationships (From: David LeBer <email@hidden>)
 >Re: ERRest and to many relationships (From: Andrew Kinnie <email@hidden>)
 >Re: ERRest and to many relationships (From: Pascal Robert <email@hidden>)
 >Re: ERRest and to many relationships (From: Andrew Kinnie <email@hidden>)
 >Re: ERRest and to many relationships (From: Pascal Robert <email@hidden>)
 >Re: ERRest and to many relationships (From: Andrew Kinnie <email@hidden>)
 >Re: ERRest and to many relationships (From: Pascal Robert <email@hidden>)

  • Prev by Date: need help with weird application failure?
  • Next by Date: Re: need help with weird application failure?
  • Previous by thread: Re: ERRest and to many relationships
  • Next by thread: Re: ERRest and to many relationships
  • Index(es):
    • Date
    • Thread