code: public static BeanManager getBeanManager(Object ctx) {
          return (BeanManager) javax.portlet.PortletContext.class.cast(ctx).getAttribute(WeldServletLifecycle.BEAN_MANAGER_ATTRIBUTE_NAME);
      }
docs: Get bean manager from portlet context.
  
  @param ctx the portlet context
  @return bean manager if found