How do I call the intercept () method of an Intercept class in another project method?

1

Okay, everyone?

Well, I'm having a hard time and would like a little help.

I have the following method of my AccessIntercept class:

@Intercepts
@RequestScoped
public class AcessarIntercept {
    @AroundCall
    public void intercepta(SimpleInterceptorStack stack) {
        // Conteúdo do método que redireciona a página
        // após fazer as verificações de interceptação.
    }

}

And I'd like to invoke this method in my Controller or another class. How do I do this?

    
asked by anonymous 26.06.2015 / 16:32

1 answer

2

Correction

You could pass as instantiation of the class you want to execute as a parameter to your constructor:

public class Controller {
     private AcessarIntercept acessar;

     public Controller(AcessarIntercept acessar) {
         this.acessar = acessar; 
     }
}

And so run your method with acessar.intercept() . Just remember to allocate memory in your "access" object before creating your Controller.

    
02.07.2015 / 20:04