click-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Manuel Chinea <manuel.chi...@gmail.com>
Subject Re: EJB 3.1 injection of a SessionBean in a click page
Date Wed, 14 Apr 2010 15:21:46 GMT
Hi Bob,

2010/4/14 Bob Schellink <sabob1@gmail.com>

> Hi Manuel,
>
> Great work. I assume this was done with Glassfish 3?
>

Yes, glassfish v3 (build 74.2 i think, don't remember the exact build right
now)


> So I am correct in saying that as long as CDI created the Page it
> automatically injected EJB annotated services?
>
>
Yes. I tested this originally with a Page that had and annotated @EJB
attribute. Latter tested by making a Producer that created a POJO and a Page
with a @Inject of that POJO type. It worked.


>
> One thing I'm not sure of is this:
>
>  * The jndi name under which the BeanManager can be found according to the
> CDI spec in a JEE6 app server
>  public static final String CDI_BEANMANAGER_JNDILOOKUPNAME =
> "java:comp/BeanManager";
>


> I've found that certain containers doesn't use the 'java:' prefix for JNDI
> lookups. Do you have a reference where this name is specified in the spec?
>
>
I saw it in the jsr-299 spec (Chapter 11 -> 11.3. The BeanManager object). I
googled "javadoc BeanManager" and found this link to the javadoc:

http://www.jarvana.com/jarvana/view/javax/enterprise/cdi-api/1.0/cdi-api-1.0-javadoc.jar!/javax/enterprise/inject/spi/BeanManager.html

About the java: prefix, i saw in the struts2-plugin, there is another
prefix, donĀ“t remember it right now.

As i mentioned before, so far i've just done a couple of "Hello World" tests
of this. I'll like you to give it a try and give me some feedback on it.

Back to work, see ya!

regards

kind regards
>
> bob
>
>
>
> On 14/04/2010 22:01, Manuel Chinea wrote:
>
>> Hi,
>>
>> I a have managed to do a cdi- based click servlet. Alpha quality code
>> yet (no error or edge cases handling, no javadoc), but it creates the
>> Page objects through the cdi api.
>>
>> Here is the JIRA issue https://issues.apache.org/jira/browse/CLK-656
>> with some instructions on the use of the Servlet.
>>
>> So far i have tested injecting EJB (with the @EJB annotation) and Plain
>> POJOs using Producers.
>>
>> regards
>>
>> 2010/4/12 Bob Schellink <sabob1@gmail.com <mailto:sabob1@gmail.com>>
>>
>>
>>    On 12/04/2010 23:19, Manuel Chinea wrote:
>>
>>
>>        Ok, i meant more of a project-specific Page, like MyPage, not the
>>        Framework specific Page.
>>
>>
>>
>>    Ah nods, I meant an application specific page as well. You can
>>    certainly do this in a BasePage or BorderPage, however the reason
>>    I'm suggesting you don't, is your BasePage can grow quite large as
>>    the number of services grow. We've found that large super pages can
>>    be difficult to digest by new developers working on our application.
>>
>>    However since everybody's needs is different a super page exposing
>>    services might not pose a problem in your case. And if down the road
>>    it does, you can easily refactor the services into a separate
>>    Service Locator or Service Factory class.
>>
>>
>>
>>        Ah, that is very interesting. I totally forgot about the
>>        ClickServlet!.
>>        I'll take a look on that option. That way i'll learn a little
>>        bit more
>>        of Apache Click in the process! ;).
>>
>>
>>    Agreed :)
>>
>>    I'm also hoping a future release of Click could expose a page
>>    creation service interface so the ClickServlet doesn't have to be
>>    subclassed.
>>
>>    kind regards
>>
>>    bob
>>
>>
>> --
>> Manuel Chinea.
>>
>
> --
Manuel Chinea.

Mime
View raw message