Project Wonder 5.0

er.rest.routes
Interface IERXRouteComponent

All Superinterfaces:
com.webobjects.appserver.WOActionResults
All Known Implementing Classes:
SEEOEntityShowPage, SEEOModelGroupIndexPage, SEEOModelGroupShowPage, SEEOModelIndexPage, SEEOModelShowPage

public interface IERXRouteComponent
extends com.webobjects.appserver.WOActionResults

If you return a component from ERXRouteController that implements the IERXRouteComponent interface, the route controller will attempt to find set-methods on your component that correspond to the current route keys. For instance, if you have a {person:Person} in your route, ERXRouteController will attempt to call setPerson(Person) on your component as long as the setPerson method has a @ERXRouteParameter annotation.

The system will look for a String variant of the method first (to avoid faulting if you don't want to trigger a fault). If a String method is not found, it will look for the typed version, which will trigger a fault of the object if the method is found.

Example
 route (super-contrived): /person/{person:Person}/company/{company:Company}/task/{task:Task}
 
 public class TasksController extends ERXRouteController {
     public WOActionResults viewAction() {
         if (format() == ERXRestFormat.HTML) {
             return pageWithName(TaskComponent.class);
         }
         return response(...);
     }
 }
 
 public class TaskComponent extends ERXComponent implements IERXRouteComponent {
     @ERXRouteParameter
     public void setCompany(String companyID) {
         ...
     }
     
     @ERXRouteParameter
     public void setTask(Task task) {
         ...
     }
     
     public void setPerson(Person person) {
         ...
     }
 }
 

In the above example, setCompany will be called, passing in the company ID from the URL. setTask will be called, passing in the actual Task object, and setPerson will NOT be called because it is not annotated @ERXRouteParameter

Author:
mschrag

Method Summary
 
Methods inherited from interface com.webobjects.appserver.WOActionResults
generateResponse
 


Last updated: Tue, Feb 21, 2017 • 05:45 PM CET

Copyright © 2002 – 2007 Project Wonder.