users@glassfish.java.net

Re: application-client.xml :: <callback-handler> ignores my class.

From: Witold Szczerba <pljosh.mail_at_gmail.com>
Date: Tue, 5 Dec 2006 21:43:29 +0100

2006/12/5, Tim Quinn <Timothy.Quinn_at_sun.com>:
>
>
>
> Witold Szczerba wrote:
> Thanks for help!
> I will use v2 if it is working... :) I though that was some major
> incompatibility... I will fix that template file and enjoy new
> Glassfish version :)
>
> I have one more question. I was wondering what is the 'thing' that
> client is actually sending to server when accessing secured bean? Do
> you know that? Is that is something one can setup in in Context
> instance? In other words - can I send username/password/whatever else
> would be needed in some other way?
> There is a technique called programmatic log-in. This documentation
> describes how to use it, but basically your code can explicitly decide when
> and how to log the user into the app server.
>
> Note that if your app client uses annotations the app client container must
> perform injection before your code gains control. This means that
> programmatic login cannot be used to authenticate the user for
> injection-related access to back-end resources.
>
> From here, it sounds as if getting GF v2 working to your satisfaction is
> the best approach, but of course that is for you to decide!
>
> - Tim
>

Yes, I saw that 'programmatic login' description, but for me this is
far, far more complicated than it should be; well I mean, why there is
need to write so many lines of code, to configure some 'policy' files
on the server itself, when all that is actually needed is to provide
username and password or something else inside some serializable
object... For me that should be something like one or two additional
lines of simple code, but it is not :/ That is what bothers me :) From
my point of view (which is in fact very limited) it is like doing
something very, very simple in very, very complicated way...

And one thing about injection. You mentioned "if your app client uses
annotations...". Maybe you know why @EJB annotation based injection is
not working in application clients? Some time ago, I tried injecting
some @Resource, I can't remember what that was, but it worked well.
When I have added some @EJB public static field, all I got was null.
So, the only way I can get session bean is through Context which is
not what I really love, but couldn't figure out anything better :/
Some people say that injection is not working for Application Clients
that resides outside JEE server (like my client, using Java WebStart),
but I saw @Resource object injected on my own eyes. Why @EJB isn't
working that way as well?