Questo contenuto non è disponibile nella lingua selezionata.
56.3. Constraining an interceptors placement in a phase
Overview Copia collegamentoCollegamento copiato negli appunti!
Add to the chain before Copia collegamentoCollegamento copiato negli appunti!
AbstractPhaseInterceptor class provides two addBefore() methods.
Example 56.2. Methods for adding an interceptor before other interceptors
public void addBefore(String i);public void addBefore(Collection<String> i);addBefore() method in the constuctor of a custom interceptor.
Example 56.3. Specifying a list of interceptors that must run after the current interceptor
public class MyPhasedOutInterceptor extends AbstractPhaseInterceptor
{
public MyPhasedOutInterceptor() {
super(Phase.PRE_LOGICAL);
addBefore(HolderOutInterceptor.class.getName());
}
...
}
Add to the chain after Copia collegamentoCollegamento copiato negli appunti!
AbstractPhaseInterceptor class provides two addAfter() methods for cases where an interceptor needs to be placed after one or more other interceptors.
Example 56.4. Methods for adding an interceptor after other interceptors
public void addAfter(String i);public void addAfter(Collection<String> i);addAfter() method in the constuctor of a custom interceptor.
Example 56.5. Specifying a list of interceptors that must run before the current interceptor
public class MyPhasedOutInterceptor extends AbstractPhaseInterceptor
{
public MyPhasedOutInterceptor() {
super(Phase.PRE_LOGICAL);
addAfter(StartingOutInterceptor.class.getName());
}
...
}