<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#ffffff">
Thanks Dan (makes mental note to self to fix this in remoting).<br>
<br>
On 23/03/10 05:46, Dan Allen wrote:
<blockquote
 cite="mid:19758da1003221246t53c3355cw11f64f8a945f7aec@mail.gmail.com"
 type="cite">At the last Seam team meeting, the issue came up (once
again) of how to get the BeanManager from a non-contextual resource.
The reality is that there are certain lifecycle classes in Java EE that
did not getĀ categorizedĀ as components (e.g., PhaseListener) and
therefore do not support injection. They are "outside" of CDI. We are
working on an SPI for JSF to make these classes CDI beans, but there
will always be other cases.
  <div><br>
  </div>
  <div>In the current version of the spec, the standard way of looking
up the BeanManager is to use JNDI. However, JNDI is not consistently
supported in environments for which we want to write portable
extensions (whether we like it or not, people use servlet containers).
Weld puts the BeanManager in a servlet context attribute equal to the
FQCN of BeanManager. Pete suggested that we submit a change request to
have this location standardized when running in a servlet environment.</div>
  <div><br>
  </div>
  <div>With this change, the BeanManager can be obtained as follows:</div>
  <div><br>
  </div>
  <div>BeanManager manager = (BeanManager)
getServletContext().getAttribute(BeanManager.class.getName());</div>
  <div><br>
  </div>
  <div>This requires no change in Weld, since Weld is already doing
this.</div>
  <div><br>
  </div>
  <div>-Dan<br clear="all">
  <br>
-- <br>
Dan Allen<br>
Senior Software Engineer, Red Hat | Author of Seam in Action<br>
Registered Linux User #231597<br>
  <br>
  <a moz-do-not-send="true" href="http://mojavelinux.com">http://mojavelinux.com</a><br>
  <a moz-do-not-send="true" href="http://mojavelinux.com/seaminaction">http://mojavelinux.com/seaminaction</a><br>
  <a moz-do-not-send="true"
 href="http://www.google.com/profiles/dan.j.allen">http://www.google.com/profiles/dan.j.allen</a><br>
  </div>
  <pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
weld-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:weld-dev@lists.jboss.org">weld-dev@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/weld-dev">https://lists.jboss.org/mailman/listinfo/weld-dev</a></pre>
</blockquote>
<br>
</body>
</html>