Re: ERRest
Re: ERRest
- Subject: Re: ERRest
- From: Pascal Robert <email@hidden>
- Date: Thu, 16 Feb 2012 08:50:26 -0500
Le 2012-02-16 à 08:27, Ron X a écrit :
> i corrected
> requestHandler.insertRoute(new ERXRoute(Email.ENTITY_NAME, "/Email", ERXRoute.Method.Get));
> to
> requestHandler.insertRoute(new ERXRoute(Email.ENTITY_NAME, "/Email", ERXRoute.Method.Get, "show"));
That route won't show any details because of you don't have anything after Email. To get a specific email, the route should be like this:
requestHandler.insertRoute(new ERXRoute(Email.ENTITY_NAME, "/Email/{email:Email}", Method.Get, EmailController.class, "show"));
But again, if your registered the default routes, you don't need to do that, a route like /email/<someId> was already added. Print the routes with NSLog.out.appendln(requestHandler.routes()), you will see all registered routes.
And did you put the setter/getter in your component with the @ERXRouteParameter annotation on the setter? You need to do that so that the object is set to the component.
> and get the breakpoint at controller's showAction, but no EmailShowPage displayed.
>
> and than i restart application and get:
>
> Feb 16 08:54:39 RonRest[80] WARN er.extensions.eof.ERXModelGroup - Clearing previous class descriptions
> Feb 16 08:54:39 RonRest[80] INFO er.extensions.eof.ERXModelGroup - The connection dictionaries for LSRestEOModel and erprototypes have the same URL and username, but at least one of them is a prototype model, so it shouldn't be a problem.
> Feb 16 08:54:39 RonRest[80] INFO er.extensions.eof.ERXModelGroup - The connection dictionaries for LSRestEOModel and erprototypes have the same URL and username, but at least one of them is a prototype model, so it shouldn't be a problem.
> Feb 16 08:54:39 RonRest[80] DEBUG NSLog - Using JDBCPlugIn 'PostgresqlPlugIn' for ERXJDBCAdaptor@1931494437
> Feb 16 08:54:39 RonRest[80] INFO er.extensions.eof.ERXModelGroup - RonRestEOModel references a prototype entity named EOJDBCMysqlPrototypes which is not yet loaded.
> Feb 16 08:54:39 RonRest[80] WARN NSLog - A fatal exception occurred: null
> [2012-2-16 8:54:39 VET] <main> java.lang.NullPointerException
> at er.rest.routes.ERXRoute.<init>(ERXRoute.java:93)
> at com.legalsounds.Application.<init>(Application.java:29)
> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
> at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
> at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
> at java.lang.reflect.Constructor.newInstance(Unknown Source)
> at java.lang.Class.newInstance0(Unknown Source)
> at java.lang.Class.newInstance(Unknown Source)
> at com.webobjects.appserver.WOApplication.main(WOApplication.java:547)
> at er.extensions.appserver.ERXApplication.main(ERXApplication.java:821)
> at com.legalsounds.Application.main(Application.java:16)
>
> and application now is not starting at all!
>
> 2012/2/16 Pascal Robert <email@hidden>
>
> Le 2012-02-16 à 07:52, Ron X a écrit :
>
> > email/Email - doesn't work
> >
> > app-constructor code:
> >
> > public Application() {
> > setDefaultRequestHandler(requestHandlerForKey(directActionRequestHandlerKey()));
> >
> > ERXRouteRequestHandler requestHandler;
> > {
> > requestHandler = new ERXRouteRequestHandler(ERXRouteRequestHandler.WO);
> > requestHandler.addDefaultRoutes(Email.ENTITY_NAME, Email.ENTITY_NAME, true, EmailController.class);
>
> addDefaultRoutes(EMail.ENTITY_NAME) is sufficient.
>
> >
> > // requestHandler.insertRoute(new ERXRoute("Main","", ERXRoute.Method.Get));
> > requestHandler.insertRoute(new ERXRoute(Email.ENTITY_NAME, "/Email", ERXRoute.Method.Get));
>
> You don't need that route since you are adding the default routes. And that route will only work for /Email, not /Email/something
>
> You can check the SimpleBlog example for other examples of routes in a HTML/browser context.
>
> > }
> > ERXRouteRequestHandler.register(requestHandler);
> >
> >
> > setAllowsConcurrentRequestHandling(true);
> > }
> >
> > 2012/2/16 Pascal Robert <email@hidden>
> >
> > Le 2012-02-16 à 07:29, Ron X a écrit :
> >
> > > Hi everyone.
> > > I have a problem:
> > >
> > > in NavPanel:
> > > <wo:ERXRouteLink entityName = "Email" id = "1" action = "show" format = "html">
> > >
> > > in EmailController extends ERXDefaultRouteController:
> > > @Override
> > > protected boolean isAutomaticHtmlRoutingEnabled() {
> > > return true;
> > > }
> > >
> > > but this comment:
> > >
> > > /**
> > > * Automatic HTML routing means that if someone requests Entity/X/action.html, the
> > > * router controller will automatically look for an EntityActionPage component. For
> > > * example, if you go to /Person/1.html, it will look for PersonShowPage. You can
> > > * manually handle these as well but checking the current request format and
> > > * choosing the appropriate component to return.
> > > */
> > >
> > > doesn't work:
> > > Feb 16 07:54:35 RonRest[80] ERROR er.rest.routes.ERXRouteController - Request failed: /cgi-bin/WebObjects/RonRest.woa/ra/Email/1.html, 405
> >
> > Try /email instead of /Email
> >
> > And did you register the routes for this entity in your Application class? If yes, send the line that add it to the list.
> >
> > Do you have an error (in the console) saying "XXXXX does not exist, falling back to route controller" ?
> >
> > > EmailShowPage extends ERDCustomComponent implements IERXRouteComponent - stateless and non synchronized.
> > >
> > > any ideas?
> > >
> > > Thank you.
> > > _______________________________________________
> > > 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
> >
> >
>
>
_______________________________________________
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