Annotation Type Before
-
@Target(METHOD) @Retention(RUNTIME) public @interface Before
Marks a method as a 'Before' handler for Web Script requests.Before handlers accept the same types of parameters as
Attribute
andUri
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. } }
LikeAttribute
handlers, the order in which Before handlers are invoked is undefined. You should avoid logical dependencies between Before handlers.