Hi again Sergey,
so I just checked with Glassfish Jersey 2.26 and it injects the
Application into the Feature with:
@Provider
public static class MyFeature implements Feature {
@Override
public boolean configure(FeatureContext context) {
System.out.println("Application: " + _application);
return true;
}
@Context
Application _application;
}
when registering either as a class or a singleton.
Do you think CXF should do the same. It kinds of feel right, doesn't it?
Should I file a JIRA ticket?
Bests.
Carlos.
El 5/12/17 a las 11:42, Sergey Beryozkin escribió:
> Hi Carlos
>
> I can see how it might work, but there should be some more evidence it
> will be portable should some whiteboard implementation decide to use
> the non-CXF code...
> Feature can be in the client or server scopes, or both scopes, typing
> a 'server' type like Application inside the feature code makes the
> scope property ambiguous, so I'm not sure, I guess the question is
> what RI or RestEasy do about it...
>
> Cheers, Sergey
> On 05/12/17 08:30, Carlos Sierra Andrés wrote:
>> Hey Sergey,
>>
>> I just extracted that from the 2.1 JAX-RS spec. They say that Feature
>> is a provider and in the providers lifecycle they mention that:
>>
>> "First the constructor is called, then any requested dependencies are
>> injected, then the appropriate methods are called (simultaneously) as
>> needed"
>>
>> I understand that Feature are called during bootstrap, and it would
>> not make sense to have some types injected, but I can't see why the
>> application could not be there since it should be already instantiated.
>>
>> What do you think?
>>
>> Bests.
>>
>> Carlos.
>>
>>
>> El 4/12/17 a las 23:15, Sergey Beryozkin escribió:
>>> Hi Carlos
>>>
>>> Is it expected to be supported ? I do not see it Feature#configure docs
>>>
>>> Cheers, Sergey
>>> On 04/12/17 09:00, Carlos Sierra Andrés wrote:
>>>> Hello there,
>>>>
>>>> I was trying to get the current application using `@Context
>>>> Application application` inside a Feature. I can see in the code
>>>> that Features do not get context proxies injected when their
>>>> configure method is invoked.
>>>>
>>>> Is this intentional or is this a bug?
>>>>
>>>> Bests.
>>>>
>>>> Carlos.
>>>>
>>>> --
>>>> Carlos Sierra
>>>> Software Engineer
>>>> Liferay España y Portugal / Liferay Spain and Portugal
>>>> Tel. +34 917336343
>>>> www.liferay.com <http://www.liferay.com/>
>>>>
>>>>
>>>> Enterprise. Open Source. For Life.
>>>>
>>>> Visit Us: www.liferay.com <http://www.liferay.com/> | Like Us:
>>>> facebook.com/liferay <http://facebook.com/liferay> | Follow Us:
>>>> twitter.com/liferay_es <http://twitter.com/liferay>
>>