Annotation Type RestPostInit
@Target({METHOD,TYPE})
@Retention(RUNTIME)
@Inherited
@Repeatable(Array.class)
public @interface RestPostInit
Identifies a method that gets called immediately after servlet initialization.
This method is called from within the Servlet.init(ServletConfig)
method after the RestContext
object has been created.
The only valid parameter type for this method is RestContext
which can be used to retrieve information
about the servlet.
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 post-init methods can be defined on a class.
Post-init methods on parent classes are invoked before post-init methods on child classes unlesschildFirst()
is specified.
The order of Post-init method invocations within a class is alphabetical, then by parameter count, then by parameter types. - The method can throw any exception causing initialization of the servlet to fail.
-
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.
-
Optional Element Summary
Modifier and TypeOptional ElementDescriptionboolean
Execute in child-first order.String[]
Dynamically apply this annotation to the specified methods.
-
Element Details
-
childFirst
boolean childFirstExecute in child-first order.Use this annotation if you need to perform any kind of initialization on child resources before the parent resource.
This method is called from within the
Servlet.init(ServletConfig)
method after theRestContext
object has been created and after the non-child-first methods have been called.- Returns:
- The annotation value.
- Default:
- false
-
on
Dynamically apply this annotation to the specified methods.See Also:
- Returns:
- The annotation value.
- Default:
- {}
-