1 Reply Latest reply on Jun 16, 2009 12:03 PM by Alessio Soldano

    EJBContext as an attachment in WebServiceContext

    jaikiran pai Master

      Currently in our EJB3 StatelessContainer http://anonsvn.jboss.org/repos/jbossas/projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateless/StatelessContainer.java we have WSCallbackImpl which is a callback for BeanContext creation and removal:


      static class WSCallbackImpl implements BeanContextLifecycleCallback
       {
       private ExtensibleWebServiceContext jaxwsContext;
       private javax.xml.rpc.handler.MessageContext jaxrpcMessageContext;
      
       public WSCallbackImpl(javax.xml.rpc.handler.MessageContext jaxrpc, ExtensibleWebServiceContext jaxws)
       {
       jaxrpcMessageContext = jaxrpc;
       jaxwsContext = jaxws;
       }
      
       public void attached(BeanContext beanCtx)
       {
       // JAX-RPC MessageContext
       StatelessBeanContext sbc = (StatelessBeanContext)beanCtx;
       sbc.setMessageContextJAXRPC(jaxrpcMessageContext);
      
       // JAX-WS MessageContext
       BeanProperty beanProp = sbc.getWebServiceContextProperty();
       if (beanProp != null)
       {
       EJBContext ejbCtx = beanCtx.getEJBContext();
       jaxwsContext.addAttachment(EJBContext.class, ejbCtx);
       beanProp.set(beanCtx.getInstance(), jaxwsContext);
       }
       }
      
       public void released(BeanContext beanCtx)
       {
       StatelessBeanContext sbc = (StatelessBeanContext)beanCtx;
       sbc.setMessageContextJAXRPC(null);
      
       BeanProperty beanProp = sbc.getWebServiceContextProperty();
       if (beanProp != null)
       beanProp.set(beanCtx.getInstance(), null);
       }
       }


      As seen in the code, on the BeanContext callback, we attach the EJBContext as an attachment to the WebServiceContext. Does JBossWS still require this EJBContext within the WebServiceContext or can we stop attaching this?