Note that there are some explanatory texts on larger screens.

plurals
  1. POInterceptors are not intercepting
    primarykey
    data
    text
    <p>I am having problems setting up a Java EE 6 CDI interceptors. I am using embedded glassfish, I have specified the interceptor in beans.xml in the web application.</p> <pre><code>&lt;beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd"&gt; &lt;interceptors&gt; &lt;class&gt;ServiceInterceptor&lt;/class&gt; &lt;/interceptors&gt; &lt;/beans&gt; </code></pre> <p>I am trying to secure this bean:</p> <pre><code>@Named //@Stateless @RequestScoped public class SecuredMethodJSFBean /*implements Serializable*/{ @Inject protected SecuredMethodSample securedMethodSample; /* @CurrentUser @SessionScoped @Inject protected RuntimePrincipalAware principal; //protected JSFLoginBean jsfLoginBean; */ public SecuredMethodJSFBean() { super(); System.out.println("creating secured method jsf bean"); } @Secured("adfadfafd") public void doSomething() { //System.out.println("\n\n\n\nprincipal:" + principal); //System.out.println("principal:" + jsfLoginBean.getPrincipal()); //securedMethodSample.doSomething(jsfLoginBean.getPrincipal().getName()); //return(jsfLoginBean.getPrincipal().getName()); //securedMethodSample.doSomething(principal.getName()); //return(principal.getName()); //return("secured-method"); securedMethodSample.doSomething("testing ..."); } } </code></pre> <p>What do I need to do to get my interceptors running?</p> <p>Also, I am trying to use interceptors to intercept method invocations on beans used by servlets. Since those beans are beans, I should be able to intercept them. However, I am unable to do so. I was originally trying to intercept method invocations in servlets directly, but they're not CDI beans so that does not make sense.</p> <p>Thanks,</p> <p>Walter</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload