Annotation Type Before

  • @Target(METHOD)
    public @interface Before
    Marks a method as a 'Before' handler for Web Script requests.

    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.

     public boolean checkIfNodeExists(@RequestParam NodeRef nodeRef, WebScriptResponse response) {
            if (nodeService.exists(nodeRef)) {
                    return true; // Proceed.
            } else {
                    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.