Annotation Type RestDestroy
@Target({METHOD,TYPE})
@Retention(RUNTIME)
@Inherited
@Repeatable(Array.class)
public @interface RestDestroy
Identifies a method that gets called during servlet destroy.
This method is called from within the Servlet.destroy()
.
The only valid parameter type for this method is RestContext
, although typically no arguments will
be specified.
Example:
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 destroy methods can be defined on a class.
Destroy methods on child classes are invoked before destroy methods on parent classes.
The order of destroy method invocations within a class is alphabetical, then by parameter count, then by parameter types. -
In general, destroy methods should not throw any exceptions, although if any are thrown, the stack trace will be
printed to
System.err . -
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.
See Also:
-
Optional Element Summary
-
Element Details
-
on
Dynamically apply this annotation to the specified methods.See Also:
- Returns:
- The annotation value.
- Default:
- {}
-