@Target(value=METHOD)
@Retention(value=RUNTIME)
public @interface Before
Before handlers accept the same types of parameters as Attribute
and Uri
handlers. They can return a
boolean to indicate control flow in the overall request handling cycle.
@Before public boolean checkIfNodeExists(@RequestParam NodeRef nodeRef, WebScriptResponse response) { if (nodeService.exists(nodeRef)) { return true; // Proceed. } else { response.setStatus(404); return false; // End request handling. } }Like
Attribute
handlers, the order in which Before handlers are invoked is undefined. You should avoid
logical dependencies between Before handlers.