users@glassfish.java.net

Re: CDI @Inject does not work in SOAP handler chain

From: <forums_at_java.net>
Date: Wed, 14 Dec 2011 07:23:30 -0600 (CST)

 Harro,

I´m probably not the glassfish expert you hoped for, but I'm using
@Interceptors instead of the handler (in javaee6 you don't want to use the
xml anymore :-)). Your WebService must be a Sessionbean to get this working.
(I have to agree that using the HandlerChain, the @Inject is not working) So
in my "WsInterceptor.class" I inject a logger and I can access the
WebServiceContext resource by using the: public class WsInterceptor { 
 @Inject   Logger logger;   @Resource   WebServiceContext context;  
 @AroundInvoke   public Object log(InvocationContext ic) throws Exception
{       MessageContext messageContext =
this.context.getMessageContext();      this.logger.info("entering ws,  "
+ messageContext.toString());       Object result = ic.proceed();    
  this.logger.info("exiting ws");      return result;   }} Grzt, Ivar
   

--
[Message sent by forum member 'ikanters']
View Post: http://forums.java.net/node/873115