tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Romain Manni-Bucau <rmannibu...@gmail.com>
Subject Re: Custom Security for REST
Date Thu, 24 Jan 2013 14:50:07 GMT
hmm i guess that's because that's cdi interceptors,

it should work with ejb interceptors

can you package a mvn sample reproducing it and open a jira please?

*Romain Manni-Bucau*
*Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
*Blog: **http://rmannibucau.wordpress.com/*<http://rmannibucau.wordpress.com/>
*LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
*Github: https://github.com/rmannibucau*



2013/1/24 dorwin <dorwins@gmail.com>

> If I amend the example so that the endpoint also injects the
> HTTPServletRequest, we can see that it works for the endpoint, just not for
> the interceptor:
>
> package test.tomee.webservice;
>
> import java.util.Collections;
>
> import javax.enterprise.context.RequestScoped;
> import javax.servlet.http.HttpServletRequest;
> import javax.ws.rs.GET;
> import javax.ws.rs.Path;
> import javax.ws.rs.Produces;
> import javax.ws.rs.core.Context;
>
> import test.tomee.interceptor.InterceptMe;
>
> @InterceptMe
> @RequestScoped
> @Path("/test")
> public class TestService {
>
>         @Context
>         HttpServletRequest request;
>
>         @GET
>         @Path("/sayHello")
>         @Produces("text/plain")
>         public String sayHello()
>         {
>                 System.out.println("endpoint says headers are: " +
> Collections.list(request.getHeaderNames()).toString());
>                 return "hello";
>         }
> }
>
> the output is:
>
> In interceptor
> calling method: public java.lang.String
> test.tomee.webservice.TestService.sayHello()
> arguments are: []
> request headers are: null
> endpoint says headers are: [host, user-agent, accept, accept-language,
> accept-encoding, deviceid, connection]
> called method: public java.lang.String
> test.tomee.webservice.TestService.sayHello()
>
>
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/Custom-Security-for-REST-tp4660361p4660384.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message