public interface IERXRouteComponent extends 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.
Exampleroute (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
generateResponse
Copyright © 2002 – 2024 Project Wonder.