Annotation Type RestPreCall


Identifies a method that gets called immediately before the @RestOp annotated method gets called.

At this point, the RestRequest object has been fully initialized, and all RestGuard and RestMatcher objects have been called.

The list of valid parameter types are as follows:

Example:

@Rest(...) public class MyResource extends BasicRestServlet { // Log the incoming request. @RestPreCall public void onPreCall(Accept accept, Logger logger) { logger.fine("Accept {0} header found.", accept); } }

Notes:
  • The method should return void although if it does return any value, the value will be ignored.
  • The method should be public although other visibilities are valid if the security manager allows it.
  • Static methods can be used.
  • Multiple pre-call methods can be defined on a class.
    Pre-call methods on parent classes are invoked before pre-call methods on child classes.
    The order of pre-call method invocations within a class is alphabetical, then by parameter count, then by parameter types.
  • The method can throw any exception.
    BasicHttpExceptions can be thrown to cause a particular HTTP error status code.
    All other exceptions cause an HTTP 500 error status code.
  • Note that if you override a parent method, you probably need to call super.parentMethod(...).
    The method is still considered part of the parent class for ordering purposes even though it's overridden by the child class.
  • It's advisable not to mess around with the HTTP content itself since you may end up consuming the content before the actual REST method has a chance to use it.
See Also:
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Dynamically apply this annotation to the specified methods.