Hello,

I just downloaded and tried the 1.5.2 snapshot, and it behaved the same way.
HttpServletRequest is always null in the interceptor. Is there somewhere I
can find documented what should be available? I first tried to just do
@Inject HttpServletRequest, but the server complained at startup. Are there
any pieces of the REST message I can inject here?

The interceptor looks like the following:

package test.tomee.interceptor;

import java.util.Arrays;

import javax.enterprise.context.RequestScoped;
import javax.interceptor.AroundInvoke;
import javax.interceptor.Interceptor;
import javax.interceptor.InvocationContext;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.core.Context;

@InterceptMe @Interceptor
@RequestScoped
public class TestInterceptor {
        
        
        @Context        HttpServletRequest request;

        @AroundInvoke
        public Object logStuff(InvocationContext ctx) throws Exception {
                System.out.println("In interceptor");
                System.out.println("calling method: " + ctx.getMethod());
                System.out.println("arguments are: " +
Arrays.toString(ctx.getParameters()));
                System.out.println("request headers are: " + ( request !=null ?
request.getHeaderNames().toString(): "null"));
                Object returnValue = ctx.proceed();
                System.out.println("called method: " + ctx.getMethod());
                return returnValue;
        }
}

Thank you



--
View this message in context: 
http://openejb.979440.n4.nabble.com/Custom-Security-for-REST-tp4660361p4660365.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Reply via email to