Re: aries-jax-rs-whiteboard with @JaxrsApplicationSelect works not with DS

2023-01-26 Thread Paul Spencer
Jaap,

RestImpl
- I do not use @JSONRequired
- I would not expect this component to be activated if personService is not 
resolved.  You can add and @Activate method to to confirm the resolution of 
personService

MyApplicationImpl
- I do not override getClasses() or getSingletons().
- My REST application relies on the following installed features:
  cxf-jaxrs
jackson-jaxrs
pax-web-http-whiteboard
pax-web-karaf
aries-jax-rs-whiteboard
aries-jax-rs-whiteboard-jackson

Also I have learned that resetting the Karaf environment with “karaf clean” and 
reinstalling bundles and features will clear up behavior that does not make 
senses.  This is especially true when there are changes to calculated the 
MANIFEST.MF file.

Additional resources:
- Example REST Whiteboard
  
https://github.com/apache/karaf/tree/karaf-4.4.3/examples/karaf-rest-example/karaf-rest-example-whiteboard
- Issue related to feature.xml for the REST Example
  https://issues.apache.org/jira/browse/KARAF-7639

Paul Spencer
   
> On Jan 26, 2023, at 5:02 AM, Jaap Gordijn  wrote:
> 
> Hi Paul,
> 
> I have put the Rest service in a separate bundle but that does not help.
> 
> I created a simplified case:
> 
> Component(service = RestImpl.class)
> @JaxrsResource
> @JaxrsApplicationSelect("(" + JaxrsWhiteboardConstants.JAX_RS_NAME + 
> "=MyApplication)")
> @JSONRequired
> @Produces(MediaType.APPLICATION_JSON)
> public class RestImpl {
> 
>   @Reference
>   private PersonService personService;
>   
>   @GET
>   @Path("/test")
>   public String test() {
>   System.out.println("personService == null " + (personService == 
> null));
>   return "test"; 
>   }
> }
> 
> @Component(service = Application.class, property =  
> {"servlet.init.hide-service-list-page=false"} )
> @JaxrsApplicationBase("example")
> @JaxrsName("MyApplication")
> public class MyApplicationImpl extends Application {
> 
> @Override
> public Set> getClasses() {
> HashSet> set = new HashSet>();
> set.add(JacksonJsonProvider.class);
> set.add(RestImpl.class);
> return set;
>  }
> 
>  public Set getSingletons() {
>   return Collections.singleton(RestImpl.class);
>  }
> }
> 
> - Execution of endpoint /example/test results in personService == null, so no 
> DI
> - Disabling @JSONRequired results in personService != null, so  DI work here
> - Disabling @JaxrsApplicationSelect results in personService != null, so  DI 
> work here
> 
> This drives me into the direction that there is no problem with dependencies.
> It seems that if @JaxrsApplicationSelect and @JSONRequired are used at the 
> same time, no DI happens.
> 
> Best,
> 
> -- Jaap
> 
>> -Original Message-
>> From: Paul Spencer 
>> Sent: donderdag 26 januari 2023 00:32
>> To: user@karaf.apache.org
>> Subject: Re: aries-jax-rs-whiteboard with @JaxrsApplicationSelect works not
>> with DS
>> 
>> Jaap,
>> I suggest placing the PersonService in a separate bundle.
>> 
>> Paul Spencer
>> 
>> 
>>> On Jan 25, 2023, at 3:57 PM, Jaap Gordijn  wrote:
>>> 
>>> Paul,
>>> 
>>> The Rest class and the PersonService are in the same bundle.
>>> 
>>> Do you know if there are any examples out there that show
>> @JaxrsApplicationSelect in combination with DS?
>>> It seems now that Application/@JaxrsApplicationBase ignores DS.
>>> 
>>> -- Jaap
>>> 
>>>> -Original Message-
>>>> From: Paul Spencer 
>>>> Sent: dinsdag 24 januari 2023 01:41
>>>> To: user@karaf.apache.org
>>>> Subject: Re: aries-jax-rs-whiteboard with @JaxrsApplicationSelect
>>>> works not with DS
>>>> 
>>>> - Does bundle:headers for the REST bundle have a required capability
>>>> to the Person Service, foo.bar.PersonService in the example below.
>>>> 
>>>> karaf@root> bundle:headers  ...
>>>> Require-Capability =
>>>> 
>>>> osgi.service;effective:=active;filter:=(objectClass=foo.bar.PersonSer
>>>> vice),
>>>> ...
>>>> 
>>>> karaf@root>
>>>> 
>>>> 
>>>> My assumption is the requirement is missing, meaning the requirement
>>>> in the REST bundle is not defined correctly.
>>>> 
>>>> Paul Spencer
>>>> 
>>>>

RE: aries-jax-rs-whiteboard with @JaxrsApplicationSelect works not with DS

2023-01-26 Thread Jaap Gordijn
Hi Paul,

I have put the Rest service in a separate bundle but that does not help.

I created a simplified case:

Component(service = RestImpl.class)
@JaxrsResource
@JaxrsApplicationSelect("(" + JaxrsWhiteboardConstants.JAX_RS_NAME + 
"=MyApplication)")
@JSONRequired
@Produces(MediaType.APPLICATION_JSON)
public class RestImpl {

@Reference
private PersonService personService;

@GET
@Path("/test")
public String test() {
System.out.println("personService == null " + (personService == 
null));
return "test"; 
}
}

@Component(service = Application.class, property =  
{"servlet.init.hide-service-list-page=false"} )
@JaxrsApplicationBase("example")
@JaxrsName("MyApplication")
public class MyApplicationImpl extends Application {

  @Override
  public Set> getClasses() {
  HashSet> set = new HashSet>();
  set.add(JacksonJsonProvider.class);
  set.add(RestImpl.class);
  return set;
   }
  
   public Set getSingletons() {
return Collections.singleton(RestImpl.class);
   }
}

- Execution of endpoint /example/test results in personService == null, so no DI
- Disabling @JSONRequired results in personService != null, so  DI work here
- Disabling @JaxrsApplicationSelect results in personService != null, so  DI 
work here

This drives me into the direction that there is no problem with dependencies.
It seems that if @JaxrsApplicationSelect and @JSONRequired are used at the same 
time, no DI happens.

Best,

-- Jaap

> -Original Message-
> From: Paul Spencer 
> Sent: donderdag 26 januari 2023 00:32
> To: user@karaf.apache.org
> Subject: Re: aries-jax-rs-whiteboard with @JaxrsApplicationSelect works not
> with DS
> 
> Jaap,
> I suggest placing the PersonService in a separate bundle.
> 
> Paul Spencer
> 
> 
> > On Jan 25, 2023, at 3:57 PM, Jaap Gordijn  wrote:
> >
> > Paul,
> >
> > The Rest class and the PersonService are in the same bundle.
> >
> > Do you know if there are any examples out there that show
> @JaxrsApplicationSelect in combination with DS?
> > It seems now that Application/@JaxrsApplicationBase ignores DS.
> >
> > -- Jaap
> >
> >> -Original Message-
> >> From: Paul Spencer 
> >> Sent: dinsdag 24 januari 2023 01:41
> >> To: user@karaf.apache.org
> >> Subject: Re: aries-jax-rs-whiteboard with @JaxrsApplicationSelect
> >> works not with DS
> >>
> >> - Does bundle:headers for the REST bundle have a required capability
> >> to the Person Service, foo.bar.PersonService in the example below.
> >>
> >> karaf@root> bundle:headers  ...
> >> Require-Capability =
> >>
> >> osgi.service;effective:=active;filter:=(objectClass=foo.bar.PersonSer
> >> vice),
> >> ...
> >>
> >> karaf@root>
> >>
> >>
> >> My assumption is the requirement is missing, meaning the requirement
> >> in the REST bundle is not defined correctly.
> >>
> >> Paul Spencer
> >>
> >>
> >>> On Jan 23, 2023, at 5:44 PM, Jaap Gordijn  wrote:
> >>>
> >>> Paul,
> >>>
> >>> - scr is installed and started
> >>> - the person bundle started
> >>> - diag does not produce any output
> >>>
> >>> Best,
> >>>
> >>> -- Jaap
> >>>
> >>>> -Original Message-
> >>>> From: Paul Spencer 
> >>>> Sent: maandag 23 januari 2023 23:12
> >>>> To: user@karaf.apache.org
> >>>> Subject: Re: aries-jax-rs-whiteboard with @JaxrsApplicationSelect
> >>>> works not with DS
> >>>>
> >>>> Jaap,
> >>>> 1) What bundle provides PersonService and what is its state, as
> >>>> reported by bundle:list?
> >>>> 2) What is the state, as reported by bundle:list, of your REST bundle.
> >>>>
> >>>> If any of the bundles are in a state of waiting, what does
> >>>> bundle:diag  of the waiting bundle report?
> >>>>
> >>>> Is the feature scr installed, if not install it.
> >>>>
> >>>> Paul Spencer
> >>>>
> >>>>
> >>>>> On Jan 23, 2023, at 3:38 PM, Jaap Gordijn  wrote:
> >>>>>
> >>>>> Paul,
> >>>>>
> >>>>> I have now minimized

Re: aries-jax-rs-whiteboard with @JaxrsApplicationSelect works not with DS

2023-01-25 Thread Paul Spencer
Jaap,
I suggest placing the PersonService in a separate bundle.

Paul Spencer


> On Jan 25, 2023, at 3:57 PM, Jaap Gordijn  wrote:
> 
> Paul,
> 
> The Rest class and the PersonService are in the same bundle.
> 
> Do you know if there are any examples out there that show 
> @JaxrsApplicationSelect in combination with DS?
> It seems now that Application/@JaxrsApplicationBase ignores DS.
> 
> -- Jaap
> 
>> -Original Message-
>> From: Paul Spencer 
>> Sent: dinsdag 24 januari 2023 01:41
>> To: user@karaf.apache.org
>> Subject: Re: aries-jax-rs-whiteboard with @JaxrsApplicationSelect works not
>> with DS
>> 
>> - Does bundle:headers for the REST bundle have a required capability to the
>> Person Service, foo.bar.PersonService in the example below.
>> 
>> karaf@root> bundle:headers  ...
>> Require-Capability =
>>  osgi.service;effective:=active;filter:=(objectClass=foo.bar.PersonSer
>> vice),
>> ...
>> 
>> karaf@root>
>> 
>> 
>> My assumption is the requirement is missing, meaning the requirement in
>> the REST bundle is not defined correctly.
>> 
>> Paul Spencer
>> 
>> 
>>> On Jan 23, 2023, at 5:44 PM, Jaap Gordijn  wrote:
>>> 
>>> Paul,
>>> 
>>> - scr is installed and started
>>> - the person bundle started
>>> - diag does not produce any output
>>> 
>>> Best,
>>> 
>>> -- Jaap
>>> 
>>>> -Original Message-
>>>> From: Paul Spencer 
>>>> Sent: maandag 23 januari 2023 23:12
>>>> To: user@karaf.apache.org
>>>> Subject: Re: aries-jax-rs-whiteboard with @JaxrsApplicationSelect
>>>> works not with DS
>>>> 
>>>> Jaap,
>>>> 1) What bundle provides PersonService and what is its state, as
>>>> reported by bundle:list?
>>>> 2) What is the state, as reported by bundle:list, of your REST bundle.
>>>> 
>>>> If any of the bundles are in a state of waiting, what does
>>>> bundle:diag  of the waiting bundle report?
>>>> 
>>>> Is the feature scr installed, if not install it.
>>>> 
>>>> Paul Spencer
>>>> 
>>>> 
>>>>> On Jan 23, 2023, at 3:38 PM, Jaap Gordijn  wrote:
>>>>> 
>>>>> Paul,
>>>>> 
>>>>> I have now minimized the code that I call via REST:
>>>>> 
>>>>>   @Reference(scope=ReferenceScope.PROTOTYPE_REQUIRED)
>>>>>   private PersonService personService;
>>>>> 
>>>>>   @GET
>>>>>   @Path("/test")
>>>>>   public String test() {
>>>>>   System.out.println("personService null" + (personService ==
>>>> null));
>>>>>   return "test";
>>>>>   }
>>>>> 
>>>>> The personService remains null, so no DI.
>>>>> 
>>>>> I enabled DEBUG in the log.
>>>>> 
>>>>> I only see DEBUG messages for " org.eclipse.jetty.util".
>>>>> Not for anything else.
>>>>> 
>>>>> Nevertheless, feature:list | grep jax Results in:
>>>>> 
>>>>> aries-jax-rs-whiteboard │ 2.0.2│  │ 
>>>>> Started │ aries-
>> jax-
>>>> rs-2.0.2│
>>>>> aries-jax-rs-whiteboard-jackson │ 2.0.2│  │ 
>>>>> Started │
>> aries-
>>>> jax-rs-2.0.2│
>>>>> aries-jax-rs-whiteboard-jettison│ 2.0.2│  │ 
>>>>> Uninstalled │
>>>> aries-jax-rs-2.0.2│
>>>>> aries-jax-rs-whiteboard-openapi │ 2.0.2│  │ 
>>>>> Uninstalled │
>>>> aries-jax-rs-2.0.2│
>>>>> aries-jax-rs-whiteboard-rest-management │ 2.0.2│  │
>> Uninstalled
>>>> │ aries-jax-rs-2.0.2│
>>>>> aries-jax-rs-whiteboard-shiro   │ 2.0.2│  │ 
>>>>> Uninstalled │
>> aries-
>>>> jax-rs-2.0.2│
>>>>> jaxb│ 2.3.2.3  │  │ 
>>>>> Uninstalled │ specs-4.4.3
>>>> │
>>>>> jaxrs   │ 2.1.0│  │ 

RE: aries-jax-rs-whiteboard with @JaxrsApplicationSelect works not with DS

2023-01-25 Thread Jaap Gordijn
Paul,

The Rest class and the PersonService are in the same bundle.

Do you know if there are any examples out there that show 
@JaxrsApplicationSelect in combination with DS?
It seems now that Application/@JaxrsApplicationBase ignores DS.

-- Jaap

> -Original Message-
> From: Paul Spencer 
> Sent: dinsdag 24 januari 2023 01:41
> To: user@karaf.apache.org
> Subject: Re: aries-jax-rs-whiteboard with @JaxrsApplicationSelect works not
> with DS
> 
> - Does bundle:headers for the REST bundle have a required capability to the
> Person Service, foo.bar.PersonService in the example below.
> 
> karaf@root> bundle:headers  ...
> Require-Capability =
>   osgi.service;effective:=active;filter:=(objectClass=foo.bar.PersonSer
> vice),
> ...
> 
> karaf@root>
> 
> 
> My assumption is the requirement is missing, meaning the requirement in
> the REST bundle is not defined correctly.
> 
> Paul Spencer
> 
> 
> > On Jan 23, 2023, at 5:44 PM, Jaap Gordijn  wrote:
> >
> > Paul,
> >
> > - scr is installed and started
> > - the person bundle started
> > - diag does not produce any output
> >
> > Best,
> >
> > -- Jaap
> >
> >> -----Original Message-
> >> From: Paul Spencer 
> >> Sent: maandag 23 januari 2023 23:12
> >> To: user@karaf.apache.org
> >> Subject: Re: aries-jax-rs-whiteboard with @JaxrsApplicationSelect
> >> works not with DS
> >>
> >> Jaap,
> >> 1) What bundle provides PersonService and what is its state, as
> >> reported by bundle:list?
> >> 2) What is the state, as reported by bundle:list, of your REST bundle.
> >>
> >> If any of the bundles are in a state of waiting, what does
> >> bundle:diag  of the waiting bundle report?
> >>
> >> Is the feature scr installed, if not install it.
> >>
> >> Paul Spencer
> >>
> >>
> >>> On Jan 23, 2023, at 3:38 PM, Jaap Gordijn  wrote:
> >>>
> >>> Paul,
> >>>
> >>> I have now minimized the code that I call via REST:
> >>>
> >>>   @Reference(scope=ReferenceScope.PROTOTYPE_REQUIRED)
> >>>   private PersonService personService;
> >>>
> >>>   @GET
> >>>   @Path("/test")
> >>>   public String test() {
> >>>   System.out.println("personService null" + (personService ==
> >> null));
> >>>   return "test";
> >>>   }
> >>>
> >>> The personService remains null, so no DI.
> >>>
> >>> I enabled DEBUG in the log.
> >>>
> >>> I only see DEBUG messages for " org.eclipse.jetty.util".
> >>> Not for anything else.
> >>>
> >>> Nevertheless, feature:list | grep jax Results in:
> >>>
> >>> aries-jax-rs-whiteboard │ 2.0.2│  │ 
> >>> Started │ aries-
> jax-
> >> rs-2.0.2│
> >>> aries-jax-rs-whiteboard-jackson │ 2.0.2│  │ 
> >>> Started │
> aries-
> >> jax-rs-2.0.2│
> >>> aries-jax-rs-whiteboard-jettison│ 2.0.2│  │ 
> >>> Uninstalled │
> >> aries-jax-rs-2.0.2│
> >>> aries-jax-rs-whiteboard-openapi │ 2.0.2│  │ 
> >>> Uninstalled │
> >> aries-jax-rs-2.0.2│
> >>> aries-jax-rs-whiteboard-rest-management │ 2.0.2│  │
> Uninstalled
> >> │ aries-jax-rs-2.0.2│
> >>> aries-jax-rs-whiteboard-shiro   │ 2.0.2│  │ 
> >>> Uninstalled │
> aries-
> >> jax-rs-2.0.2│
> >>> jaxb│ 2.3.2.3  │  │ 
> >>> Uninstalled │ specs-4.4.3
> >> │
> >>> jaxrs   │ 2.1.0│  │ 
> >>> Uninstalled │ specs-4.4.3
> >> │
> >>> jaxws   │ 2.3.0│  │ 
> >>> Uninstalled │ specs-4.4.3
> >> │
> >>> jackson-jaxrs   │ 2.14.1   │  │ 
> >>> Uninstalled │ specs-4.4.3
> >> │
> >>> cxf-jaxb│ 3.5.5│  │ 
> >>> Uninstalled │ cxf-3.5.5
> >> │
> >>> cxf-jaxws 

Re: aries-jax-rs-whiteboard with @JaxrsApplicationSelect works not with DS

2023-01-23 Thread Paul Spencer
- Does bundle:headers for the REST bundle have a required capability to the 
Person Service, foo.bar.PersonService in the example below.

karaf@root> bundle:headers 
...
Require-Capability = 

osgi.service;effective:=active;filter:=(objectClass=foo.bar.PersonService),
...

karaf@root> 


My assumption is the requirement is missing, meaning the requirement in the 
REST bundle is not defined correctly.

Paul Spencer
 

> On Jan 23, 2023, at 5:44 PM, Jaap Gordijn  wrote:
> 
> Paul,
> 
> - scr is installed and started
> - the person bundle started
> - diag does not produce any output
> 
> Best,
> 
> -- Jaap
> 
>> -Original Message-
>> From: Paul Spencer 
>> Sent: maandag 23 januari 2023 23:12
>> To: user@karaf.apache.org
>> Subject: Re: aries-jax-rs-whiteboard with @JaxrsApplicationSelect works not
>> with DS
>> 
>> Jaap,
>> 1) What bundle provides PersonService and what is its state, as reported by
>> bundle:list?
>> 2) What is the state, as reported by bundle:list, of your REST bundle.
>> 
>> If any of the bundles are in a state of waiting, what does bundle:diag
>>  of the waiting bundle report?
>> 
>> Is the feature scr installed, if not install it.
>> 
>> Paul Spencer
>> 
>> 
>>> On Jan 23, 2023, at 3:38 PM, Jaap Gordijn  wrote:
>>> 
>>> Paul,
>>> 
>>> I have now minimized the code that I call via REST:
>>> 
>>> @Reference(scope=ReferenceScope.PROTOTYPE_REQUIRED)
>>> private PersonService personService;
>>> 
>>> @GET
>>> @Path("/test")
>>> public String test() {
>>> System.out.println("personService null" + (personService ==
>> null));
>>> return "test";
>>> }
>>> 
>>> The personService remains null, so no DI.
>>> 
>>> I enabled DEBUG in the log.
>>> 
>>> I only see DEBUG messages for " org.eclipse.jetty.util".
>>> Not for anything else.
>>> 
>>> Nevertheless, feature:list | grep jax
>>> Results in:
>>> 
>>> aries-jax-rs-whiteboard │ 2.0.2│  │ 
>>> Started │ aries-jax-
>> rs-2.0.2│
>>> aries-jax-rs-whiteboard-jackson │ 2.0.2│  │ 
>>> Started │ aries-
>> jax-rs-2.0.2│
>>> aries-jax-rs-whiteboard-jettison│ 2.0.2│  │ 
>>> Uninstalled │
>> aries-jax-rs-2.0.2│
>>> aries-jax-rs-whiteboard-openapi │ 2.0.2│  │ 
>>> Uninstalled │
>> aries-jax-rs-2.0.2│
>>> aries-jax-rs-whiteboard-rest-management │ 2.0.2│  │ 
>>> Uninstalled
>> │ aries-jax-rs-2.0.2│
>>> aries-jax-rs-whiteboard-shiro   │ 2.0.2│  │ 
>>> Uninstalled │ aries-
>> jax-rs-2.0.2│
>>> jaxb│ 2.3.2.3  │  │ 
>>> Uninstalled │ specs-4.4.3
>> │
>>> jaxrs   │ 2.1.0│  │ 
>>> Uninstalled │ specs-4.4.3
>> │
>>> jaxws   │ 2.3.0│  │ 
>>> Uninstalled │ specs-4.4.3
>> │
>>> jackson-jaxrs   │ 2.14.1   │  │ 
>>> Uninstalled │ specs-4.4.3
>> │
>>> cxf-jaxb│ 3.5.5│  │ 
>>> Uninstalled │ cxf-3.5.5
>> │
>>> cxf-jaxws   │ 3.5.5│  │ 
>>> Uninstalled │ cxf-3.5.5
>> │
>>> cxf-jaxrs   │ 3.5.5│  │ 
>>> Started │ cxf-3.5.5
>> │
>>> cxf-databinding-jaxb│ 3.5.5│  │ 
>>> Uninstalled │ cxf-3.5.5
>> │
>>> cxf-jaxrs-cdi   │ 3.5.5│  │ 
>>> Uninstalled │ cxf-3.5.5
>> │
>>> karaf@root()>
>>> 
>>> This gives me the impression that the whitenboard stuff is working.
>>> 
>>> -- Jaap
>>> 
>>>> -Original Message-
>>> 
>>> 
>>>> From: Paul Spencer 
>>>> Sent: maandag 23 januari 2023 21:19
>>>> To: user@karaf.apache.org
>>>> Subject: Re: aries-jax-rs-whiteboard with @JaxrsApplicationSelect
>>>>

RE: aries-jax-rs-whiteboard with @JaxrsApplicationSelect works not with DS

2023-01-23 Thread Jaap Gordijn
Paul,

- scr is installed and started
- the person bundle started
- diag does not produce any output

Best,

-- Jaap

> -Original Message-
> From: Paul Spencer 
> Sent: maandag 23 januari 2023 23:12
> To: user@karaf.apache.org
> Subject: Re: aries-jax-rs-whiteboard with @JaxrsApplicationSelect works not
> with DS
> 
> Jaap,
> 1) What bundle provides PersonService and what is its state, as reported by
> bundle:list?
> 2) What is the state, as reported by bundle:list, of your REST bundle.
> 
> If any of the bundles are in a state of waiting, what does bundle:diag
>  of the waiting bundle report?
> 
> Is the feature scr installed, if not install it.
> 
> Paul Spencer
> 
> 
> > On Jan 23, 2023, at 3:38 PM, Jaap Gordijn  wrote:
> >
> > Paul,
> >
> > I have now minimized the code that I call via REST:
> >
> > @Reference(scope=ReferenceScope.PROTOTYPE_REQUIRED)
> > private PersonService personService;
> >
> > @GET
> > @Path("/test")
> > public String test() {
> > System.out.println("personService null" + (personService ==
> null));
> > return "test";
> > }
> >
> > The personService remains null, so no DI.
> >
> > I enabled DEBUG in the log.
> >
> > I only see DEBUG messages for " org.eclipse.jetty.util".
> > Not for anything else.
> >
> > Nevertheless, feature:list | grep jax
> > Results in:
> >
> > aries-jax-rs-whiteboard │ 2.0.2│  │ 
> > Started │ aries-jax-
> rs-2.0.2│
> > aries-jax-rs-whiteboard-jackson │ 2.0.2│  │ 
> > Started │ aries-
> jax-rs-2.0.2│
> > aries-jax-rs-whiteboard-jettison│ 2.0.2│  │ 
> > Uninstalled │
> aries-jax-rs-2.0.2│
> > aries-jax-rs-whiteboard-openapi │ 2.0.2│  │ 
> > Uninstalled │
> aries-jax-rs-2.0.2│
> > aries-jax-rs-whiteboard-rest-management │ 2.0.2│  │ 
> > Uninstalled
> │ aries-jax-rs-2.0.2│
> > aries-jax-rs-whiteboard-shiro   │ 2.0.2│  │ 
> > Uninstalled │ aries-
> jax-rs-2.0.2│
> > jaxb│ 2.3.2.3  │  │ 
> > Uninstalled │ specs-4.4.3
> │
> > jaxrs   │ 2.1.0│  │ 
> > Uninstalled │ specs-4.4.3
> │
> > jaxws   │ 2.3.0│  │ 
> > Uninstalled │ specs-4.4.3
> │
> > jackson-jaxrs   │ 2.14.1   │  │ 
> > Uninstalled │ specs-4.4.3
> │
> > cxf-jaxb│ 3.5.5│  │ 
> > Uninstalled │ cxf-3.5.5
> │
> > cxf-jaxws   │ 3.5.5│  │ 
> > Uninstalled │ cxf-3.5.5
> │
> > cxf-jaxrs   │ 3.5.5│  │ 
> > Started │ cxf-3.5.5
> │
> > cxf-databinding-jaxb            │ 3.5.5│  │ 
> > Uninstalled │ cxf-3.5.5
> │
> > cxf-jaxrs-cdi   │ 3.5.5│  │ 
> > Uninstalled │ cxf-3.5.5
> │
> > karaf@root()>
> >
> > This gives me the impression that the whitenboard stuff is working.
> >
> > -- Jaap
> >
> >> -Original Message-
> >
> >
> >> From: Paul Spencer 
> >> Sent: maandag 23 januari 2023 21:19
> >> To: user@karaf.apache.org
> >> Subject: Re: aries-jax-rs-whiteboard with @JaxrsApplicationSelect
> >> works not with DS
> >>
> >> Jaap,
> >> Something is missing.  The @Referenece should prevent the component
> >> from becoming Active when a PeopleService does not exist.
> >> Look in Karaf.log for clues.
> >>
> >> Paul Spencer
> >>
> >>> On Jan 23, 2023, at 3:14 PM, Jaap Gordijn  wrote:
> >>>
> >>> Paul,
> >>>
> >>> I tried also the @Reference annotation.
> >>> This doesn't work, the variable remains null.
> >>> No injection is happening.
> >>>
> >>> -- Jaap
> >>>
> >>>> -Original Message-
> >>>> From: Paul Spencer 
> >>>> Sent: maandag 23 januari 2023 21:09
> >>>> To: user@karaf.apache.org
> >>>> Subject: Re: aries-jax-rs-whiteboard with @Jax

Re: aries-jax-rs-whiteboard with @JaxrsApplicationSelect works not with DS

2023-01-23 Thread Paul Spencer
Jaap,
1) What bundle provides PersonService and what is its state, as reported by 
bundle:list?
2) What is the state, as reported by bundle:list, of your REST bundle.

If any of the bundles are in a state of waiting, what does bundle:diag 
 of the waiting bundle report?

Is the feature scr installed, if not install it.

Paul Spencer


> On Jan 23, 2023, at 3:38 PM, Jaap Gordijn  wrote:
> 
> Paul,
> 
> I have now minimized the code that I call via REST:
> 
>   @Reference(scope=ReferenceScope.PROTOTYPE_REQUIRED)
>   private PersonService personService;
> 
>   @GET
>   @Path("/test")
>   public String test() {
>   System.out.println("personService null" + (personService == 
> null));
>   return "test"; 
>   }
> 
> The personService remains null, so no DI.
> 
> I enabled DEBUG in the log.
> 
> I only see DEBUG messages for " org.eclipse.jetty.util".
> Not for anything else.
> 
> Nevertheless, feature:list | grep jax
> Results in:
> 
> aries-jax-rs-whiteboard │ 2.0.2│  │ 
> Started │ aries-jax-rs-2.0.2│
> aries-jax-rs-whiteboard-jackson │ 2.0.2│  │ 
> Started │ aries-jax-rs-2.0.2│
> aries-jax-rs-whiteboard-jettison│ 2.0.2│  │ 
> Uninstalled │ aries-jax-rs-2.0.2│
> aries-jax-rs-whiteboard-openapi │ 2.0.2│  │ 
> Uninstalled │ aries-jax-rs-2.0.2│
> aries-jax-rs-whiteboard-rest-management │ 2.0.2│  │ 
> Uninstalled │ aries-jax-rs-2.0.2│
> aries-jax-rs-whiteboard-shiro   │ 2.0.2│  │ 
> Uninstalled │ aries-jax-rs-2.0.2│
> jaxb│ 2.3.2.3  │  │ 
> Uninstalled │ specs-4.4.3   │
> jaxrs   │ 2.1.0│  │ 
> Uninstalled │ specs-4.4.3   │
> jaxws   │ 2.3.0│  │ 
> Uninstalled │ specs-4.4.3   │
> jackson-jaxrs   │ 2.14.1   │  │ 
> Uninstalled │ specs-4.4.3   │
> cxf-jaxb│ 3.5.5│  │ 
> Uninstalled │ cxf-3.5.5 │
> cxf-jaxws   │ 3.5.5│  │ 
> Uninstalled │ cxf-3.5.5 │
> cxf-jaxrs   │ 3.5.5│  │ 
> Started │ cxf-3.5.5 │
> cxf-databinding-jaxb│ 3.5.5│  │ 
> Uninstalled │ cxf-3.5.5 │
> cxf-jaxrs-cdi   │ 3.5.5│  │ 
> Uninstalled │ cxf-3.5.5 │
> karaf@root()>   
> 
> This gives me the impression that the whitenboard stuff is working.
> 
> -- Jaap
> 
>> -Original Message-
> 
> 
>> From: Paul Spencer 
>> Sent: maandag 23 januari 2023 21:19
>> To: user@karaf.apache.org
>> Subject: Re: aries-jax-rs-whiteboard with @JaxrsApplicationSelect works not
>> with DS
>> 
>> Jaap,
>> Something is missing.  The @Referenece should prevent the component
>> from becoming Active when a PeopleService does not exist.
>> Look in Karaf.log for clues.
>> 
>> Paul Spencer
>> 
>>> On Jan 23, 2023, at 3:14 PM, Jaap Gordijn  wrote:
>>> 
>>> Paul,
>>> 
>>> I tried also the @Reference annotation.
>>> This doesn't work, the variable remains null.
>>> No injection is happening.
>>> 
>>> -- Jaap
>>> 
>>>> -Original Message-
>>>> From: Paul Spencer 
>>>> Sent: maandag 23 januari 2023 21:09
>>>> To: user@karaf.apache.org
>>>> Subject: Re: aries-jax-rs-whiteboard with @JaxrsApplicationSelect
>>>> works not with DS
>>>> 
>>>> Jaap,
>>>> In the code I posted, there was not constructor.  I moved the
>>>> injection of personService to an @Reference annotated field.  The
>>>> @Activator annotation is for a method, which you may not need based on
>> your example.
>>>> 
>>>> Paul Spencer
>>>> 
>>>> 
>>>>> On Jan 23, 2023, at 2:30 PM, Jaap Gordijn  wrote:
>>>>> 
>>>>> Hi Paul,
>>>>> 
>>>>> That constructor is cal

RE: aries-jax-rs-whiteboard with @JaxrsApplicationSelect works not with DS

2023-01-23 Thread Jaap Gordijn
Paul,

I have now minimized the code that I call via REST:

@Reference(scope=ReferenceScope.PROTOTYPE_REQUIRED)
private PersonService personService;

@GET
@Path("/test")
public String test() {
System.out.println("personService null" + (personService == 
null));
return "test"; 
}

The personService remains null, so no DI.

I enabled DEBUG in the log.

I only see DEBUG messages for " org.eclipse.jetty.util".
Not for anything else.

Nevertheless, feature:list | grep jax
Results in:

aries-jax-rs-whiteboard │ 2.0.2│  │ Started 
│ aries-jax-rs-2.0.2│
aries-jax-rs-whiteboard-jackson │ 2.0.2│  │ Started 
│ aries-jax-rs-2.0.2│
aries-jax-rs-whiteboard-jettison│ 2.0.2│  │ 
Uninstalled │ aries-jax-rs-2.0.2│
aries-jax-rs-whiteboard-openapi │ 2.0.2│  │ 
Uninstalled │ aries-jax-rs-2.0.2│
aries-jax-rs-whiteboard-rest-management │ 2.0.2│  │ 
Uninstalled │ aries-jax-rs-2.0.2│
aries-jax-rs-whiteboard-shiro   │ 2.0.2│  │ 
Uninstalled │ aries-jax-rs-2.0.2│
jaxb│ 2.3.2.3  │  │ 
Uninstalled │ specs-4.4.3   │
jaxrs   │ 2.1.0│  │ 
Uninstalled │ specs-4.4.3   │
jaxws   │ 2.3.0│  │ 
Uninstalled │ specs-4.4.3   │
jackson-jaxrs   │ 2.14.1   │  │ 
Uninstalled │ specs-4.4.3   │
cxf-jaxb│ 3.5.5│  │ 
Uninstalled │ cxf-3.5.5 │
cxf-jaxws   │ 3.5.5│  │ 
Uninstalled │ cxf-3.5.5 │
cxf-jaxrs   │ 3.5.5│  │ Started 
│ cxf-3.5.5 │
cxf-databinding-jaxb│ 3.5.5│  │ 
Uninstalled │ cxf-3.5.5 │
cxf-jaxrs-cdi   │ 3.5.5│  │ 
Uninstalled │ cxf-3.5.5 │
karaf@root()>   

This gives me the impression that the whitenboard stuff is working.

-- Jaap

> -Original Message-


> From: Paul Spencer 
> Sent: maandag 23 januari 2023 21:19
> To: user@karaf.apache.org
> Subject: Re: aries-jax-rs-whiteboard with @JaxrsApplicationSelect works not
> with DS
> 
> Jaap,
> Something is missing.  The @Referenece should prevent the component
> from becoming Active when a PeopleService does not exist.
> Look in Karaf.log for clues.
> 
> Paul Spencer
> 
> > On Jan 23, 2023, at 3:14 PM, Jaap Gordijn  wrote:
> >
> > Paul,
> >
> > I tried also the @Reference annotation.
> > This doesn't work, the variable remains null.
> > No injection is happening.
> >
> > -- Jaap
> >
> >> -Original Message-
> >> From: Paul Spencer 
> >> Sent: maandag 23 januari 2023 21:09
> >> To: user@karaf.apache.org
> >> Subject: Re: aries-jax-rs-whiteboard with @JaxrsApplicationSelect
> >> works not with DS
> >>
> >> Jaap,
> >> In the code I posted, there was not constructor.  I moved the
> >> injection of personService to an @Reference annotated field.  The
> >> @Activator annotation is for a method, which you may not need based on
> your example.
> >>
> >> Paul Spencer
> >>
> >>
> >>> On Jan 23, 2023, at 2:30 PM, Jaap Gordijn  wrote:
> >>>
> >>> Hi Paul,
> >>>
> >>> That constructor is called, but only if I disable 
> >>> @@JaxrsApplicationSelect.
> >>>
> >>> If I enable it, only the default constructor is called (Rest() in my case.
> >>> And no DS.
> >>>
> >>> -- Jaap
> >>>
> >>>> -Original Message-
> >>>> From: Paul Spencer 
> >>>> Sent: maandag 23 januari 2023 18:59
> >>>> To: user@karaf.apache.org
> >>>> Subject: Re: aries-jax-rs-whiteboard with @JaxrsApplicationSelect
> >>>> works not with DS
> >>>>
> >>>> Jaap,
> >>>> Your @Activate annotation is incorrect.
> >>>> Try the following.
> >>>>
> >>>>
> >>>> …
> >>>> public class 

Re: aries-jax-rs-whiteboard with @JaxrsApplicationSelect works not with DS

2023-01-23 Thread Paul Spencer
Jaap,
Something is missing.  The @Referenece should prevent the component from 
becoming Active when a PeopleService does not exist.   
Look in Karaf.log for clues.

Paul Spencer

> On Jan 23, 2023, at 3:14 PM, Jaap Gordijn  wrote:
> 
> Paul,
> 
> I tried also the @Reference annotation.
> This doesn't work, the variable remains null.
> No injection is happening.
> 
> -- Jaap
> 
>> -Original Message-
>> From: Paul Spencer 
>> Sent: maandag 23 januari 2023 21:09
>> To: user@karaf.apache.org
>> Subject: Re: aries-jax-rs-whiteboard with @JaxrsApplicationSelect works not
>> with DS
>> 
>> Jaap,
>> In the code I posted, there was not constructor.  I moved the injection of
>> personService to an @Reference annotated field.  The @Activator
>> annotation is for a method, which you may not need based on your example.
>> 
>> Paul Spencer
>> 
>> 
>>> On Jan 23, 2023, at 2:30 PM, Jaap Gordijn  wrote:
>>> 
>>> Hi Paul,
>>> 
>>> That constructor is called, but only if I disable @@JaxrsApplicationSelect.
>>> 
>>> If I enable it, only the default constructor is called (Rest() in my case.
>>> And no DS.
>>> 
>>> -- Jaap
>>> 
>>>> -Original Message-
>>>> From: Paul Spencer 
>>>> Sent: maandag 23 januari 2023 18:59
>>>> To: user@karaf.apache.org
>>>> Subject: Re: aries-jax-rs-whiteboard with @JaxrsApplicationSelect
>>>> works not with DS
>>>> 
>>>> Jaap,
>>>> Your @Activate annotation is incorrect.
>>>> Try the following.
>>>> 
>>>> 
>>>> …
>>>> public class Rest() {
>>>> 
>>>>   @Reference
>>>>   private PersonService personService;
>>>> 
>>>>   @Activate
>>>>   public void activate(Map  properties) {
>>>>   ...
>>>>   }
>>>> 
>>>> }
>>>> 
>>>> Paul Spencer
>>>> 
>>>> 
>>>>> On Jan 23, 2023, at 12:40 PM, Jaap Gordijn  wrote:
>>>>> 
>>>>> Hi,
>>>>> 
>>>>> I use an Application object (with @JaxrsApplicationSelect),
>>>>> injection via DS does not work:
>>>>> 
>>>>> @Component(service = Rest.class, scope = ServiceScope.PROTOTYPE)
>>>>> @JaxrsResource @JaxrsApplicationSelect("(" +
>>>>> JaxrsWhiteboardConstants.JAX_RS_NAME +
>>>>> "=MyApplication)")
>>>>> @JSONRequired
>>>>> @Produces(MediaType.APPLICATION_JSON)
>>>>> public class Rest {
>>>>> 
>>>>> private PersonService personService;
>>>>> 
>>>>> /*
>>>>>  public Rest() {
>>>>> System.out.println("Constructing REST");
>>>>>   this.personService = new PersonServiceImpl();
>>>>>   }
>>>>> */
>>>>> 
>>>>>  @Activate
>>>>>  public Rest(final @Reference PersonService personService) {
>>>>> System.out.println("Constructing REST");
>>>>>   this.personService = personService;
>>>>>  }
>>>>> 
>>>>>  @GET
>>>>>  @Path("/person")
>>>>>  public List listPersons() {
>>>>>return personService.select();
>>>>> }
>>>>> 
>>>>> @GET
>>>>> @Path("/test")
>>>>> public String test() {
>>>>>   return "test";
>>>>> }
>>>>> }
>>>>> 
>>>>> The @Activate constructor is not called. If I enable the Rest()
>>>>> constructor that one is called.
>>>>> if I disable @JaxrsApplicationSelect, the personService is injected.
>>>>> 
>>>>> It seems that once an Application class is used (see below), DS is
>>>>> not working.
>>>>> This leads to the question what I have to set up for the Application
>> object:
>>>>> 
>>>>> @Component(service=Application.class, property =
>>>>> {"servlet.init.hide-service-list-page=true"} )
>>>>> @JaxrsApplicationBase("example")
>>>>> @JaxrsName("MyApplication")
>>>>> public class MyApplication extends Application {
>>>>> 
>>>>> public Set> getClasses() {
>>>>>HashSet> set = new HashSet>();
>>>>>set.add(Rest.class);
>>>>>return set;
>>>>> }
>>>>> 
>>>>> }
>>>>> 
>>>>> Jax-rs-whiteboard 2.02
>>>>> Karaf 4.4.3
>>>>> 
>>>>> Thanks,
>>>>> 
>>>>> -- Jaap
>>>>> 
>>>>> 
>>> 
>>> 
> 
> 



RE: aries-jax-rs-whiteboard with @JaxrsApplicationSelect works not with DS

2023-01-23 Thread Jaap Gordijn
Paul,

I tried also the @Reference annotation.
This doesn't work, the variable remains null.
No injection is happening.

-- Jaap

> -Original Message-
> From: Paul Spencer 
> Sent: maandag 23 januari 2023 21:09
> To: user@karaf.apache.org
> Subject: Re: aries-jax-rs-whiteboard with @JaxrsApplicationSelect works not
> with DS
> 
> Jaap,
> In the code I posted, there was not constructor.  I moved the injection of
> personService to an @Reference annotated field.  The @Activator
> annotation is for a method, which you may not need based on your example.
> 
> Paul Spencer
> 
> 
> > On Jan 23, 2023, at 2:30 PM, Jaap Gordijn  wrote:
> >
> > Hi Paul,
> >
> > That constructor is called, but only if I disable @@JaxrsApplicationSelect.
> >
> > If I enable it, only the default constructor is called (Rest() in my case.
> > And no DS.
> >
> > -- Jaap
> >
> >> -Original Message-
> >> From: Paul Spencer 
> >> Sent: maandag 23 januari 2023 18:59
> >> To: user@karaf.apache.org
> >> Subject: Re: aries-jax-rs-whiteboard with @JaxrsApplicationSelect
> >> works not with DS
> >>
> >> Jaap,
> >> Your @Activate annotation is incorrect.
> >> Try the following.
> >>
> >>
> >> …
> >> public class Rest() {
> >>
> >>@Reference
> >>private PersonService personService;
> >>
> >>@Activate
> >>public void activate(Map  properties) {
> >>...
> >>}
> >>
> >> }
> >>
> >> Paul Spencer
> >>
> >>
> >>> On Jan 23, 2023, at 12:40 PM, Jaap Gordijn  wrote:
> >>>
> >>> Hi,
> >>>
> >>> I use an Application object (with @JaxrsApplicationSelect),
> >>> injection via DS does not work:
> >>>
> >>> @Component(service = Rest.class, scope = ServiceScope.PROTOTYPE)
> >>> @JaxrsResource @JaxrsApplicationSelect("(" +
> >>> JaxrsWhiteboardConstants.JAX_RS_NAME +
> >>> "=MyApplication)")
> >>> @JSONRequired
> >>> @Produces(MediaType.APPLICATION_JSON)
> >>> public class Rest {
> >>>
> >>>  private PersonService personService;
> >>>
> >>>  /*
> >>>   public Rest() {
> >>> System.out.println("Constructing REST");
> >>>this.personService = new PersonServiceImpl();
> >>>}
> >>>  */
> >>>
> >>>   @Activate
> >>>   public Rest(final @Reference PersonService personService) {
> >>> System.out.println("Constructing REST");
> >>>this.personService = personService;
> >>>   }
> >>>
> >>>   @GET
> >>>   @Path("/person")
> >>>   public List listPersons() {
> >>> return personService.select();
> >>>  }
> >>>
> >>>  @GET
> >>>  @Path("/test")
> >>>  public String test() {
> >>>return "test";
> >>>  }
> >>> }
> >>>
> >>> The @Activate constructor is not called. If I enable the Rest()
> >>> constructor that one is called.
> >>> if I disable @JaxrsApplicationSelect, the personService is injected.
> >>>
> >>> It seems that once an Application class is used (see below), DS is
> >>> not working.
> >>> This leads to the question what I have to set up for the Application
> object:
> >>>
> >>> @Component(service=Application.class, property =
> >>> {"servlet.init.hide-service-list-page=true"} )
> >>> @JaxrsApplicationBase("example")
> >>> @JaxrsName("MyApplication")
> >>> public class MyApplication extends Application {
> >>>
> >>> public Set> getClasses() {
> >>> HashSet> set = new HashSet>();
> >>> set.add(Rest.class);
> >>> return set;
> >>>  }
> >>>
> >>> }
> >>>
> >>> Jax-rs-whiteboard 2.02
> >>> Karaf 4.4.3
> >>>
> >>> Thanks,
> >>>
> >>> -- Jaap
> >>>
> >>>
> >
> >




Re: aries-jax-rs-whiteboard with @JaxrsApplicationSelect works not with DS

2023-01-23 Thread Paul Spencer
Jaap,
In the code I posted, there was not constructor.  I moved the injection of 
personService to an @Reference annotated field.  The @Activator annotation is 
for a method, which you may not need based on your example.

Paul Spencer


> On Jan 23, 2023, at 2:30 PM, Jaap Gordijn  wrote:
> 
> Hi Paul,
> 
> That constructor is called, but only if I disable @@JaxrsApplicationSelect.
> 
> If I enable it, only the default constructor is called (Rest() in my case.
> And no DS.
> 
> -- Jaap
> 
>> -Original Message-
>> From: Paul Spencer 
>> Sent: maandag 23 januari 2023 18:59
>> To: user@karaf.apache.org
>> Subject: Re: aries-jax-rs-whiteboard with @JaxrsApplicationSelect works not
>> with DS
>> 
>> Jaap,
>> Your @Activate annotation is incorrect.
>> Try the following.
>> 
>> 
>> …
>> public class Rest() {
>> 
>>@Reference
>>private PersonService personService;
>> 
>>@Activate
>>public void activate(Map  properties) {
>>...
>>}
>> 
>> }
>> 
>> Paul Spencer
>> 
>> 
>>> On Jan 23, 2023, at 12:40 PM, Jaap Gordijn  wrote:
>>> 
>>> Hi,
>>> 
>>> I use an Application object (with @JaxrsApplicationSelect), injection
>>> via DS does not work:
>>> 
>>> @Component(service = Rest.class, scope = ServiceScope.PROTOTYPE)
>>> @JaxrsResource @JaxrsApplicationSelect("(" +
>>> JaxrsWhiteboardConstants.JAX_RS_NAME +
>>> "=MyApplication)")
>>> @JSONRequired
>>> @Produces(MediaType.APPLICATION_JSON)
>>> public class Rest {
>>> 
>>>  private PersonService personService;
>>> 
>>>  /*
>>>   public Rest() {
>>> System.out.println("Constructing REST");
>>>this.personService = new PersonServiceImpl();
>>>}
>>>  */
>>> 
>>>   @Activate
>>>   public Rest(final @Reference PersonService personService) {
>>> System.out.println("Constructing REST");
>>>this.personService = personService;
>>>   }
>>> 
>>>   @GET
>>>   @Path("/person")
>>>   public List listPersons() {
>>> return personService.select();
>>>  }
>>> 
>>>  @GET
>>>  @Path("/test")
>>>  public String test() {
>>>return "test";
>>>  }
>>> }
>>> 
>>> The @Activate constructor is not called. If I enable the Rest()
>>> constructor that one is called.
>>> if I disable @JaxrsApplicationSelect, the personService is injected.
>>> 
>>> It seems that once an Application class is used (see below), DS is not
>>> working.
>>> This leads to the question what I have to set up for the Application object:
>>> 
>>> @Component(service=Application.class, property =
>>> {"servlet.init.hide-service-list-page=true"} )
>>> @JaxrsApplicationBase("example")
>>> @JaxrsName("MyApplication")
>>> public class MyApplication extends Application {
>>> 
>>> public Set> getClasses() {
>>> HashSet> set = new HashSet>();
>>> set.add(Rest.class);
>>> return set;
>>>  }
>>> 
>>> }
>>> 
>>> Jax-rs-whiteboard 2.02
>>> Karaf 4.4.3
>>> 
>>> Thanks,
>>> 
>>> -- Jaap
>>> 
>>> 
> 
> 



RE: aries-jax-rs-whiteboard with @JaxrsApplicationSelect works not with DS

2023-01-23 Thread Jaap Gordijn
Hi Paul,

That constructor is called, but only if I disable @@JaxrsApplicationSelect.

If I enable it, only the default constructor is called (Rest() in my case.
And no DS.

-- Jaap

> -Original Message-
> From: Paul Spencer 
> Sent: maandag 23 januari 2023 18:59
> To: user@karaf.apache.org
> Subject: Re: aries-jax-rs-whiteboard with @JaxrsApplicationSelect works not
> with DS
> 
> Jaap,
> Your @Activate annotation is incorrect.
> Try the following.
> 
> 
> …
> public class Rest() {
> 
> @Reference
> private PersonService personService;
> 
> @Activate
> public void activate(Map  properties) {
> ...
> }
> 
> }
> 
> Paul Spencer
> 
> 
> > On Jan 23, 2023, at 12:40 PM, Jaap Gordijn  wrote:
> >
> > Hi,
> >
> > I use an Application object (with @JaxrsApplicationSelect), injection
> > via DS does not work:
> >
> > @Component(service = Rest.class, scope = ServiceScope.PROTOTYPE)
> > @JaxrsResource @JaxrsApplicationSelect("(" +
> > JaxrsWhiteboardConstants.JAX_RS_NAME +
> > "=MyApplication)")
> > @JSONRequired
> > @Produces(MediaType.APPLICATION_JSON)
> > public class Rest {
> >
> >   private PersonService personService;
> >
> >   /*
> >public Rest() {
> > System.out.println("Constructing REST");
> > this.personService = new PersonServiceImpl();
> > }
> >   */
> >
> >@Activate
> >public Rest(final @Reference PersonService personService) {
> > System.out.println("Constructing REST");
> > this.personService = personService;
> >}
> >
> >@GET
> >@Path("/person")
> >public List listPersons() {
> >  return personService.select();
> >   }
> >
> >   @GET
> >   @Path("/test")
> >   public String test() {
> > return "test";
> >   }
> > }
> >
> > The @Activate constructor is not called. If I enable the Rest()
> > constructor that one is called.
> > if I disable @JaxrsApplicationSelect, the personService is injected.
> >
> > It seems that once an Application class is used (see below), DS is not
> > working.
> > This leads to the question what I have to set up for the Application object:
> >
> > @Component(service=Application.class, property =
> > {"servlet.init.hide-service-list-page=true"} )
> > @JaxrsApplicationBase("example")
> > @JaxrsName("MyApplication")
> > public class MyApplication extends Application {
> >
> >  public Set> getClasses() {
> >  HashSet> set = new HashSet>();
> >  set.add(Rest.class);
> >  return set;
> >   }
> >
> > }
> >
> > Jax-rs-whiteboard 2.02
> > Karaf 4.4.3
> >
> > Thanks,
> >
> > -- Jaap
> >
> >




Re: aries-jax-rs-whiteboard with @JaxrsApplicationSelect works not with DS

2023-01-23 Thread Paul Spencer
Jaap,
Your @Activate annotation is incorrect.
Try the following.


…
public class Rest() {

@Reference
private PersonService personService;

@Activate
public void activate(Map  properties) {
...
}

}

Paul Spencer


> On Jan 23, 2023, at 12:40 PM, Jaap Gordijn  wrote:
> 
> Hi,
> 
> I use an Application object (with @JaxrsApplicationSelect), injection via DS
> does not work:
> 
> @Component(service = Rest.class, scope = ServiceScope.PROTOTYPE)
> @JaxrsResource
> @JaxrsApplicationSelect("(" + JaxrsWhiteboardConstants.JAX_RS_NAME +
> "=MyApplication)")
> @JSONRequired
> @Produces(MediaType.APPLICATION_JSON)
> public class Rest {
> 
>   private PersonService personService;
> 
>   /*
>public Rest() {
> System.out.println("Constructing REST");
> this.personService = new PersonServiceImpl();
> } 
>   */
> 
>@Activate
>public Rest(final @Reference PersonService personService) {
> System.out.println("Constructing REST");
> this.personService = personService;
>} 
> 
>@GET
>@Path("/person")
>public List listPersons() {
>  return personService.select(); 
>   }
> 
>   @GET
>   @Path("/test")
>   public String test() {
> return "test"; 
>   }
> }
> 
> The @Activate constructor is not called. If I enable the Rest() constructor
> that one is called.
> if I disable @JaxrsApplicationSelect, the personService is injected.
> 
> It seems that once an Application class is used (see below), DS is not
> working.
> This leads to the question what I have to set up for the Application object:
> 
> @Component(service=Application.class, property =
> {"servlet.init.hide-service-list-page=true"} )
> @JaxrsApplicationBase("example")
> @JaxrsName("MyApplication")
> public class MyApplication extends Application {
> 
>  public Set> getClasses() {
>  HashSet> set = new HashSet>();
>  set.add(Rest.class);
>  return set;
>   }
> 
> }
> 
> Jax-rs-whiteboard 2.02
> Karaf 4.4.3
> 
> Thanks,
> 
> -- Jaap
> 
> 



Re: aries-jax-rs-whiteboard with @JaxrsApplicationSelect and @JSONRequired result in 404

2023-01-23 Thread Paul Spencer
Jaap,
In my environment I do not use DS for the JaxrsApplication, thus my application 
class just extends Application with no additional methods for fields.  


The application snippet below accepts a web form and produces plain text from 
the URL /foo/api/webhook and demonstrates a non-default context.


karaf@root()> web:context-list
Bundle ID │ Symbolic Name │ Context Path │ 
Context Name  │ Rank │ Service ID │ Type│ Scope │ 
Registration Properties
──┼───┼──┼───┼──┼┼─┼───┼
108   │ org.apache.cxf.cxf-rt-transports-http │ /│ 
default   │ MAX  │ 0  │ HttpService │ static*   │ 
httpContext.id <http://httpcontext.id/>=default
  │   │  │  
 │  ││ │   │ 
httpContext.path=/
  │   │  │  
 │  ││ │   │ 
osgi.http.whiteboard.context.httpservice=default
  │   │  │  
 │  ││ │   │ 
osgi.http.whiteboard.context.path=/
122   │ org.ops4j.pax.web.pax-web-extender-whiteboard │ /│ 
default   │ 0│ 0  │ Whiteboard  │ static*   │ 
osgi.http.whiteboard.context.name=default
  │   │  │  
 │  ││ │   │ 
osgi.http.whiteboard.context.path=/

97│ org.apache.aries.jax.rs.whiteboard│ /foo/api │ 
context.forfooApi │ 0│ 163│ Whiteboard  │ singleton │ 
osgi.http.whiteboard.context.name=context.forfooApi
  │   │  │  
 │  ││ │   │ 
osgi.http.whiteboard.context.path=/foo/api

karaf@root()> web:servlet-list
Bundle ID │ Name   │ Class  
  │ Context Path(s) │ URLs   │ Type│ Context Filter
──┼┼──┼─┼┼─┼──
97│ cxf-servlet│ 
org.apache.aries.jax.rs.whiteboard.internal.Whiteboard$1 │ /   │ /* 
│ Whiteboard  │ (osgi.http.whiteboard.context.name=default)
97│ cxf-servlet│ 
org.apache.aries.jax.rs.whiteboard.internal.Whiteboard$1 │ /foo/api│ /* 
│ Whiteboard  │ (osgi.http.whiteboard.context.name=context.forfooApi)
108   │ cxf-osgi-transport-servlet │ 
org.apache.cxf.transport.servlet.CXFNonSpringServlet │ /   │ 
/cxf/* │ HttpService │ -
karaf@root()>
***
* Rest application defining context /foo/api
***
package com.example.foo.restapp;

import javax.ws.rs.core.Application;

import org.osgi.service.component.annotations.Component;
import org.osgi.service.jaxrs.whiteboard.propertytypes.JaxrsApplicationBase;
import org.osgi.service.jaxrs.whiteboard.propertytypes.JaxrsName;

@Component(service=Application.class)
@JaxrsName("fooApi")
@JaxrsApplicationBase("/foo/api")
public class FooApplication extends Application{

}

***
* Rest endpoint for /foo/api/webhook
***
...
@Path("/webhook")
@Component( scope = PROTOTYPE)
@JaxrsResource
@JaxrsApplicationSelect("(osgi.jaxrs.name=fooApi)")
public class IncommingWebHook {
...
@POST
@Produces(MediaType.TEXT_PLAIN)
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
@Path("/incommingMessage")
public Response receiveWebHook(@FormParam(MESSAGE_SID) String messageSid) {
   ...
}
...
}



> On Jan 23, 2023, at 10:05 AM, Jaap Gordijn  wrote:
> 
> Paul,
> 
> I have extended the Application class as follows:
> 
> public class MyApplication extends Application {
> 
> public Set> getClasses() {
> HashSet> set = new HashSet>();
> set.add(Rest.class);
> return set;
>  }
> 
> }
> 
> Now the endpoint resolves.
> 
> But DS dependency injection does not work.
> Is there something needed to switch this on?
> 
> -- Jaap
> 
>> -Original Message-
>> From: Paul Spencer 
>> Sent: maandag 23 januari 2023 15:16
>> To: user@karaf.apache.org
>> Subject: Re: aries-jax-rs-whiteboard with @JaxrsApplicationSelect and
>> @JSONRequired result in 404
>> 
>> Jaap,
>> JaxrsApplicatio

RE: aries-jax-rs-whiteboard with @JaxrsApplicationSelect and @JSONRequired result in 404

2023-01-23 Thread Jaap Gordijn
Paul,

I have extended the Application class as follows:

public class MyApplication extends Application {

  public Set> getClasses() {
  HashSet> set = new HashSet>();
  set.add(Rest.class);
  return set;
   }

}

Now the endpoint resolves.

But DS dependency injection does not work.
Is there something needed to switch this on?

-- Jaap

> -Original Message-
> From: Paul Spencer 
> Sent: maandag 23 januari 2023 15:16
> To: user@karaf.apache.org
> Subject: Re: aries-jax-rs-whiteboard with @JaxrsApplicationSelect and
> @JSONRequired result in 404
> 
> Jaap,
> JaxrsApplicationBase is used with JaxrsApplicationSelect to is required to use
> a non-default context, so your results confirm the default context is working.
> 
> Paul Spencer
> 
> > On Jan 23, 2023, at 9:08 AM, Jaap Gordijn  wrote:
> >
> > Paul,
> >
> > I did the following to create the application.
> >
> > @Component(service=Application.class, property =
> > {"servlet.init.hide-service-list-page=true"} )
> > @JaxrsApplicationBase("example")
> > @JaxrsName("MyApplication")
> > public class MyApplication extends Application {
> >
> > }
> >
> > The strange thing is at that if I remove the @JaxrsApplicationSelect in the
> Rest service class, then it works. But not with the Application class.
> >
> > -- Jaap
> >
> >> -Original Message-
> >> From: Paul Spencer 
> >> Sent: maandag 23 januari 2023 14:11
> >> To: user@karaf.apache.org
> >> Subject: Re: aries-jax-rs-whiteboard with @JaxrsApplicationSelect and
> >> @JSONRequired result in 404
> >>
> >> Jaap,
> >> Have you created the Jaxrs application?
> >>
> >> @Component(service=Application.class)
> >> @JaxrsName("MyApplication")
> >> @JaxrsApplicationBase("/example")
> >> public class MyApp extends Application{
> >>
> >> }
> >>
> >> Paul Spencer
> >>
> >>>> On Jan 23, 2023, at 7:39 AM, Jaap Gordijn  wrote:
> >>>
> >>> Paul,
> >>>
> >>> I used the features as you suggested.
> >>>
> >>> In the log, I see that the Jetty container starts.
> >>> Also the context path is registered:
> >>> Registering
> >>> OsgiServletContext{model=OsgiContextModel{WB,id=OCM-
> >> 5,name='context.fo
> >>> rMyApplication',path='/example',bundle=org.apache.aries.jax.rs.white
> >>> bo ard,ref=[org.osgi.service.http.context.ServletContextHelper]}} as
> >>> OSGi service for "/example" context pat
> >>>
> >>> But then I get this:
> >>> org.apache.cxf.cxf-rt-transports-http - 3.5.5 | Can't find the
> >>> request for http://172.20.116.137:8181/example/person's Observer
> >>>
> >>> Best,
> >>>
> >>> -- Jaap
> >>>
> >>>> -Original Message-
> >>>> From: Paul Spencer 
> >>>> Sent: maandag 23 januari 2023 13:13
> >>>> To: user@karaf.apache.org
> >>>> Subject: Re: aries-jax-rs-whiteboard with @JaxrsApplicationSelect
> >>>> and @JSONRequired result in 404
> >>>>
> >>>> Jaap,
> >>>> 1) You can use the web: commands to verify the expected context
> >>>> exists
> >>>> 2) Review karaf.log  to verify the the bundle startup and post
> >>>> relevant errors
> >>>> 3) I use the following features:
> >>>> jackson
> >>>> pax-web-http-whiteboard
> >>>> aries-jax-rs-whiteboard
> >>>> aries-jax-rs-whiteboard-jackson
> >>>>
> >>>> Paul Spencer
> >>>>
> >>>>>> On Jan 23, 2023, at 4:49 AM, Jaap Gordijn  wrote:
> >>>>>
> >>>>> Hi,
> >>>>>
> >>>>> I have a problem with aries-jax-rs-whiteboard and the use of
> >>>>> @JaxrsApplicationSelect and @JSONRequired in combination.
> >>>>> That results in an inaccessible service (404).
> >>>>> If I disable the JSON annotations, the /test service works (via
> >>>>> /example/text
> >>>>>
> >>>>> Code:
> >>>>>
> >>>>> @Component(service = Rest.class, scope = ServiceScope.PROTOTYPE)
> >>>>> @JaxrsResource @JaxrsApplicationSelect(&quo

Re: aries-jax-rs-whiteboard with @JaxrsApplicationSelect and @JSONRequired result in 404

2023-01-23 Thread Paul Spencer
Jaap,
Have you created the Jaxrs application?

@Component(service=Application.class)
@JaxrsName("MyApplication")
@JaxrsApplicationBase("/example")
public class MyApp extends Application{

}

Paul Spencer

> On Jan 23, 2023, at 7:39 AM, Jaap Gordijn  wrote:
> 
> Paul,
> 
> I used the features as you suggested.
> 
> In the log, I see that the Jetty container starts.
> Also the context path is registered:
> Registering 
> OsgiServletContext{model=OsgiContextModel{WB,id=OCM-5,name='context.forMyApplication',path='/example',bundle=org.apache.aries.jax.rs.whiteboard,ref=[org.osgi.service.http.context.ServletContextHelper]}}
>  as OSGi service for "/example" context pat
> 
> But then I get this:
> org.apache.cxf.cxf-rt-transports-http - 3.5.5 | Can't find the request for 
> http://172.20.116.137:8181/example/person's Observer
> 
> Best,
> 
> -- Jaap
> 
>> -Original Message-
>> From: Paul Spencer 
>> Sent: maandag 23 januari 2023 13:13
>> To: user@karaf.apache.org
>> Subject: Re: aries-jax-rs-whiteboard with @JaxrsApplicationSelect and
>> @JSONRequired result in 404
>> 
>> Jaap,
>> 1) You can use the web: commands to verify the expected context exists
>> 2) Review karaf.log  to verify the the bundle startup and post relevant 
>> errors
>> 3) I use the following features:
>>  jackson
>> pax-web-http-whiteboard
>> aries-jax-rs-whiteboard
>> aries-jax-rs-whiteboard-jackson
>> 
>> Paul Spencer
>> 
>>>> On Jan 23, 2023, at 4:49 AM, Jaap Gordijn  wrote:
>>> 
>>> Hi,
>>> 
>>> I have a problem with aries-jax-rs-whiteboard and the use of
>>> @JaxrsApplicationSelect and @JSONRequired in combination.
>>> That results in an inaccessible service (404).
>>> If I disable the JSON annotations, the /test service works (via
>>> /example/text
>>> 
>>> Code:
>>> 
>>> @Component(service = Rest.class, scope = ServiceScope.PROTOTYPE)
>>> @JaxrsResource @JaxrsApplicationSelect("(" +
>>> JaxrsWhiteboardConstants.JAX_RS_NAME +
>>> "=MyApplication)")
>>> @JSONRequired
>>> @Produces(MediaType.APPLICATION_JSON)
>>> public class Rest {
>>> 
>>>   @Reference(scope=ReferenceScope.PROTOTYPE_REQUIRED)
>>>   private volatile PersonService personService;
>>> 
>>>   @GET
>>>   @Path("/person")
>>>   public List listPersons() {
>>>   return personService.select();
>>>   }
>>> 
>>>   @GET
>>>   @Path("/test")
>>>   public String test() {
>>>   return "test";
>>>   }
>>> }
>>> 
>>> @Component(service=Application.class, property =
>>> {"servlet.init.hide-service-list-page=true"} )
>>> @JaxrsApplicationBase("example")
>>> @JaxrsName("MyApplication")
>>> public class MyApplication extends Application {
>>> 
>>> }
>>> 
>>> 
>>> mvn:org.apache.cxf.karaf/apache-cxf/3.5.5/xml/features>> posito
>>> ry>
>>> 
>>> mvn:org.apache.aries.jax.rs/org.apache.aries.jax.rs.featur
>>> es/2.0
>>> .2/xml>>  
>>>  hibernate
>>>  hibernate-validator
>>>  ...
>>> 
>>> I use Karaf 4.4.3
>>> 
>>> Any ideas?
>>> 
>>> Best,
>>> 
>>> -- Jaap
>>> 
> 


RE: aries-jax-rs-whiteboard with @JaxrsApplicationSelect and @JSONRequired result in 404

2023-01-23 Thread Jaap Gordijn
Paul,

I did the following to create the application.

@Component(service=Application.class, property =  
{"servlet.init.hide-service-list-page=true"} )
@JaxrsApplicationBase("example")
@JaxrsName("MyApplication")
public class MyApplication extends Application {
   
}

The strange thing is at that if I remove the @JaxrsApplicationSelect in the 
Rest service class, then it works. But not with the Application class.

-- Jaap

> -Original Message-
> From: Paul Spencer 
> Sent: maandag 23 januari 2023 14:11
> To: user@karaf.apache.org
> Subject: Re: aries-jax-rs-whiteboard with @JaxrsApplicationSelect and
> @JSONRequired result in 404
> 
> Jaap,
> Have you created the Jaxrs application?
> 
> @Component(service=Application.class)
> @JaxrsName("MyApplication")
> @JaxrsApplicationBase("/example")
> public class MyApp extends Application{
> 
> }
> 
> Paul Spencer
> 
> > On Jan 23, 2023, at 7:39 AM, Jaap Gordijn  wrote:
> >
> > Paul,
> >
> > I used the features as you suggested.
> >
> > In the log, I see that the Jetty container starts.
> > Also the context path is registered:
> > Registering
> > OsgiServletContext{model=OsgiContextModel{WB,id=OCM-
> 5,name='context.fo
> > rMyApplication',path='/example',bundle=org.apache.aries.jax.rs.whitebo
> > ard,ref=[org.osgi.service.http.context.ServletContextHelper]}} as OSGi
> > service for "/example" context pat
> >
> > But then I get this:
> > org.apache.cxf.cxf-rt-transports-http - 3.5.5 | Can't find the request
> > for http://172.20.116.137:8181/example/person's Observer
> >
> > Best,
> >
> > -- Jaap
> >
> >> -Original Message-
> >> From: Paul Spencer 
> >> Sent: maandag 23 januari 2023 13:13
> >> To: user@karaf.apache.org
> >> Subject: Re: aries-jax-rs-whiteboard with @JaxrsApplicationSelect and
> >> @JSONRequired result in 404
> >>
> >> Jaap,
> >> 1) You can use the web: commands to verify the expected context
> >> exists
> >> 2) Review karaf.log  to verify the the bundle startup and post
> >> relevant errors
> >> 3) I use the following features:
> >>  jackson
> >> pax-web-http-whiteboard
> >> aries-jax-rs-whiteboard
> >> aries-jax-rs-whiteboard-jackson
> >>
> >> Paul Spencer
> >>
> >>>> On Jan 23, 2023, at 4:49 AM, Jaap Gordijn  wrote:
> >>>
> >>> Hi,
> >>>
> >>> I have a problem with aries-jax-rs-whiteboard and the use of
> >>> @JaxrsApplicationSelect and @JSONRequired in combination.
> >>> That results in an inaccessible service (404).
> >>> If I disable the JSON annotations, the /test service works (via
> >>> /example/text
> >>>
> >>> Code:
> >>>
> >>> @Component(service = Rest.class, scope = ServiceScope.PROTOTYPE)
> >>> @JaxrsResource @JaxrsApplicationSelect("(" +
> >>> JaxrsWhiteboardConstants.JAX_RS_NAME +
> >>> "=MyApplication)")
> >>> @JSONRequired
> >>> @Produces(MediaType.APPLICATION_JSON)
> >>> public class Rest {
> >>>
> >>>   @Reference(scope=ReferenceScope.PROTOTYPE_REQUIRED)
> >>>   private volatile PersonService personService;
> >>>
> >>>   @GET
> >>>   @Path("/person")
> >>>   public List listPersons() {
> >>>   return personService.select();
> >>>   }
> >>>
> >>>   @GET
> >>>   @Path("/test")
> >>>   public String test() {
> >>>   return "test";
> >>>   }
> >>> }
> >>>
> >>> @Component(service=Application.class, property =
> >>> {"servlet.init.hide-service-list-page=true"} )
> >>> @JaxrsApplicationBase("example")
> >>> @JaxrsName("MyApplication")
> >>> public class MyApplication extends Application {
> >>>
> >>> }
> >>>
> >>>
> >>> mvn:org.apache.cxf.karaf/apache-cxf/3.5.5/xml/features >>> re
> >>> posito
> >>> ry>
> >>>
> >>> mvn:org.apache.aries.jax.rs/org.apache.aries.jax.rs.feat
> >>> ur
> >>> es/2.0
> >>> .2/xml >>>  
> >>>  hibernate
> >>>  hibernate-validator
> >>>  ...
> >>>
> >>> I use Karaf 4.4.3
> >>>
> >>> Any ideas?
> >>>
> >>> Best,
> >>>
> >>> -- Jaap
> >>>
> >



Re: aries-jax-rs-whiteboard with @JaxrsApplicationSelect and @JSONRequired result in 404

2023-01-23 Thread Paul Spencer
Jaap,
JaxrsApplicationBase is used with JaxrsApplicationSelect to is required to use 
a non-default context, so your results confirm the default context is working.

Paul Spencer

> On Jan 23, 2023, at 9:08 AM, Jaap Gordijn  wrote:
> 
> Paul,
> 
> I did the following to create the application.
> 
> @Component(service=Application.class, property =  
> {"servlet.init.hide-service-list-page=true"} )
> @JaxrsApplicationBase("example")
> @JaxrsName("MyApplication")
> public class MyApplication extends Application {
> 
> }
> 
> The strange thing is at that if I remove the @JaxrsApplicationSelect in the 
> Rest service class, then it works. But not with the Application class.
> 
> -- Jaap
> 
>> -Original Message-
>> From: Paul Spencer 
>> Sent: maandag 23 januari 2023 14:11
>> To: user@karaf.apache.org
>> Subject: Re: aries-jax-rs-whiteboard with @JaxrsApplicationSelect and
>> @JSONRequired result in 404
>> 
>> Jaap,
>> Have you created the Jaxrs application?
>> 
>> @Component(service=Application.class)
>> @JaxrsName("MyApplication")
>> @JaxrsApplicationBase("/example")
>> public class MyApp extends Application{
>> 
>> }
>> 
>> Paul Spencer
>> 
>>>> On Jan 23, 2023, at 7:39 AM, Jaap Gordijn  wrote:
>>> 
>>> Paul,
>>> 
>>> I used the features as you suggested.
>>> 
>>> In the log, I see that the Jetty container starts.
>>> Also the context path is registered:
>>> Registering
>>> OsgiServletContext{model=OsgiContextModel{WB,id=OCM-
>> 5,name='context.fo
>>> rMyApplication',path='/example',bundle=org.apache.aries.jax.rs.whitebo
>>> ard,ref=[org.osgi.service.http.context.ServletContextHelper]}} as OSGi
>>> service for "/example" context pat
>>> 
>>> But then I get this:
>>> org.apache.cxf.cxf-rt-transports-http - 3.5.5 | Can't find the request
>>> for http://172.20.116.137:8181/example/person's Observer
>>> 
>>> Best,
>>> 
>>> -- Jaap
>>> 
>>>> -Original Message-
>>>> From: Paul Spencer 
>>>> Sent: maandag 23 januari 2023 13:13
>>>> To: user@karaf.apache.org
>>>> Subject: Re: aries-jax-rs-whiteboard with @JaxrsApplicationSelect and
>>>> @JSONRequired result in 404
>>>> 
>>>> Jaap,
>>>> 1) You can use the web: commands to verify the expected context
>>>> exists
>>>> 2) Review karaf.log  to verify the the bundle startup and post
>>>> relevant errors
>>>> 3) I use the following features:
>>>> jackson
>>>> pax-web-http-whiteboard
>>>> aries-jax-rs-whiteboard
>>>> aries-jax-rs-whiteboard-jackson
>>>> 
>>>> Paul Spencer
>>>> 
>>>>>> On Jan 23, 2023, at 4:49 AM, Jaap Gordijn  wrote:
>>>>> 
>>>>> Hi,
>>>>> 
>>>>> I have a problem with aries-jax-rs-whiteboard and the use of
>>>>> @JaxrsApplicationSelect and @JSONRequired in combination.
>>>>> That results in an inaccessible service (404).
>>>>> If I disable the JSON annotations, the /test service works (via
>>>>> /example/text
>>>>> 
>>>>> Code:
>>>>> 
>>>>> @Component(service = Rest.class, scope = ServiceScope.PROTOTYPE)
>>>>> @JaxrsResource @JaxrsApplicationSelect("(" +
>>>>> JaxrsWhiteboardConstants.JAX_RS_NAME +
>>>>> "=MyApplication)")
>>>>> @JSONRequired
>>>>> @Produces(MediaType.APPLICATION_JSON)
>>>>> public class Rest {
>>>>> 
>>>>>  @Reference(scope=ReferenceScope.PROTOTYPE_REQUIRED)
>>>>>  private volatile PersonService personService;
>>>>> 
>>>>>  @GET
>>>>>  @Path("/person")
>>>>>  public List listPersons() {
>>>>>  return personService.select();
>>>>>  }
>>>>> 
>>>>>  @GET
>>>>>  @Path("/test")
>>>>>  public String test() {
>>>>>  return "test";
>>>>>  }
>>>>> }
>>>>> 
>>>>> @Component(service=Application.class, property =
>>>>> {"servlet.init.hide-service-list-page=true"} )
>>>>> @JaxrsApplicationBase("example")
>>>>> @JaxrsName("MyApplication")
>>>>> public class MyApplication extends Application {
>>>>> 
>>>>> }
>>>>> 
>>>>> 
>>>>> mvn:org.apache.cxf.karaf/apache-cxf/3.5.5/xml/features>>>> re
>>>>> posito
>>>>> ry>
>>>>> 
>>>>> mvn:org.apache.aries.jax.rs/org.apache.aries.jax.rs.feat
>>>>> ur
>>>>> es/2.0
>>>>> .2/xml>>>> 
>>>>> hibernate
>>>>> hibernate-validator
>>>>> ...
>>>>> 
>>>>> I use Karaf 4.4.3
>>>>> 
>>>>> Any ideas?
>>>>> 
>>>>> Best,
>>>>> 
>>>>> -- Jaap
>>>>> 
>>> 
> 


RE: aries-jax-rs-whiteboard with @JaxrsApplicationSelect and @JSONRequired result in 404

2023-01-23 Thread Jaap Gordijn
Paul,

I used the features as you suggested.

In the log, I see that the Jetty container starts.
Also the context path is registered:
Registering 
OsgiServletContext{model=OsgiContextModel{WB,id=OCM-5,name='context.forMyApplication',path='/example',bundle=org.apache.aries.jax.rs.whiteboard,ref=[org.osgi.service.http.context.ServletContextHelper]}}
 as OSGi service for "/example" context pat

But then I get this:
org.apache.cxf.cxf-rt-transports-http - 3.5.5 | Can't find the request for 
http://172.20.116.137:8181/example/person's Observer

Best,

-- Jaap

> -Original Message-
> From: Paul Spencer 
> Sent: maandag 23 januari 2023 13:13
> To: user@karaf.apache.org
> Subject: Re: aries-jax-rs-whiteboard with @JaxrsApplicationSelect and
> @JSONRequired result in 404
> 
>  Jaap,
> 1) You can use the web: commands to verify the expected context exists
> 2) Review karaf.log  to verify the the bundle startup and post relevant errors
> 3) I use the following features:
>   jackson
>  pax-web-http-whiteboard
>  aries-jax-rs-whiteboard
>  aries-jax-rs-whiteboard-jackson
> 
> Paul Spencer
> 
> > On Jan 23, 2023, at 4:49 AM, Jaap Gordijn  wrote:
> >
> > Hi,
> >
> > I have a problem with aries-jax-rs-whiteboard and the use of
> > @JaxrsApplicationSelect and @JSONRequired in combination.
> > That results in an inaccessible service (404).
> > If I disable the JSON annotations, the /test service works (via
> > /example/text
> >
> > Code:
> >
> > @Component(service = Rest.class, scope = ServiceScope.PROTOTYPE)
> > @JaxrsResource @JaxrsApplicationSelect("(" +
> > JaxrsWhiteboardConstants.JAX_RS_NAME +
> > "=MyApplication)")
> > @JSONRequired
> > @Produces(MediaType.APPLICATION_JSON)
> > public class Rest {
> >
> >@Reference(scope=ReferenceScope.PROTOTYPE_REQUIRED)
> >private volatile PersonService personService;
> >
> >@GET
> >@Path("/person")
> >public List listPersons() {
> >return personService.select();
> >}
> >
> >@GET
> >@Path("/test")
> >public String test() {
> >return "test";
> >}
> > }
> >
> > @Component(service=Application.class, property =
> > {"servlet.init.hide-service-list-page=true"} )
> > @JaxrsApplicationBase("example")
> > @JaxrsName("MyApplication")
> > public class MyApplication extends Application {
> >
> > }
> >
> >
> > mvn:org.apache.cxf.karaf/apache-cxf/3.5.5/xml/features > posito
> > ry>
> >
> > mvn:org.apache.aries.jax.rs/org.apache.aries.jax.rs.featur
> > es/2.0
> > .2/xml >   
> >   hibernate
> >   hibernate-validator
> >   ...
> >
> > I use Karaf 4.4.3
> >
> > Any ideas?
> >
> > Best,
> >
> > -- Jaap
> >



Re: aries-jax-rs-whiteboard with @JaxrsApplicationSelect and @JSONRequired result in 404

2023-01-23 Thread Paul Spencer
 Jaap,
1) You can use the web: commands to verify the expected context exists
2) Review karaf.log  to verify the the bundle startup and post relevant errors
3) I use the following features:
  jackson
 pax-web-http-whiteboard
 aries-jax-rs-whiteboard
 aries-jax-rs-whiteboard-jackson

Paul Spencer

> On Jan 23, 2023, at 4:49 AM, Jaap Gordijn  wrote:
> 
> Hi,
> 
> I have a problem with aries-jax-rs-whiteboard and the use of
> @JaxrsApplicationSelect and @JSONRequired in combination.
> That results in an inaccessible service (404).
> If I disable the JSON annotations, the /test service works (via
> /example/text
> 
> Code:
> 
> @Component(service = Rest.class, scope = ServiceScope.PROTOTYPE)
> @JaxrsResource
> @JaxrsApplicationSelect("(" + JaxrsWhiteboardConstants.JAX_RS_NAME +
> "=MyApplication)")
> @JSONRequired
> @Produces(MediaType.APPLICATION_JSON)
> public class Rest {
>
>@Reference(scope=ReferenceScope.PROTOTYPE_REQUIRED)
>private volatile PersonService personService;
> 
>@GET
>@Path("/person")
>public List listPersons() {
>return personService.select(); 
>}
>
>@GET
>@Path("/test")
>public String test() {
>return "test"; 
>}
> }
> 
> @Component(service=Application.class, property =
> {"servlet.init.hide-service-list-page=true"} )
> @JaxrsApplicationBase("example")
> @JaxrsName("MyApplication")
> public class MyApplication extends Application {
> 
> }
> 
> 
> mvn:org.apache.cxf.karaf/apache-cxf/3.5.5/xml/features ry>
> 
> mvn:org.apache.aries.jax.rs/org.apache.aries.jax.rs.features/2.0
> .2/xml   
>   hibernate
>   hibernate-validator
>   ...
> 
> I use Karaf 4.4.3
> 
> Any ideas?
> 
> Best,
> 
> -- Jaap
> 


Re: aries-jax-rs-whiteboard

2022-06-27 Thread Matthias Leinweber
Thank you very much Joao...
lets see if i can somehow connect this with karaf jaas service

br,
Matthias

Am Mo., 27. Juni 2022 um 17:40 Uhr schrieb João Assunção <
joao.assun...@exploitsys.com>:

> Hello Matthias.
>
> Sorry but I don't have a public repo with an example.
> I had some issues in the past when using more recent versions of Aries JAX
> RS due to conflicts with the CXF version I was using in another service, so
> I kept using version 1.0.4.
> In my latest projects, where I needed more customization, I ditched Aries
> JAX RS and used CXF directly. Needed more code and had to use
> JAXRSServerFactoryBean to create the server. Also lost the possibility to
> use service injection :-(
>
> The code for JWT is mostly taken from jose4j examples:
>
> @Component(service = JwtService.class, //
>> immediate = true, //
>> scope = ServiceScope.SINGLETON)
>> public class JwtService {
>>
>> private static final Logger LOGGER =
>> LoggerFactory.getLogger(JwtService.class);
>>
>> // time when the token will expire (minutes)
>> private static final float TOKEN_TTL = 30;
>>
>> public static final String ISSUER = "ACME";
>>
>> public static final String AUDIENCE = "universe";
>>
>> public static final String CLAIM_NAME = "name";
>>
>> public static final String CLAIM_PERMISSIONS = "permissions";
>>
>> private RsaJsonWebKey rsaJsonWebKey;
>>
>> private JwtConsumer jwtConsumer;
>>
>> @Activate
>> public void activate() throws JoseException {
>>
>> initWebKey();
>> initJWTconsumer();
>> }
>>
>> private void initWebKey() throws JoseException {
>>
>> rsaJsonWebKey = RsaJwkGenerator.generateJwk(2048);
>> rsaJsonWebKey.setKeyId("keyId");
>>
>> }
>>
>> private void initJWTconsumer() {
>>
>> jwtConsumer = new JwtConsumerBuilder()
>> .setRequireExpirationTime() // the JWT must have an
>> expiration
>> // time
>> .setAllowedClockSkewInSeconds(30) // allow some leeway in
>>   // validating time based
>>   // claims to account
>> for clock
>>   // skew
>> .setRequireSubject() // the JWT must have a subject claim
>> .setExpectedIssuer(ISSUER) // whom the JWT needs to have
>> been
>>// issued by
>> .setExpectedAudience(AUDIENCE) // to whom the JWT is
>> intended
>>// for
>> .setVerificationKey(rsaJsonWebKey.getKey()) // verify the
>> // signature
>> with
>> // the public
>> key
>> .setJwsAlgorithmConstraints( // only allow the expected
>>  // signature algorithm(s) in
>> the
>>  // given context
>> new
>> AlgorithmConstraints(ConstraintType.WHITELIST, // which
>>
>>  // is
>>
>>  // only
>>
>>  // RS256
>>
>>  // here
>> AlgorithmIdentifiers.RSA_USING_SHA256))
>> .build(); // create the JwtConsumer instance
>>
>> }
>>
>> public String createToken(SubjectDetails subjectDetails) throws
>> AuthenticationException {
>>
>> // Create the Claims, which will be the content of the JWT
>> JwtClaims claims = new JwtClaims();
>> claims.setIssuer(ISSUER); // who creates the token and signs it
>> claims.setAudience(AUDIENCE); // to whom the token is intended to
>> be
>>   // sent
>> claims.setExpirationTimeMinutesInTheFuture(TOKEN_TTL);
>> claims.setGeneratedJwtId(); // a unique identifier for the token
>> claims.setIssuedAtToNow(); // when the token was issued/created
>> (now)
>> claims.setNotBeforeMinutesInThePast(2);
>> claims.setSubject(subjectDetails.getId());
>> claims.setStringClaim(CLAIM_NAME, subjectDetails.getName());
>> claims.setStringListClaim(CLAIM_PERMISSIONS,
>> subjectDetails.getPermissionsList());
>>
>> // A JWT is a JWS and/or a JWE with JSON claims as the payload.
>> // In this example it is a JWS so we create a JsonWebSignature
>> object.
>> JsonWebSignature jws = new JsonWebSignature();
>>
>> // The payload of the JWS is JSON content of the JWT Claims
>> jws.setPayload(claims.toJson());
>>
>> // The JWT is signed using the private key
>> jws.setKey(rsaJsonWebKey.getPrivateKey());
>>
>> jws.setKeyIdHeaderValue(rsaJsonWebKey.getKeyId());
>>
>> // Set the signature algorithm on the JWT/JWS that will integrity
>> // protect the claims
>>
>> 

Re: aries-jax-rs-whiteboard

2022-06-27 Thread João Assunção
Hello Matthias.

Sorry but I don't have a public repo with an example.
I had some issues in the past when using more recent versions of Aries JAX
RS due to conflicts with the CXF version I was using in another service, so
I kept using version 1.0.4.
In my latest projects, where I needed more customization, I ditched Aries
JAX RS and used CXF directly. Needed more code and had to use
JAXRSServerFactoryBean to create the server. Also lost the possibility to
use service injection :-(

The code for JWT is mostly taken from jose4j examples:

@Component(service = JwtService.class, //
> immediate = true, //
> scope = ServiceScope.SINGLETON)
> public class JwtService {
>
> private static final Logger LOGGER =
> LoggerFactory.getLogger(JwtService.class);
>
> // time when the token will expire (minutes)
> private static final float TOKEN_TTL = 30;
>
> public static final String ISSUER = "ACME";
>
> public static final String AUDIENCE = "universe";
>
> public static final String CLAIM_NAME = "name";
>
> public static final String CLAIM_PERMISSIONS = "permissions";
>
> private RsaJsonWebKey rsaJsonWebKey;
>
> private JwtConsumer jwtConsumer;
>
> @Activate
> public void activate() throws JoseException {
>
> initWebKey();
> initJWTconsumer();
> }
>
> private void initWebKey() throws JoseException {
>
> rsaJsonWebKey = RsaJwkGenerator.generateJwk(2048);
> rsaJsonWebKey.setKeyId("keyId");
>
> }
>
> private void initJWTconsumer() {
>
> jwtConsumer = new JwtConsumerBuilder()
> .setRequireExpirationTime() // the JWT must have an
> expiration
> // time
> .setAllowedClockSkewInSeconds(30) // allow some leeway in
>   // validating time based
>   // claims to account for
> clock
>   // skew
> .setRequireSubject() // the JWT must have a subject claim
> .setExpectedIssuer(ISSUER) // whom the JWT needs to have
> been
>// issued by
> .setExpectedAudience(AUDIENCE) // to whom the JWT is
> intended
>// for
> .setVerificationKey(rsaJsonWebKey.getKey()) // verify the
> // signature
> with
> // the public
> key
> .setJwsAlgorithmConstraints( // only allow the expected
>  // signature algorithm(s) in
> the
>  // given context
> new AlgorithmConstraints(ConstraintType.WHITELIST,
> // which
>
>  // is
>
>  // only
>
>  // RS256
>
>  // here
> AlgorithmIdentifiers.RSA_USING_SHA256))
> .build(); // create the JwtConsumer instance
>
> }
>
> public String createToken(SubjectDetails subjectDetails) throws
> AuthenticationException {
>
> // Create the Claims, which will be the content of the JWT
> JwtClaims claims = new JwtClaims();
> claims.setIssuer(ISSUER); // who creates the token and signs it
> claims.setAudience(AUDIENCE); // to whom the token is intended to
> be
>   // sent
> claims.setExpirationTimeMinutesInTheFuture(TOKEN_TTL);
> claims.setGeneratedJwtId(); // a unique identifier for the token
> claims.setIssuedAtToNow(); // when the token was issued/created
> (now)
> claims.setNotBeforeMinutesInThePast(2);
> claims.setSubject(subjectDetails.getId());
> claims.setStringClaim(CLAIM_NAME, subjectDetails.getName());
> claims.setStringListClaim(CLAIM_PERMISSIONS,
> subjectDetails.getPermissionsList());
>
> // A JWT is a JWS and/or a JWE with JSON claims as the payload.
> // In this example it is a JWS so we create a JsonWebSignature
> object.
> JsonWebSignature jws = new JsonWebSignature();
>
> // The payload of the JWS is JSON content of the JWT Claims
> jws.setPayload(claims.toJson());
>
> // The JWT is signed using the private key
> jws.setKey(rsaJsonWebKey.getPrivateKey());
>
> jws.setKeyIdHeaderValue(rsaJsonWebKey.getKeyId());
>
> // Set the signature algorithm on the JWT/JWS that will integrity
> // protect the claims
> jws.setAlgorithmHeaderValue(AlgorithmIdentifiers.RSA_USING_SHA256);
>
> try {
> return jws.getCompactSerialization();
> }
> catch (JoseException ex) {
> throw new AuthenticationException("Token creation failed", ex);
> }
> }
>
> public SubjectDetails 

Re: aries-jax-rs-whiteboard

2022-06-27 Thread Matthias Leinweber
Hello,

I am using karaf 4.3.7 and yes I saw the examples in karaf. The version
used is 1.0.6 which is pretty old. I tried to update to 1.0.10 but i dont
see what is going wrong. There is the Application, Servlet, and Whiteboard.
But the servlet is not accessible.
With version 2.0.1 is cxf-core required. That would also be fine.
Unfortunately it does not work without a url prefix which would require a
change on the client side.

@ João thank you very much for your help. Do you also have a repo link to a
working example; where does the JWTService come from?

Thank
br,
Matthias

Am Do., 23. Juni 2022 um 11:02 Uhr schrieb João Assunção <
joao.assun...@exploitsys.com>:

> Hello Matthias,
>
> Regarding authentication I normally use a ContainerRequestFilter.
> Follows an example of a filter where authentication is done using a JWT
> token.
> It uses JwtService that is responsible for creating and validating tokens.
> It uses jose4j.
>
>
> @Secured
>> @Provider
>> @Priority(Priorities.AUTHENTICATION)
>> @Component(scope = ServiceScope.PROTOTYPE, //
>> service = { ContainerRequestFilter.class }, //
>> property = {
>> JaxrsWhiteboardConstants.JAX_RS_EXTENSION + "=" + true, //
>> JaxrsWhiteboardConstants.JAX_RS_NAME + "=" +
>> "TokenAuthenticationFilter", //
>> Constants.JAX_RS_APPLICATION_SELECT, //
>> })
>> public class TokenAuthenticationFilter implements ContainerRequestFilter {
>>
>> private static final Logger LOGGER =
>> LoggerFactory.getLogger(TokenAuthenticationFilter.class);
>>
>> private static final String AUTHENTICATION_SCHEME = "Bearer";
>>
>> private static final String AUTHENTICATION_SCHEME_PREFIX =
>> AUTHENTICATION_SCHEME + " ";
>>
>> @Reference(cardinality = ReferenceCardinality.MANDATORY)
>> JwtService jwtService;
>>
>> @Context
>> private ResourceInfo resourceInfo;
>>
>> @Override
>> public void filter(ContainerRequestContext requestContext) throws
>> IOException {
>>
>> // Get the Authorization header from the request
>> String authorizationHeader =
>> requestContext.getHeaderString(HttpHeaders.AUTHORIZATION);
>> LOGGER.debug("authorizationHeader {}", authorizationHeader);
>> // Validate the Authorization header
>> if (!isTokenBasedAuthentication(authorizationHeader)) {
>> LOGGER.info("Missing auth token. Aborting");
>> abortWithUnauthorized(requestContext);
>> return;
>> }
>> // Extract the token from the Authorization header
>> final String token =
>> authorizationHeader.substring(AUTHENTICATION_SCHEME_PREFIX.length());
>> try {
>> // Validate the token. An exception will be thrown if invalid
>> SubjectDetails subjectDetails =
>> jwtService.validateToken(token);
>> LOGGER.debug("Token for subject {} accepted",
>> subjectDetails.getId());
>> initSecurityContext(requestContext, subjectDetails);
>> Permission requiredPermission =
>> getPermissionForResource(resourceInfo);
>> if (!subjectDetails.hasPermission(requiredPermission)) {
>> LOGGER.debug("subject {} lack permission {}",
>> subjectDetails.getId(), requiredPermission);
>> abortWithForbidden(requestContext);
>> }
>> }
>> catch (AuthenticationException e) {
>> LOGGER.trace("Ignored", e);
>> LOGGER.info("Token validation failed. Aborting");
>> abortWithUnauthorized(requestContext);
>> }
>> }
>>
>> /**
>>  * @param requestContext
>>  * @param subjectDetails
>>  */
>> private void initSecurityContext(ContainerRequestContext
>> requestContext, SubjectDetails subjectDetails) {
>>
>> final SecurityContext currentSecurityContext =
>> requestContext.getSecurityContext();
>> boolean secure = currentSecurityContext.isSecure();
>> requestContext.setSecurityContext(new
>> InternalSecurityContext(subjectDetails, secure));
>>
>> }
>>
>> private boolean isTokenBasedAuthentication(String
>> authorizationHeader) {
>>
>> // Check if the Authorization header is valid
>> // It must not be null and must be prefixed with "Bearer" plus a
>> // whitespace
>> // The authentication scheme comparison must be case-insensitive
>> return StringUtils.startsWithIgnoreCase(authorizationHeader,
>> AUTHENTICATION_SCHEME_PREFIX);
>> }
>>
>> private void abortWithUnauthorized(ContainerRequestContext
>> requestContext) {
>>
>> // Abort the filter chain with a 401 status code response
>> // The WWW-Authenticate header is sent along with the response
>> requestContext.abortWith(
>> Response.status(Response.Status.UNAUTHORIZED)
>> .header(HttpHeaders.WWW_AUTHENTICATE,
>> AUTHENTICATION_SCHEME + " 

Re: aries-jax-rs-whiteboard

2022-06-23 Thread João Assunção
Hello Matthias,

Regarding authentication I normally use a ContainerRequestFilter.
Follows an example of a filter where authentication is done using a JWT
token.
It uses JwtService that is responsible for creating and validating tokens.
It uses jose4j.


@Secured
> @Provider
> @Priority(Priorities.AUTHENTICATION)
> @Component(scope = ServiceScope.PROTOTYPE, //
> service = { ContainerRequestFilter.class }, //
> property = {
> JaxrsWhiteboardConstants.JAX_RS_EXTENSION + "=" + true, //
> JaxrsWhiteboardConstants.JAX_RS_NAME + "=" +
> "TokenAuthenticationFilter", //
> Constants.JAX_RS_APPLICATION_SELECT, //
> })
> public class TokenAuthenticationFilter implements ContainerRequestFilter {
>
> private static final Logger LOGGER =
> LoggerFactory.getLogger(TokenAuthenticationFilter.class);
>
> private static final String AUTHENTICATION_SCHEME = "Bearer";
>
> private static final String AUTHENTICATION_SCHEME_PREFIX =
> AUTHENTICATION_SCHEME + " ";
>
> @Reference(cardinality = ReferenceCardinality.MANDATORY)
> JwtService jwtService;
>
> @Context
> private ResourceInfo resourceInfo;
>
> @Override
> public void filter(ContainerRequestContext requestContext) throws
> IOException {
>
> // Get the Authorization header from the request
> String authorizationHeader =
> requestContext.getHeaderString(HttpHeaders.AUTHORIZATION);
> LOGGER.debug("authorizationHeader {}", authorizationHeader);
> // Validate the Authorization header
> if (!isTokenBasedAuthentication(authorizationHeader)) {
> LOGGER.info("Missing auth token. Aborting");
> abortWithUnauthorized(requestContext);
> return;
> }
> // Extract the token from the Authorization header
> final String token =
> authorizationHeader.substring(AUTHENTICATION_SCHEME_PREFIX.length());
> try {
> // Validate the token. An exception will be thrown if invalid
> SubjectDetails subjectDetails =
> jwtService.validateToken(token);
> LOGGER.debug("Token for subject {} accepted",
> subjectDetails.getId());
> initSecurityContext(requestContext, subjectDetails);
> Permission requiredPermission =
> getPermissionForResource(resourceInfo);
> if (!subjectDetails.hasPermission(requiredPermission)) {
> LOGGER.debug("subject {} lack permission {}",
> subjectDetails.getId(), requiredPermission);
> abortWithForbidden(requestContext);
> }
> }
> catch (AuthenticationException e) {
> LOGGER.trace("Ignored", e);
> LOGGER.info("Token validation failed. Aborting");
> abortWithUnauthorized(requestContext);
> }
> }
>
> /**
>  * @param requestContext
>  * @param subjectDetails
>  */
> private void initSecurityContext(ContainerRequestContext
> requestContext, SubjectDetails subjectDetails) {
>
> final SecurityContext currentSecurityContext =
> requestContext.getSecurityContext();
> boolean secure = currentSecurityContext.isSecure();
> requestContext.setSecurityContext(new
> InternalSecurityContext(subjectDetails, secure));
>
> }
>
> private boolean isTokenBasedAuthentication(String authorizationHeader)
> {
>
> // Check if the Authorization header is valid
> // It must not be null and must be prefixed with "Bearer" plus a
> // whitespace
> // The authentication scheme comparison must be case-insensitive
> return StringUtils.startsWithIgnoreCase(authorizationHeader,
> AUTHENTICATION_SCHEME_PREFIX);
> }
>
> private void abortWithUnauthorized(ContainerRequestContext
> requestContext) {
>
> // Abort the filter chain with a 401 status code response
> // The WWW-Authenticate header is sent along with the response
> requestContext.abortWith(
> Response.status(Response.Status.UNAUTHORIZED)
> .header(HttpHeaders.WWW_AUTHENTICATE,
> AUTHENTICATION_SCHEME + " realm=\"" +
> Constants.APP_NAME + "\"")
> .build());
> }
>
> private void abortWithForbidden(ContainerRequestContext
> requestContext) {
>
>
> requestContext.abortWith(Response.status(Response.Status.FORBIDDEN).build());
> }
>
> static Permission getPermissionForResource(ResourceInfo resourceInfo) {
>
> Permission permission =
> extractPermission(resourceInfo.getResourceMethod());
> if (permission != null) {
> return permission;
> }
> permission = extractPermission(resourceInfo.getResourceClass());
> return permission;
>
> }
>
> // Extract Permission from the annotated element
> static Permission extractPermission(AnnotatedElement annotatedElement)
> {
>
> if 

Re: aries-jax-rs-whiteboard

2022-06-23 Thread Jean-Baptiste Onofré
Hi Matthias,

Which Karaf version are you using ?

Aries JAX RS is tested in Karaf itests but due to some changes in
Aries JAX-RS whiteboard, we didn't update yet.
You can take a look on the example:
https://github.com/apache/karaf/tree/main/examples/karaf-rest-example

I created https://issues.apache.org/jira/browse/KARAF-7455 to upgrade
Aries JAX-RS whiteboard.

Regards
JB

On Wed, Jun 22, 2022 at 9:53 PM Matthias Leinweber
 wrote:
>
> Hello Karaf user,
>
> i try to get aries-jax-rs-whiteboard in a version > 1.0.6 running without 
> success. 2.0.1 with installed cxf is working fine. But in 1.0.7-1.0.10. 
> http:list does not show a servlet and my jaxrs whiteboard resources are not 
> working.
>
> Any hints which component needs to be installed? Reading BNDrun + Components 
> DSL is pretty confusing.
>
> Btw, does anyone have a good example for authentication? Shiro seems to be a 
> bit overkill.
>
> br,
> Matthias


Re: Aries jax-rs whiteboard

2019-11-19 Thread Matthias Leinweber
Well thank you for all the explanations I finally went for Olegs solution.
I also tried to create a component service factory for a
PrototypeServiceFactory with the required
properties to select my application, but I failed.

Best regards and thank you,
Matthias

Am Mo., 18. Nov. 2019 um 11:34 Uhr schrieb Tim Ward :

> Hi,
>
> Ok, but why and how does it work for the default application?… I can not
> see that JsonProviderPrototypeServiceFactory somehow adds a property for
> the default app.
>
>
> The reason that it works in the default application is that, by default,
> whiteboard resources and extensions target the default application. Note
> that in the JavaDoc for the application select property
> 
>  it
> says that *"Services without this service property are bound to the
> default Application.” *
>
> The reason that this works is therefore that the
> MessageBodyReader/MessageBodyWriter service supplying JSON support in your
> application is now targeting the same application as your whiteboard
> resource. The other option that I outlined was effectively the reverse
> approach to reach the same goal, namely adding an application select filter
> to the JSON extension service.
>
> There i don't need to select an extension in the resource but
> serialization works?
>
>
> Technically you *do* still need to select the extension in order for
> things to work 100% reliably. You can see this by investigating what
> happens when you stop the Aries Jackson bundle. You will see that your
> resource service is still hosted by the whiteboard, but that it explodes
> because there is no JSON support. What the extension select filter does is
> to tell the whiteboard not to host your whiteboard service until an
> appropriate extension is also present. In the absence of this filter your
> resource will always be hosted, whether the JSON support is available or
> not. Most of the time, however (basically at all times after startup has
> finished) your application will have both services and everything will work
> fine.
>
> Or is there some voodoo with SERVICE_RANKING?
>
>
> There isn’t any voodoo with service ranking in the spec, except to say
> that if you have two services that could provide the same endpoint (or the
> same extension support) then the higher ranked service will win. Service
> ranking plays no role in the examples that we’ve been working with.
>
> Tbh i don't even find the point where the configuration for
> pid org.apache.aries.jax.rs.jackson is created.
>
>
> That’s because there isn’t one. The service starts up with its default
> configuration (which is good enough for many cases) and doesn’t require
> configuration admin in order to run.
>
> Besides the versioning of org.apache.aries.jax.rs.jackson seems broken and
> the feature has a hardcoded dep on version 1.0.0 which source i cant find
> at all.. and the artifacts in current source aren't build at all.
>
>
> This is the CI job for the Aries JAX-RS Whiteboard integration projects,
> which are built separately from the whiteboard because they evolve at
> different speeds.
>
> https://builds.apache.org/job/Aries-JAX-RS-Whiteboard-Integrations/
>
> I see releases 1.0.0 to 1.0.2 in Maven Central, all of them with source
> jars.
>
>
> https://mvnrepository.com/artifact/org.apache.aries.jax.rs/org.apache.aries.jax.rs.jackson
>
> I hope this helps, all the best,
>
> Tim
>
> On 17 Nov 2019, at 17:27, Matthias Leinweber 
> wrote:
>
> Hello Tim,
>
> thank you, again you improved my knowledge. I just stripped my code for
> simplicity.
>
> Ok, but why and how does it work for the default application?
> There i don't need to select an extension in the resource but
> serialization works? I can not see that JsonProviderPrototypeServiceFactory
> somehow adds a property for the default app. Or is there some voodoo with
> SERVICE_RANKING?. Tbh i don't even find the point where the configuration
> for pid org.apache.aries.jax.rs.jackson is created.
>
> Besides the versioning of org.apache.aries.jax.rs.jackson seems broken and
> the feature has a hardcoded dep on version 1.0.0 which source i cant find
> at all.. and the artifacts in current source aren't build at all.
>
> kr,
> Matthias
>
> So somehow the extension selection logic looks odd. Or is this made
> media-type mapping?
>
>
> Tim Ward  schrieb am Fr., 15. Nov. 2019, 17:23:
>
>> Hi Matthias,
>>
>> So from the example that you’ve given I’m not sure why you have the
>> whiteboard application at all. Providing an empty whiteboard application
>> doesn’t really give you any benefit - the primary use case is for
>> registering existing non-OSGi JAX-RS applications, or for where you already
>> have a bunch of resource classes.
>>
>> In any event, the reason that what you have isn’t working for you is that
>> the JSON extension isn’t targeting your application. It’s not enough to
>> 

Re: Aries jax-rs whiteboard

2019-11-18 Thread Tim Ward
Hi,

> Ok, but why and how does it work for the default application?… I can not see 
> that JsonProviderPrototypeServiceFactory somehow adds a property for the 
> default app.

The reason that it works in the default application is that, by default, 
whiteboard resources and extensions target the default application. Note that 
in the JavaDoc for the application select property 

 it says that "Services without this service property are bound to the default 
Application.” 

The reason that this works is therefore that the 
MessageBodyReader/MessageBodyWriter service supplying JSON support in your 
application is now targeting the same application as your whiteboard resource. 
The other option that I outlined was effectively the reverse approach to reach 
the same goal, namely adding an application select filter to the JSON extension 
service.

> There i don't need to select an extension in the resource but serialization 
> works?

Technically you *do* still need to select the extension in order for things to 
work 100% reliably. You can see this by investigating what happens when you 
stop the Aries Jackson bundle. You will see that your resource service is still 
hosted by the whiteboard, but that it explodes because there is no JSON 
support. What the extension select filter does is to tell the whiteboard not to 
host your whiteboard service until an appropriate extension is also present. In 
the absence of this filter your resource will always be hosted, whether the 
JSON support is available or not. Most of the time, however (basically at all 
times after startup has finished) your application will have both services and 
everything will work fine.

> Or is there some voodoo with SERVICE_RANKING?

There isn’t any voodoo with service ranking in the spec, except to say that if 
you have two services that could provide the same endpoint (or the same 
extension support) then the higher ranked service will win. Service ranking 
plays no role in the examples that we’ve been working with.

> Tbh i don't even find the point where the configuration for pid 
> org.apache.aries.jax.rs.jackson is created.

That’s because there isn’t one. The service starts up with its default 
configuration (which is good enough for many cases) and doesn’t require 
configuration admin in order to run.

> Besides the versioning of org.apache.aries.jax.rs.jackson seems broken and 
> the feature has a hardcoded dep on version 1.0.0 which source i cant find at 
> all.. and the artifacts in current source aren't build at all.


This is the CI job for the Aries JAX-RS Whiteboard integration projects, which 
are built separately from the whiteboard because they evolve at different 
speeds.

https://builds.apache.org/job/Aries-JAX-RS-Whiteboard-Integrations/ 


I see releases 1.0.0 to 1.0.2 in Maven Central, all of them with source jars.

https://mvnrepository.com/artifact/org.apache.aries.jax.rs/org.apache.aries.jax.rs.jackson
 


I hope this helps, all the best,

Tim

> On 17 Nov 2019, at 17:27, Matthias Leinweber  
> wrote:
> 
> Hello Tim,
> 
> thank you, again you improved my knowledge. I just stripped my code for 
> simplicity. 
> 
> Ok, but why and how does it work for the default application?
> There i don't need to select an extension in the resource but serialization 
> works? I can not see that JsonProviderPrototypeServiceFactory somehow adds a 
> property for the default app. Or is there some voodoo with SERVICE_RANKING?. 
> Tbh i don't even find the point where the configuration for pid 
> org.apache.aries.jax.rs.jackson is created.
> 
> Besides the versioning of org.apache.aries.jax.rs.jackson seems broken and 
> the feature has a hardcoded dep on version 1.0.0 which source i cant find at 
> all.. and the artifacts in current source aren't build at all.
> 
> kr,
> Matthias
> 
> So somehow the extension selection logic looks odd. Or is this made 
> media-type mapping?
> 
> 
> Tim Ward mailto:tim.w...@paremus.com>> schrieb am Fr., 
> 15. Nov. 2019, 17:23:
> Hi Matthias,
> 
> So from the example that you’ve given I’m not sure why you have the 
> whiteboard application at all. Providing an empty whiteboard application 
> doesn’t really give you any benefit - the primary use case is for registering 
> existing non-OSGi JAX-RS applications, or for where you already have a bunch 
> of resource classes.
> 
> In any event, the reason that what you have isn’t working for you is that the 
> JSON extension isn’t targeting your application. It’s not enough to just put 
> "osgi.jaxrs.application.select=(osgi.jaxrs.name 
> =MyApp)” on the resource, it must also go on the 
> extension, meaning that you need to configure the 

Re: Aries jax-rs whiteboard

2019-11-17 Thread Matthias Leinweber
Hello Tim,

thank you, again you improved my knowledge. I just stripped my code for
simplicity.

Ok, but why and how does it work for the default application?
There i don't need to select an extension in the resource but serialization
works? I can not see that JsonProviderPrototypeServiceFactory somehow adds
a property for the default app. Or is there some voodoo with
SERVICE_RANKING?. Tbh i don't even find the point where the configuration
for pid org.apache.aries.jax.rs.jackson is created.

Besides the versioning of org.apache.aries.jax.rs.jackson seems broken and
the feature has a hardcoded dep on version 1.0.0 which source i cant find
at all.. and the artifacts in current source aren't build at all.

kr,
Matthias

So somehow the extension selection logic looks odd. Or is this made
media-type mapping?


Tim Ward  schrieb am Fr., 15. Nov. 2019, 17:23:

> Hi Matthias,
>
> So from the example that you’ve given I’m not sure why you have the
> whiteboard application at all. Providing an empty whiteboard application
> doesn’t really give you any benefit - the primary use case is for
> registering existing non-OSGi JAX-RS applications, or for where you already
> have a bunch of resource classes.
>
> In any event, the reason that what you have isn’t working for you is that
> the JSON extension isn’t targeting your application. It’s not enough to
> just put "osgi.jaxrs.application.select=(osgi.jaxrs.name=MyApp)” on the
> resource, it must also go on the extension, meaning that you need to
> configure the Aries JAX-RS support to add that property.
>
>
> The other suggested fix, as Oleg outlined, is for example:
>
> @Component(
> service = Application.class,
> property = {
>   "osgi.jaxrs.name=MyApp",
>   "osgi.jaxrs.application.base=/app",
> })
> public class MyApp extends Application {
> @Reference(target="(osgi.jaxrs.name=jaxb-json)”)
> Object writer;
>
> @Override
> public Set getSingletons() {
> Feature f = fc -> fc.register(writer, MessageBodyWriter.class,
> MessageBodyReader.class);
> Set singletons = new HashSet<>();
> singletons.add(f);
> return singletons;
> }
> }
>
> @Path("/service")
> @Component(
> service = MyService.class,
> property = {
>   "osgi.jaxrs.resource=true",
>   "osgi.jaxrs.application.select=(osgi.jaxrs.name=MyApp)",
> })
> public class MyService ...
>
>
> On 15 Nov 2019, at 15:35, Oleg Cohen  wrote:
>
> Hi Matthias,
>
> I was in the same situation. Here is what I ended up doing. Perhaps it
> will work for you.
>
> Here is my code:
>
> *import* java.util.HashSet;
> *import* java.util.Set;
>
> *import* javax.ws.rs.core.Application;
>
> *import* org.apache.logging.log4j.Logger;
> *import* org.osgi.service.component.annotations.Activate;
> *import* org.osgi.service.component.annotations.Component;
> *import*
> org.osgi.service.jaxrs.whiteboard.propertytypes.JaxrsApplicationBase;
> *import* org.osgi.service.jaxrs.whiteboard.propertytypes.JaxrsName;
>
> *import* com.fasterxml.jackson.annotation.JsonInclude.Include;
> *import* com.fasterxml.jackson.databind.DeserializationFeature;
> *import* com.fasterxml.jackson.databind.ObjectMapper;
> *import* com.fasterxml.jackson.databind.SerializationFeature;
> *import* com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
>
> @Component(service = Application.*class*)
> @JaxrsApplicationBase(“my-app")
> @JaxrsName(“MyApplication")
> *public* *class* MyApplication *extends* Application {
>
> *private* *static* *final* Logger *logger* =
> org.apache.logging.log4j.LogManager.*getLogger*(MyApplication.*class*);
>
> *private* JacksonJsonProvider jsonProvider;
>
> @Activate
> *private* *void* activate() {
>
> *logger*.info(“MyApplication.activate(): Entry ...");
>
> ObjectMapper objectMapper = *new* ObjectMapper();
>
> objectMapper = *new* ObjectMapper();
>
> objectMapper.setSerializationInclusion(Include.*NON_NULL*);
>
> objectMapper.configure(SerializationFeature.*WRITE_DATES_AS_TIMESTAMPS*,
> *false*);
>
> objectMapper.configure(DeserializationFeature.
> *ADJUST_DATES_TO_CONTEXT_TIME_ZONE*, *false*);
>
> jsonProvider = *new* JacksonJsonProvider(objectMapper);
>
> *logger*.info(“MyApplication.activate(): jsonProvider = " + jsonProvider);
> }
>
> @Override
> *public* Set getSingletons() {
>
> Set singletons = *new* HashSet<>();
>
> singletons.add(jsonProvider);
>
> *return* singletons;
> }
> }
>
>
> On Nov 15, 2019, at 10:26 AM, Matthias Leinweber <
> m.leinwe...@datatactics.de> wrote:
>
> Ok that is something i already tried. But i don't want to use a own
> MessageWriter/Reader. I just want to use the one provided by aries-http
> whiteboard:
> [javax.ws.rs.ext.MessageBodyReader, javax.ws.rs.ext.MessageBodyWriter]
> --
>  jackson.jaxb.version = 2.9.6
>  jackson.jaxrs.json.version = 2.9.6
>  osgi.jaxrs.extension = true
>  osgi.jaxrs.media.type = application/json
>  

Re: Aries jax-rs whiteboard

2019-11-15 Thread Tim Ward
Hi Matthias,

So from the example that you’ve given I’m not sure why you have the whiteboard 
application at all. Providing an empty whiteboard application doesn’t really 
give you any benefit - the primary use case is for registering existing 
non-OSGi JAX-RS applications, or for where you already have a bunch of resource 
classes.

In any event, the reason that what you have isn’t working for you is that the 
JSON extension isn’t targeting your application. It’s not enough to just put 
"osgi.jaxrs.application.select=(osgi.jaxrs.name=MyApp)” on the resource, it 
must also go on the extension, meaning that you need to configure the Aries 
JAX-RS support to add that property.


The other suggested fix, as Oleg outlined, is for example:

@Component(
service = Application.class,
property = {
  "osgi.jaxrs.name =MyApp",
  "osgi.jaxrs.application.base=/app",
})
public class MyApp extends Application {
@Reference(target="(osgi.jaxrs.name =jaxb-json)”)
Object writer;

@Override
public Set getSingletons() {
Feature f = fc -> fc.register(writer, MessageBodyWriter.class, 
MessageBodyReader.class);
Set singletons = new HashSet<>();
singletons.add(f);
return singletons;
}
}

@Path("/service")
@Component(
service = MyService.class,
property = {
  "osgi.jaxrs.resource=true",
  "osgi.jaxrs.application.select=(osgi.jaxrs.name 
=MyApp)",
})
public class MyService ...


> On 15 Nov 2019, at 15:35, Oleg Cohen  wrote:
> 
> Hi Matthias,
> 
> I was in the same situation. Here is what I ended up doing. Perhaps it will 
> work for you.
> 
> Here is my code:
> 
> import java.util.HashSet;
> import java.util.Set;
> 
> import javax.ws.rs.core.Application;
> 
> import org.apache.logging.log4j.Logger;
> import org.osgi.service.component.annotations.Activate;
> import org.osgi.service.component.annotations.Component;
> import org.osgi.service.jaxrs.whiteboard.propertytypes.JaxrsApplicationBase;
> import org.osgi.service.jaxrs.whiteboard.propertytypes.JaxrsName;
> 
> import com.fasterxml.jackson.annotation.JsonInclude.Include;
> import com.fasterxml.jackson.databind.DeserializationFeature;
> import com.fasterxml.jackson.databind.ObjectMapper;
> import com.fasterxml.jackson.databind.SerializationFeature;
> import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
> 
> @Component(service = Application.class)
> @JaxrsApplicationBase(“my-app")
> @JaxrsName(“MyApplication")
> public class MyApplication extends Application {
> 
>   private static final Logger logger = 
> org.apache.logging.log4j.LogManager.getLogger(MyApplication.class);
>   
>   private JacksonJsonProvider jsonProvider;
>   
>   @Activate
>   private void activate() {
>   
>   logger.info(“MyApplication.activate(): Entry ...");
>   
>   ObjectMapper objectMapper = new ObjectMapper();
>   
>   objectMapper = new ObjectMapper();
> 
>   objectMapper.setSerializationInclusion(Include.NON_NULL);
>   
>   
> objectMapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
>   
>   
> objectMapper.configure(DeserializationFeature.ADJUST_DATES_TO_CONTEXT_TIME_ZONE,
>  false);
>   
>   jsonProvider = new JacksonJsonProvider(objectMapper);
>   
>   logger.info(“MyApplication.activate(): jsonProvider = " + 
> jsonProvider);
>   }
>   
> @Override
> public Set getSingletons() {
> 
> Set singletons = new HashSet<>();
> 
> singletons.add(jsonProvider);
> 
> return singletons;
> }
> }
> 
> 
>> On Nov 15, 2019, at 10:26 AM, Matthias Leinweber > > wrote:
>> 
>> Ok that is something i already tried. But i don't want to use a own 
>> MessageWriter/Reader. I just want to use the one provided by aries-http 
>> whiteboard:
>> [javax.ws.rs.ext.MessageBodyReader, javax.ws.rs.ext.MessageBodyWriter]
>> --
>>  jackson.jaxb.version = 2.9.6
>>  jackson.jaxrs.json.version = 2.9.6
>>  osgi.jaxrs.extension = true
>>  osgi.jaxrs.media.type = application/json
>>  osgi.jaxrs.name  = jaxb-json
>>  service.bundleid = 46
>>  service.id  = 170
>>  service.ranking = -2147483648
>>  service.scope = prototype
>> Provided by : 
>>  Apache Aries JAX-RS JAX-RS Jackson (46)
>> Used by: 
>>  Apache Aries JAX-RS Whiteboard (47)
>> 
>> But something is wrong...
>> 
>> My components are configured this way...
>> 
>> @Component(
>> service = Application.class,
>> property = {
>>   "osgi.jaxrs.name =MyApp",
>>   "osgi.jaxrs.application.base=/app",
>>   
>> 

Re: Aries jax-rs whiteboard

2019-11-15 Thread Matthias Leinweber
Well yes that works but there must be a way to
use JsonProviderPrototypeServiceFactory provided by the
bundle: org.apache.aries.jax.rs.jackson.

regards Matthias

Am Fr., 15. Nov. 2019 um 16:35 Uhr schrieb Oleg Cohen <
oleg.co...@assurebridge.com>:

> Hi Matthias,
>
> I was in the same situation. Here is what I ended up doing. Perhaps it
> will work for you.
>
> Here is my code:
>
> *import* java.util.HashSet;
> *import* java.util.Set;
>
> *import* javax.ws.rs.core.Application;
>
> *import* org.apache.logging.log4j.Logger;
> *import* org.osgi.service.component.annotations.Activate;
> *import* org.osgi.service.component.annotations.Component;
> *import*
> org.osgi.service.jaxrs.whiteboard.propertytypes.JaxrsApplicationBase;
> *import* org.osgi.service.jaxrs.whiteboard.propertytypes.JaxrsName;
>
> *import* com.fasterxml.jackson.annotation.JsonInclude.Include;
> *import* com.fasterxml.jackson.databind.DeserializationFeature;
> *import* com.fasterxml.jackson.databind.ObjectMapper;
> *import* com.fasterxml.jackson.databind.SerializationFeature;
> *import* com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
>
> @Component(service = Application.*class*)
> @JaxrsApplicationBase(“my-app")
> @JaxrsName(“MyApplication")
> *public* *class* MyApplication *extends* Application {
>
> *private* *static* *final* Logger *logger* =
> org.apache.logging.log4j.LogManager.*getLogger*(MyApplication.*class*);
>
>
> *private* JacksonJsonProvider jsonProvider;
>
>
> @Activate
> *private* *void* activate() {
>
>
> *logger*.info(“MyApplication.activate(): Entry ...");
>
>
> ObjectMapper objectMapper = *new* ObjectMapper();
>
>
> objectMapper = *new* ObjectMapper();
>
> objectMapper.setSerializationInclusion(Include.*NON_NULL*);
>
>
> objectMapper.configure(SerializationFeature.*WRITE_DATES_AS_TIMESTAMPS*,
> *false*);
>
>
> objectMapper.configure(DeserializationFeature.
> *ADJUST_DATES_TO_CONTEXT_TIME_ZONE*, *false*);
>
>
> jsonProvider = *new* JacksonJsonProvider(objectMapper);
>
>
> *logger*.info(“MyApplication.activate(): jsonProvider = " + jsonProvider);
> }
>
>
> @Override
> *public* Set getSingletons() {
>
> Set singletons = *new* HashSet<>();
>
>
> singletons.add(jsonProvider);
>
> *return* singletons;
> }
>
> }
>
>
> On Nov 15, 2019, at 10:26 AM, Matthias Leinweber <
> m.leinwe...@datatactics.de> wrote:
>
> Ok that is something i already tried. But i don't want to use a own
> MessageWriter/Reader. I just want to use the one provided by aries-http
> whiteboard:
> [javax.ws.rs.ext.MessageBodyReader, javax.ws.rs.ext.MessageBodyWriter]
> --
>  jackson.jaxb.version = 2.9.6
>  jackson.jaxrs.json.version = 2.9.6
>  osgi.jaxrs.extension = true
>  osgi.jaxrs.media.type = application/json
>  osgi.jaxrs.name = jaxb-json
>  service.bundleid = 46
>  service.id = 170
>  service.ranking = -2147483648
>  service.scope = prototype
> Provided by :
>  Apache Aries JAX-RS JAX-RS Jackson (46)
> Used by:
>  Apache Aries JAX-RS Whiteboard (47)
>
> But something is wrong...
>
> My components are configured this way...
>
> @Component(
> service = Application.class,
> property = {
>   "osgi.jaxrs.name=MyApp",
>   "osgi.jaxrs.application.base=/app",
>
> "osgi.jaxrs.whiteboard.target=(service.pid=org.apache.aries.jax.rs.whiteboard.default)",
>   //"osgi.jaxrs.extension.select=(osgi.jaxrs.name=jaxb-json)" <- i
> tried it also here
> })
> public class MyApp extends Application {}
>
> @Path("/service")
> @Component(
> service = MyService.class,
> property = {
>   "osgi.jaxrs.resource=true",
>   "osgi.jaxrs.application.select=(osgi.jaxrs.name=MyApp)",
>   "osgi.jaxrs.extension.select=(osgi.jaxrs.name=jaxb-json)" <- with
> this line the complete karaf installation is not responding
> })
> public class MyService ...
>
> Am Fr., 15. Nov. 2019 um 11:47 Uhr schrieb Tim Ward  >:
>
>> Hi Matthias,
>>
>> So it sounds as though you’re in the following situation:
>>
>>1. Providing a custom Application to the whiteboard
>>2. The application service has the property osgi.jaxrs.name = MyApp
>>set on the service registration
>>3. Your application needs, but does not contain, JSON serialisation
>>support
>>4. You want to use an external MessageBodyReader and
>>MessageBodyWriter service to extend your application
>>
>>
>> Assuming that these are correct then:
>>
>>
>>1. Your Application needs to tell the whiteboard that it is missing
>>some required extensions. This will prevent it being deployed until the
>>extension is available. See the details of the
>>osgi.jaxrs.extension.select
>>
>> 
>>  property
>>which will need to match service properties on your whiteboard extension
>>2. Your external MessageBodyReader and MessageBodyWriter will need to
>>be registered 

Re: Aries jax-rs whiteboard

2019-11-15 Thread Oleg Cohen
Hi Matthias,

I was in the same situation. Here is what I ended up doing. Perhaps it will 
work for you.

Here is my code:

import java.util.HashSet;
import java.util.Set;

import javax.ws.rs.core.Application;

import org.apache.logging.log4j.Logger;
import org.osgi.service.component.annotations.Activate;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.jaxrs.whiteboard.propertytypes.JaxrsApplicationBase;
import org.osgi.service.jaxrs.whiteboard.propertytypes.JaxrsName;

import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;

@Component(service = Application.class)
@JaxrsApplicationBase(“my-app")
@JaxrsName(“MyApplication")
public class MyApplication extends Application {

private static final Logger logger = 
org.apache.logging.log4j.LogManager.getLogger(MyApplication.class);

private JacksonJsonProvider jsonProvider;

@Activate
private void activate() {

logger.info(“MyApplication.activate(): Entry ...");

ObjectMapper objectMapper = new ObjectMapper();

objectMapper = new ObjectMapper();

objectMapper.setSerializationInclusion(Include.NON_NULL);


objectMapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);


objectMapper.configure(DeserializationFeature.ADJUST_DATES_TO_CONTEXT_TIME_ZONE,
 false);

jsonProvider = new JacksonJsonProvider(objectMapper);

logger.info(“MyApplication.activate(): jsonProvider = " + 
jsonProvider);
}

@Override
public Set getSingletons() {

Set singletons = new HashSet<>();

singletons.add(jsonProvider);

return singletons;
}
}


> On Nov 15, 2019, at 10:26 AM, Matthias Leinweber  
> wrote:
> 
> Ok that is something i already tried. But i don't want to use a own 
> MessageWriter/Reader. I just want to use the one provided by aries-http 
> whiteboard:
> [javax.ws.rs.ext.MessageBodyReader, javax.ws.rs.ext.MessageBodyWriter]
> --
>  jackson.jaxb.version = 2.9.6
>  jackson.jaxrs.json.version = 2.9.6
>  osgi.jaxrs.extension = true
>  osgi.jaxrs.media.type = application/json
>  osgi.jaxrs.name  = jaxb-json
>  service.bundleid = 46
>  service.id  = 170
>  service.ranking = -2147483648
>  service.scope = prototype
> Provided by : 
>  Apache Aries JAX-RS JAX-RS Jackson (46)
> Used by: 
>  Apache Aries JAX-RS Whiteboard (47)
> 
> But something is wrong...
> 
> My components are configured this way...
> 
> @Component(
> service = Application.class,
> property = {
>   "osgi.jaxrs.name =MyApp",
>   "osgi.jaxrs.application.base=/app",
>   
> "osgi.jaxrs.whiteboard.target=(service.pid=org.apache.aries.jax.rs.whiteboard.default)",
>   //"osgi.jaxrs.extension.select=(osgi.jaxrs.name 
> =jaxb-json)" <- i tried it also here
> })
> public class MyApp extends Application {}
> 
> @Path("/service")
> @Component(
> service = MyService.class,
> property = {
>   "osgi.jaxrs.resource=true",
>   "osgi.jaxrs.application.select=(osgi.jaxrs.name 
> =MyApp)",
>   "osgi.jaxrs.extension.select=(osgi.jaxrs.name 
> =jaxb-json)" <- with this line the complete karaf 
> installation is not responding
> })
> public class MyService ...
> 
> Am Fr., 15. Nov. 2019 um 11:47 Uhr schrieb Tim Ward  >:
> Hi Matthias,
> 
> So it sounds as though you’re in the following situation:
> Providing a custom Application to the whiteboard
> The application service has the property osgi.jaxrs.name 
>  = MyApp set on the service registration
> Your application needs, but does not contain, JSON serialisation support
> You want to use an external MessageBodyReader and MessageBodyWriter service 
> to extend your application
> 
> Assuming that these are correct then:
> 
> Your Application needs to tell the whiteboard that it is missing some 
> required extensions. This will prevent it being deployed until the extension 
> is available. See the details of the osgi.jaxrs.extension.select 
> 
>  property which will need to match service properties on your whiteboard 
> extension
> Your external MessageBodyReader and MessageBodyWriter will need to be 
> registered with
> The service has the property 

Re: Aries jax-rs whiteboard

2019-11-15 Thread Matthias Leinweber
Ok that is something i already tried. But i don't want to use a own
MessageWriter/Reader. I just want to use the one provided by aries-http
whiteboard:
[javax.ws.rs.ext.MessageBodyReader, javax.ws.rs.ext.MessageBodyWriter]
--
 jackson.jaxb.version = 2.9.6
 jackson.jaxrs.json.version = 2.9.6
 osgi.jaxrs.extension = true
 osgi.jaxrs.media.type = application/json
 osgi.jaxrs.name = jaxb-json
 service.bundleid = 46
 service.id = 170
 service.ranking = -2147483648
 service.scope = prototype
Provided by :
 Apache Aries JAX-RS JAX-RS Jackson (46)
Used by:
 Apache Aries JAX-RS Whiteboard (47)

But something is wrong...

My components are configured this way...

@Component(
service = Application.class,
property = {
  "osgi.jaxrs.name=MyApp",
  "osgi.jaxrs.application.base=/app",

"osgi.jaxrs.whiteboard.target=(service.pid=org.apache.aries.jax.rs.whiteboard.default)",
  //"osgi.jaxrs.extension.select=(osgi.jaxrs.name=jaxb-json)" <- i
tried it also here
})
public class MyApp extends Application {}

@Path("/service")
@Component(
service = MyService.class,
property = {
  "osgi.jaxrs.resource=true",
  "osgi.jaxrs.application.select=(osgi.jaxrs.name=MyApp)",
  "osgi.jaxrs.extension.select=(osgi.jaxrs.name=jaxb-json)" <- with
this line the complete karaf installation is not responding
})
public class MyService ...

Am Fr., 15. Nov. 2019 um 11:47 Uhr schrieb Tim Ward :

> Hi Matthias,
>
> So it sounds as though you’re in the following situation:
>
>1. Providing a custom Application to the whiteboard
>2. The application service has the property osgi.jaxrs.name = MyApp
>set on the service registration
>3. Your application needs, but does not contain, JSON serialisation
>support
>4. You want to use an external MessageBodyReader and MessageBodyWriter
>service to extend your application
>
>
> Assuming that these are correct then:
>
>
>1. Your Application needs to tell the whiteboard that it is missing
>some required extensions. This will prevent it being deployed until the
>extension is available. See the details of the
>osgi.jaxrs.extension.select
>
> 
>  property
>which will need to match service properties on your whiteboard extension
>2. Your external MessageBodyReader and MessageBodyWriter will need to
>be registered with
>   1. The service has the property osgi.jaxrs.extension = true (to say
>   that this is an extension)
>   2. The service registers the interfaces MessageBodyReader and
>   MessageBodyWriter (defining the types that the whiteboard will use it 
> as)
>   3. The service has the relevant property(ies) to match your
>   application’s extension select filter
>   4. The service has the property osgi.jaxrs.application.select = (
>   osgi.jaxrs.name=MyApp) to select your application as a target
>
>
> Another option is simply to set the extension as a part of your whiteboard
> application. This way you avoid the need to set quite so many service
> properties because the application is “complete” and doesn’t need to
> register a dependency or be targeted by an extension.
>
> All the best,
>
> Tim
>
> On 15 Nov 2019, at 00:07, Matthias Leinweber 
> wrote:
>
> Ok i hit an additional problem.
> When i create a JaxRsApplication i can reference them in my resource
> everything works fine except the MessageWriter and MessageReader e.g.
> Jackson Extension is not found.
> --> No message body writer has been found for class ... ContentType:
> application/json
> Without "osgi.jaxrs.application.select=(osgi.jaxrs.name=MyApp)",
> serialization works.
>
> I also tried to explicitly select the whiteboard for the Application,
> with 
> "osgi.jaxrs.whiteboard.target=(service.pid=org.apache.aries.jax.rs.whiteboard.default)"
> but that doesn't work.
> How does the injection mechanism work? I couldn't figure it out reading
> the aries source code.
>
> regards,
> Matthias
>
> Am Fr., 8. Nov. 2019 um 10:28 Uhr schrieb Tim Ward :
>
>> Hi,
>>
>> Yes, you can absolutely inject things using @Context (this is the only
>> way to do server sent events, so it’s not optional for any implementation).
>> It’s recommended that you inject into resource methods, rather than into
>> fields, unless you make your service prototype scope. This is to avoid any
>> potential threading mismatch if you inject invocation scoped objects (e.g.
>> an incoming HttpServletRequest) and get two http calls at the same time.
>>
>> Tim
>>
>> On 7 Nov 2019, at 16:24, Matthias Leinweber 
>> wrote:
>>
>> Great. Thank you very much.
>>
>> I dont want to add CXF or Jersey. thank to your answer I have come up
>> with the idea myself to inject the  @Context HttpServletRequest into the
>> JaxRS code. To mix in this:
>> 

Re: Aries jax-rs whiteboard

2019-11-15 Thread Tim Ward
Hi Matthias,

So it sounds as though you’re in the following situation:
Providing a custom Application to the whiteboard
The application service has the property osgi.jaxrs.name = MyApp set on the 
service registration
Your application needs, but does not contain, JSON serialisation support
You want to use an external MessageBodyReader and MessageBodyWriter service to 
extend your application

Assuming that these are correct then:

Your Application needs to tell the whiteboard that it is missing some required 
extensions. This will prevent it being deployed until the extension is 
available. See the details of the osgi.jaxrs.extension.select 

 property which will need to match service properties on your whiteboard 
extension
Your external MessageBodyReader and MessageBodyWriter will need to be 
registered with
The service has the property osgi.jaxrs.extension = true (to say that this is 
an extension)
The service registers the interfaces MessageBodyReader and MessageBodyWriter 
(defining the types that the whiteboard will use it as)
The service has the relevant property(ies) to match your application’s 
extension select filter
The service has the property osgi.jaxrs.application.select = 
(osgi.jaxrs.name=MyApp) to select your application as a target

Another option is simply to set the extension as a part of your whiteboard 
application. This way you avoid the need to set quite so many service 
properties because the application is “complete” and doesn’t need to register a 
dependency or be targeted by an extension.

All the best,

Tim

> On 15 Nov 2019, at 00:07, Matthias Leinweber  
> wrote:
> 
> Ok i hit an additional problem.
> When i create a JaxRsApplication i can reference them in my resource 
> everything works fine except the MessageWriter and MessageReader e.g. Jackson 
> Extension is not found.
> --> No message body writer has been found for class ... ContentType: 
> application/json
> Without "osgi.jaxrs.application.select=(osgi.jaxrs.name 
> =MyApp)", serialization works.
> 
> I also tried to explicitly select the whiteboard for the Application, with 
> "osgi.jaxrs.whiteboard.target=(service.pid=org.apache.aries.jax.rs.whiteboard.default)"
>  but that doesn't work.
> How does the injection mechanism work? I couldn't figure it out reading the 
> aries source code.
> 
> regards,
> Matthias
> 
> Am Fr., 8. Nov. 2019 um 10:28 Uhr schrieb Tim Ward  >:
> Hi,
> 
> Yes, you can absolutely inject things using @Context (this is the only way to 
> do server sent events, so it’s not optional for any implementation). It’s 
> recommended that you inject into resource methods, rather than into fields, 
> unless you make your service prototype scope. This is to avoid any potential 
> threading mismatch if you inject invocation scoped objects (e.g. an incoming 
> HttpServletRequest) and get two http calls at the same time.
> 
> Tim
> 
>> On 7 Nov 2019, at 16:24, Matthias Leinweber > > wrote:
>> 
>> Great. Thank you very much.
>> 
>> I dont want to add CXF or Jersey. thank to your answer I have come up with 
>> the idea myself to inject the  @Context HttpServletRequest into the JaxRS 
>> code. To mix in this: 
>> https://osgi.org/specification/osgi.cmpn/7.0.0/service.http.whiteboard.html#d0e120961
>>  
>> 
>> I didn't test it yet but does it work? I don't see that the aries JaxRs 
>> whiteboard impl somewhere defined 
>> osgi.http.whiteboard.servlet.multipart.enabled=true
>> 
>> Best regards,
>> Matthias
>> 
>> Am Do., 7. Nov. 2019 um 15:38 Uhr schrieb Tim Ward > >:
>> Hi Matthias
>> 
>>> I was a bit confused about how you could add a Servelt to the 
>>> JaxRsWhiteboard instead of the HttpWhiteboard for Multi-Part file uploads.
>> 
>> I hope it’s now clear that the JAX-RS whiteboard does not support Servlets. 
>> You can either:
>> Register a servlet with the Http Whiteboard and find a place to put the file
>> Handle the multipart file upload using JAX-RS
>> 
>> If the file upload is only needed by your JAX-RS components then I would 
>> recommend just using JAX-RS rather than a servlet.
>> 
>>> * So a JaxRsResource can but most not belong to an application?
>> 
>> A JAX-RS Whiteboard resource is just a “bare” resource in the service 
>> registry. In the most common case the resource service that you register 
>> will bind to the “default” application provided by the JAX-RS Whiteboard. 
>> There is no need to deploy a custom whiteboard application for resources to 
>> be hosted by the JAX-RS whiteboard.
>> 
>>> * It's fine to put all your Resources into the same JaxRsWhiteboard even if 
>>> you could separate them?
>> 
>> Yes. This will work fine. All the resources (by default) will get hosted in 
>> the 

Re: Aries jax-rs whiteboard

2019-11-14 Thread Matthias Leinweber
Ok i hit an additional problem.
When i create a JaxRsApplication i can reference them in my resource
everything works fine except the MessageWriter and MessageReader e.g.
Jackson Extension is not found.
--> No message body writer has been found for class ... ContentType:
application/json
Without "osgi.jaxrs.application.select=(osgi.jaxrs.name=MyApp)",
serialization works.

I also tried to explicitly select the whiteboard for the Application,
with 
"osgi.jaxrs.whiteboard.target=(service.pid=org.apache.aries.jax.rs.whiteboard.default)"
but that doesn't work.
How does the injection mechanism work? I couldn't figure it out reading the
aries source code.

regards,
Matthias

Am Fr., 8. Nov. 2019 um 10:28 Uhr schrieb Tim Ward :

> Hi,
>
> Yes, you can absolutely inject things using @Context (this is the only way
> to do server sent events, so it’s not optional for any implementation).
> It’s recommended that you inject into resource methods, rather than into
> fields, unless you make your service prototype scope. This is to avoid any
> potential threading mismatch if you inject invocation scoped objects (e.g.
> an incoming HttpServletRequest) and get two http calls at the same time.
>
> Tim
>
> On 7 Nov 2019, at 16:24, Matthias Leinweber 
> wrote:
>
> Great. Thank you very much.
>
> I dont want to add CXF or Jersey. thank to your answer I have come up with
> the idea myself to inject the  @Context HttpServletRequest into the JaxRS
> code. To mix in this:
> https://osgi.org/specification/osgi.cmpn/7.0.0/service.http.whiteboard.html#d0e120961
> I didn't test it yet but does it work? I don't see that the aries JaxRs
> whiteboard impl somewhere
> defined osgi.http.whiteboard.servlet.multipart.enabled=true
>
> Best regards,
> Matthias
>
> Am Do., 7. Nov. 2019 um 15:38 Uhr schrieb Tim Ward :
>
>> Hi Matthias
>>
>> I was a bit confused about how you could add a Servelt to the
>> JaxRsWhiteboard instead of the HttpWhiteboard for Multi-Part file uploads.
>>
>>
>> I hope it’s now clear that the JAX-RS whiteboard does not support
>> Servlets. You can either:
>>
>>- Register a servlet with the Http Whiteboard and find a place to put
>>the file
>>- Handle the multipart file upload using JAX-RS
>>
>>
>> If the file upload is only needed by your JAX-RS components then I would
>> recommend just using JAX-RS rather than a servlet.
>>
>> * So a JaxRsResource can but most not belong to an application?
>>
>>
>> A JAX-RS Whiteboard resource is just a “bare” resource in the service
>> registry. In the most common case the resource service that you register
>> will bind to the “default” application provided by the JAX-RS Whiteboard.
>> There is no need to deploy a custom whiteboard application for resources to
>> be hosted by the JAX-RS whiteboard.
>>
>> * It's fine to put all your Resources into the same JaxRsWhiteboard even
>> if you could separate them?
>>
>>
>> Yes. This will work fine. All the resources (by default) will get hosted
>> in the default application. If you do want to provide some isolation
>> between the resources (e.g. if you need differently configured JSON
>> providers for different resources) then you can still do this with a single
>> JAX-RSWhiteboard, but you will need to provide separate Applications for
>> the resources and extensions. This is because applications within the
>> whiteboard *are* isolated from each other, and can have different sets of
>> resources and extensions.
>>
>> In general, however, you’re pretty safe just registering all the
>> resources and extensions that you need directly with the whiteboard using
>> the default application.
>>
>> All the best,
>>
>> Tim
>>
>>
>> On 7 Nov 2019, at 12:54, Matthias Leinweber 
>> wrote:
>>
>> Hello Tim,
>>
>> thanks for your reply. I get the JaxRS Application thing wrong. I thought
>> that an application and a JaxRsResource is/can be the same. But obviously,
>> if you read the documentation correct, then not.
>> Then it also makes sense to inject the Application with @Context
>> Applicaiton app into a method.
>> I had also a misunderstanding with http and jaxrs whiteboard. I was a
>> bit confused about how you could add a Servelt to the JaxRsWhiteboard
>> instead of the HttpWhiteboard for Multi-Part file uploads.
>> I think the default app and the configuration of the default jaxrs
>> whiteboard caused some confusion for me.
>>
>> * So a JaxRsResource can but most not belong to an application?
>> * It's fine to put all your Resources into the same JaxRsWhiteboard even
>> if you could separate them?
>>
>> right? then I think, I understood the thing and i like it :)
>>
>> Best regards
>> Matthias
>>
>> Am Do., 7. Nov. 2019 um 13:24 Uhr schrieb Tim Ward > >:
>>
>>> in OSGI 6 I think we should be able to use
>>> @Component(property = {"osgi.jaxrs.name=myApp",
>>> "osgi.jaxrs.application.base=/foo"}, service = A.class)
>>> class...
>>> That does not work or did I misunderstood something?
>>>
>>>
>>> If you want to register an application with 

Re: Aries jax-rs whiteboard

2019-11-08 Thread Tim Ward
Hi,

Yes, you can absolutely inject things using @Context (this is the only way to 
do server sent events, so it’s not optional for any implementation). It’s 
recommended that you inject into resource methods, rather than into fields, 
unless you make your service prototype scope. This is to avoid any potential 
threading mismatch if you inject invocation scoped objects (e.g. an incoming 
HttpServletRequest) and get two http calls at the same time.

Tim

> On 7 Nov 2019, at 16:24, Matthias Leinweber  
> wrote:
> 
> Great. Thank you very much.
> 
> I dont want to add CXF or Jersey. thank to your answer I have come up with 
> the idea myself to inject the  @Context HttpServletRequest into the JaxRS 
> code. To mix in this: 
> https://osgi.org/specification/osgi.cmpn/7.0.0/service.http.whiteboard.html#d0e120961
>  
> 
> I didn't test it yet but does it work? I don't see that the aries JaxRs 
> whiteboard impl somewhere defined 
> osgi.http.whiteboard.servlet.multipart.enabled=true
> 
> Best regards,
> Matthias
> 
> Am Do., 7. Nov. 2019 um 15:38 Uhr schrieb Tim Ward  >:
> Hi Matthias
> 
>> I was a bit confused about how you could add a Servelt to the 
>> JaxRsWhiteboard instead of the HttpWhiteboard for Multi-Part file uploads.
> 
> I hope it’s now clear that the JAX-RS whiteboard does not support Servlets. 
> You can either:
> Register a servlet with the Http Whiteboard and find a place to put the file
> Handle the multipart file upload using JAX-RS
> 
> If the file upload is only needed by your JAX-RS components then I would 
> recommend just using JAX-RS rather than a servlet.
> 
>> * So a JaxRsResource can but most not belong to an application?
> 
> A JAX-RS Whiteboard resource is just a “bare” resource in the service 
> registry. In the most common case the resource service that you register will 
> bind to the “default” application provided by the JAX-RS Whiteboard. There is 
> no need to deploy a custom whiteboard application for resources to be hosted 
> by the JAX-RS whiteboard.
> 
>> * It's fine to put all your Resources into the same JaxRsWhiteboard even if 
>> you could separate them?
> 
> Yes. This will work fine. All the resources (by default) will get hosted in 
> the default application. If you do want to provide some isolation between the 
> resources (e.g. if you need differently configured JSON providers for 
> different resources) then you can still do this with a single 
> JAX-RSWhiteboard, but you will need to provide separate Applications for the 
> resources and extensions. This is because applications within the whiteboard 
> *are* isolated from each other, and can have different sets of resources and 
> extensions.
> 
> In general, however, you’re pretty safe just registering all the resources 
> and extensions that you need directly with the whiteboard using the default 
> application.
> 
> All the best,
> 
> Tim
> 
> 
>> On 7 Nov 2019, at 12:54, Matthias Leinweber > > wrote:
>> 
>> Hello Tim,
>> 
>> thanks for your reply. I get the JaxRS Application thing wrong. I thought 
>> that an application and a JaxRsResource is/can be the same. But obviously, 
>> if you read the documentation correct, then not.
>> Then it also makes sense to inject the Application with @Context Applicaiton 
>> app into a method.
>> I had also a misunderstanding with http and jaxrs whiteboard. I was a bit 
>> confused about how you could add a Servelt to the JaxRsWhiteboard instead of 
>> the HttpWhiteboard for Multi-Part file uploads.
>> I think the default app and the configuration of the default jaxrs 
>> whiteboard caused some confusion for me.
>> 
>> * So a JaxRsResource can but most not belong to an application?
>> * It's fine to put all your Resources into the same JaxRsWhiteboard even if 
>> you could separate them?
>> 
>> right? then I think, I understood the thing and i like it :)
>> 
>> Best regards
>> Matthias
>> 
>> Am Do., 7. Nov. 2019 um 13:24 Uhr schrieb Tim Ward > >:
>>> in OSGI 6 I think we should be able to use
>>> @Component(property = {"osgi.jaxrs.name =myApp", 
>>> "osgi.jaxrs.application.base=/foo"}, service = A.class)
>>> class...
>>> That does not work or did I misunderstood something?
>> 
>> If you want to register an application with the whiteboard then you must 
>> register it as a javax.ws.rs .core.Application in the 
>> service registry. This is outlined at 
>> https://osgi.org/specification/osgi.cmpou 
>> cann/7.0.0/service.jaxrs.html#service.jaxrs.application.services 
>> 
>> 
>>> Second how do i create additional Servlets and how do I select them in a 
>>> resource?
>>> E.g. A configfile/servicepid
>>> org.apache.aries.jax.rs.whiteboard-bar.cfg
>>> 

Re: Aries jax-rs whiteboard

2019-11-07 Thread Jean-Baptiste Onofré
Hi Matthias,

The Aries JAXRS Whiteboard implementation uses CXF behind the hood ;)

Regards
JB

On 07/11/2019 17:24, Matthias Leinweber wrote:
> Great. Thank you very much.
> 
> I dont want to add CXF or Jersey. thank to your answer I have come up
> with the idea myself to inject the  @Context HttpServletRequest into the
> JaxRS code. To mix in
> this: 
> https://osgi.org/specification/osgi.cmpn/7.0.0/service.http.whiteboard.html#d0e120961
> I didn't test it yet but does it work? I don't see that the aries JaxRs
> whiteboard impl somewhere
> defined osgi.http.whiteboard.servlet.multipart.enabled=true
> 
> Best regards,
> Matthias
> 
> Am Do., 7. Nov. 2019 um 15:38 Uhr schrieb Tim Ward  >:
> 
> Hi Matthias
> 
>> I was a bit confused about how you could add a Servelt to the
>> JaxRsWhiteboard instead of the HttpWhiteboard for Multi-Part file
>> uploads.
> 
> I hope it’s now clear that the JAX-RS whiteboard does not support
> Servlets. You can either:
> 
>   * Register a servlet with the Http Whiteboard and find a place to
> put the file
>   * Handle the multipart file upload using JAX-RS
> 
> 
> If the file upload is only needed by your JAX-RS components then I
> would recommend just using JAX-RS rather than a servlet.
> 
>> * So a JaxRsResource can but most not belong to an application?
> 
> A JAX-RS Whiteboard resource is just a “bare” resource in the
> service registry. In the most common case the resource service that
> you register will bind to the “default” application provided by the
> JAX-RS Whiteboard. There is no need to deploy a custom whiteboard
> application for resources to be hosted by the JAX-RS whiteboard.
> 
>> * It's fine to put all your Resources into the same
>> JaxRsWhiteboard even if you could separate them?
> 
> Yes. This will work fine. All the resources (by default) will get
> hosted in the default application. If you do want to provide some
> isolation between the resources (e.g. if you need differently
> configured JSON providers for different resources) then you can
> still do this with a single JAX-RSWhiteboard, but you will need to
> provide separate Applications for the resources and extensions. This
> is because applications within the whiteboard *are* isolated from
> each other, and can have different sets of resources and extensions.
> 
> In general, however, you’re pretty safe just registering all the
> resources and extensions that you need directly with the whiteboard
> using the default application.
> 
> All the best,
> 
> Tim
> 
> 
>> On 7 Nov 2019, at 12:54, Matthias Leinweber
>> mailto:m.leinwe...@datatactics.de>>
>> wrote:
>>
>> Hello Tim,
>>
>> thanks for your reply. I get the JaxRS Application thing wrong. I
>> thought that an application and a JaxRsResource is/can be the
>> same. But obviously, if you read the documentation correct, then not.
>> Then it also makes sense to inject the Application with @Context
>> Applicaiton app into a method.
>> I had also a misunderstanding with http and jaxrs whiteboard. I
>> was a bit confused about how you could add a Servelt to the
>> JaxRsWhiteboard instead of the HttpWhiteboard for Multi-Part file
>> uploads.
>> I think the default app and the configuration of the default jaxrs
>> whiteboard caused some confusion for me.
>>
>> * So a JaxRsResource can but most not belong to an application?
>> * It's fine to put all your Resources into the same
>> JaxRsWhiteboard even if you could separate them?
>>
>> right? then I think, I understood the thing and i like it :)
>>
>> Best regards
>> Matthias
>>
>> Am Do., 7. Nov. 2019 um 13:24 Uhr schrieb Tim Ward
>> mailto:tim.w...@paremus.com>>:
>>
>>> in OSGI 6 I think we should be able to use
>>> @Component(property = {"osgi.jaxrs.name
>>> =myApp",
>>> "osgi.jaxrs.application.base=/foo"}, service = A.class)
>>> class...
>>> That does not work or did I misunderstood something?
>>
>> If you want to register an application with the whiteboard
>> then you must register it as a javax.ws.rs
>> .core.Application in the service
>> registry. This is outlined
>> at https://osgi.org/specification/osgi.cmpou
>> cann/7.0.0/service.jaxrs.html#service.jaxrs.application.services
>> 
>> 
>>
>>> Second how do i create additional Servlets and how do I
>>> select them in a resource?
>>> E.g. A configfile/servicepid
>>> org.apache.aries.jax.rs.whiteboard-bar.cfg
>>> application.base.prefix=/bar
>>> should create an additional servlet container?
>>
>> I’m 

Re: Aries jax-rs whiteboard

2019-11-07 Thread Matthias Leinweber
Great. Thank you very much.

I dont want to add CXF or Jersey. thank to your answer I have come up with
the idea myself to inject the  @Context HttpServletRequest into the JaxRS
code. To mix in this:
https://osgi.org/specification/osgi.cmpn/7.0.0/service.http.whiteboard.html#d0e120961
I didn't test it yet but does it work? I don't see that the aries JaxRs
whiteboard impl somewhere
defined osgi.http.whiteboard.servlet.multipart.enabled=true

Best regards,
Matthias

Am Do., 7. Nov. 2019 um 15:38 Uhr schrieb Tim Ward :

> Hi Matthias
>
> I was a bit confused about how you could add a Servelt to the
> JaxRsWhiteboard instead of the HttpWhiteboard for Multi-Part file uploads.
>
>
> I hope it’s now clear that the JAX-RS whiteboard does not support
> Servlets. You can either:
>
>- Register a servlet with the Http Whiteboard and find a place to put
>the file
>- Handle the multipart file upload using JAX-RS
>
>
> If the file upload is only needed by your JAX-RS components then I would
> recommend just using JAX-RS rather than a servlet.
>
> * So a JaxRsResource can but most not belong to an application?
>
>
> A JAX-RS Whiteboard resource is just a “bare” resource in the service
> registry. In the most common case the resource service that you register
> will bind to the “default” application provided by the JAX-RS Whiteboard.
> There is no need to deploy a custom whiteboard application for resources to
> be hosted by the JAX-RS whiteboard.
>
> * It's fine to put all your Resources into the same JaxRsWhiteboard even
> if you could separate them?
>
>
> Yes. This will work fine. All the resources (by default) will get hosted
> in the default application. If you do want to provide some isolation
> between the resources (e.g. if you need differently configured JSON
> providers for different resources) then you can still do this with a single
> JAX-RSWhiteboard, but you will need to provide separate Applications for
> the resources and extensions. This is because applications within the
> whiteboard *are* isolated from each other, and can have different sets of
> resources and extensions.
>
> In general, however, you’re pretty safe just registering all the resources
> and extensions that you need directly with the whiteboard using the default
> application.
>
> All the best,
>
> Tim
>
>
> On 7 Nov 2019, at 12:54, Matthias Leinweber 
> wrote:
>
> Hello Tim,
>
> thanks for your reply. I get the JaxRS Application thing wrong. I thought
> that an application and a JaxRsResource is/can be the same. But obviously,
> if you read the documentation correct, then not.
> Then it also makes sense to inject the Application with @Context
> Applicaiton app into a method.
> I had also a misunderstanding with http and jaxrs whiteboard. I was a
> bit confused about how you could add a Servelt to the JaxRsWhiteboard
> instead of the HttpWhiteboard for Multi-Part file uploads.
> I think the default app and the configuration of the default jaxrs
> whiteboard caused some confusion for me.
>
> * So a JaxRsResource can but most not belong to an application?
> * It's fine to put all your Resources into the same JaxRsWhiteboard even
> if you could separate them?
>
> right? then I think, I understood the thing and i like it :)
>
> Best regards
> Matthias
>
> Am Do., 7. Nov. 2019 um 13:24 Uhr schrieb Tim Ward :
>
>> in OSGI 6 I think we should be able to use
>> @Component(property = {"osgi.jaxrs.name=myApp",
>> "osgi.jaxrs.application.base=/foo"}, service = A.class)
>> class...
>> That does not work or did I misunderstood something?
>>
>>
>> If you want to register an application with the whiteboard then you must
>> register it as a javax.ws.rs.core.Application in the service registry.
>> This is outlined at https://osgi.org/specification/osgi.cmpou
>> cann/7.0.0/service.jaxrs.html#service.jaxrs.application.services
>> 
>>
>> Second how do i create additional Servlets and how do I select them in a
>> resource?
>> E.g. A configfile/servicepid
>> org.apache.aries.jax.rs.whiteboard-bar.cfg
>> application.base.prefix=/bar
>> should create an additional servlet container?
>>
>>
>> I’m not sure that I totally follow here. It looks like you’re trying to
>> create a configuration for another Aries JAX-RS whitboard instance - is
>> this really what you want, a second JAX-RS whiteboard? The Aries JAX-RS
>> Whiteboard is designed to build on top of a compliant Http Whiteboard, if
>> you are actually trying to create another Http Whiteboard (e.g. to get HTTP
>> served on another port) then you will need to set that up in PAX-Web.
>>
>> Then with
>> @JaxrsWhiteboardTarget
>> or
>> "osgi.jaxrs.whiteboard.target="
>>
>> I can select the servlet/Whiteboard, but how does the LDAP string look?
>> (service.pid=org.apache.aries.jax.rs.whiteboard-bar)?
>>
>>
>> This property only applies if you create more than one JAX-RS whiteboard,
>> and would be 

Re: Aries jax-rs whiteboard

2019-11-07 Thread Tim Ward
Hi Matthias

> I was a bit confused about how you could add a Servelt to the JaxRsWhiteboard 
> instead of the HttpWhiteboard for Multi-Part file uploads.

I hope it’s now clear that the JAX-RS whiteboard does not support Servlets. You 
can either:
Register a servlet with the Http Whiteboard and find a place to put the file
Handle the multipart file upload using JAX-RS

If the file upload is only needed by your JAX-RS components then I would 
recommend just using JAX-RS rather than a servlet.

> * So a JaxRsResource can but most not belong to an application?

A JAX-RS Whiteboard resource is just a “bare” resource in the service registry. 
In the most common case the resource service that you register will bind to the 
“default” application provided by the JAX-RS Whiteboard. There is no need to 
deploy a custom whiteboard application for resources to be hosted by the JAX-RS 
whiteboard.

> * It's fine to put all your Resources into the same JaxRsWhiteboard even if 
> you could separate them?

Yes. This will work fine. All the resources (by default) will get hosted in the 
default application. If you do want to provide some isolation between the 
resources (e.g. if you need differently configured JSON providers for different 
resources) then you can still do this with a single JAX-RSWhiteboard, but you 
will need to provide separate Applications for the resources and extensions. 
This is because applications within the whiteboard *are* isolated from each 
other, and can have different sets of resources and extensions.

In general, however, you’re pretty safe just registering all the resources and 
extensions that you need directly with the whiteboard using the default 
application.

All the best,

Tim


> On 7 Nov 2019, at 12:54, Matthias Leinweber  
> wrote:
> 
> Hello Tim,
> 
> thanks for your reply. I get the JaxRS Application thing wrong. I thought 
> that an application and a JaxRsResource is/can be the same. But obviously, if 
> you read the documentation correct, then not.
> Then it also makes sense to inject the Application with @Context Applicaiton 
> app into a method.
> I had also a misunderstanding with http and jaxrs whiteboard. I was a bit 
> confused about how you could add a Servelt to the JaxRsWhiteboard instead of 
> the HttpWhiteboard for Multi-Part file uploads.
> I think the default app and the configuration of the default jaxrs whiteboard 
> caused some confusion for me.
> 
> * So a JaxRsResource can but most not belong to an application?
> * It's fine to put all your Resources into the same JaxRsWhiteboard even if 
> you could separate them?
> 
> right? then I think, I understood the thing and i like it :)
> 
> Best regards
> Matthias
> 
> Am Do., 7. Nov. 2019 um 13:24 Uhr schrieb Tim Ward  >:
>> in OSGI 6 I think we should be able to use
>> @Component(property = {"osgi.jaxrs.name =myApp", 
>> "osgi.jaxrs.application.base=/foo"}, service = A.class)
>> class...
>> That does not work or did I misunderstood something?
> 
> If you want to register an application with the whiteboard then you must 
> register it as a javax.ws.rs .core.Application in the 
> service registry. This is outlined at 
> https://osgi.org/specification/osgi.cmpou 
> cann/7.0.0/service.jaxrs.html#service.jaxrs.application.services 
> 
> 
>> Second how do i create additional Servlets and how do I select them in a 
>> resource?
>> E.g. A configfile/servicepid
>> org.apache.aries.jax.rs.whiteboard-bar.cfg
>> application.base.prefix=/bar
>> should create an additional servlet container?
> 
> I’m not sure that I totally follow here. It looks like you’re trying to 
> create a configuration for another Aries JAX-RS whitboard instance - is this 
> really what you want, a second JAX-RS whiteboard? The Aries JAX-RS Whiteboard 
> is designed to build on top of a compliant Http Whiteboard, if you are 
> actually trying to create another Http Whiteboard (e.g. to get HTTP served on 
> another port) then you will need to set that up in PAX-Web.
> 
>> Then with
>> @JaxrsWhiteboardTarget
>> or
>> "osgi.jaxrs.whiteboard.target="
>> 
>> I can select the servlet/Whiteboard, but how does the LDAP string look? 
>> (service.pid=org.apache.aries.jax.rs.whiteboard-bar)?
> 
> This property only applies if you create more than one JAX-RS whiteboard, and 
> would be applied to your JAX-RS Whiteboard services (resources, applications, 
> extensions), and you would use the filter to select the JAX-RS Whiteboard 
> that you wanted them to use. If you do want to do this, which seems unlikely, 
> then you would typically add a marker property into the configuration for 
> your JAX-RS Whiteboard and then use that property name/value in the filter.
> 
> 
> Any questions that relate to setting up the Http Whiteboard will need to be 
> handled by someone with more PAX-Web 

Re: Aries jax-rs whiteboard

2019-11-07 Thread Matthias Leinweber
Hello Tim,

thanks for your reply. I get the JaxRS Application thing wrong. I thought
that an application and a JaxRsResource is/can be the same. But obviously,
if you read the documentation correct, then not.
Then it also makes sense to inject the Application with @Context
Applicaiton app into a method.
I had also a misunderstanding with http and jaxrs whiteboard. I was a
bit confused about how you could add a Servelt to the JaxRsWhiteboard
instead of the HttpWhiteboard for Multi-Part file uploads.
I think the default app and the configuration of the default jaxrs
whiteboard caused some confusion for me.

* So a JaxRsResource can but most not belong to an application?
* It's fine to put all your Resources into the same JaxRsWhiteboard even if
you could separate them?

right? then I think, I understood the thing and i like it :)

Best regards
Matthias

Am Do., 7. Nov. 2019 um 13:24 Uhr schrieb Tim Ward :

> in OSGI 6 I think we should be able to use
> @Component(property = {"osgi.jaxrs.name=myApp",
> "osgi.jaxrs.application.base=/foo"}, service = A.class)
> class...
> That does not work or did I misunderstood something?
>
>
> If you want to register an application with the whiteboard then you must
> register it as a javax.ws.rs.core.Application in the service registry.
> This is outlined at https://osgi.org/specification/osgi.cmpou
> cann/7.0.0/service.jaxrs.html#service.jaxrs.application.services
> 
>
> Second how do i create additional Servlets and how do I select them in a
> resource?
> E.g. A configfile/servicepid
> org.apache.aries.jax.rs.whiteboard-bar.cfg
> application.base.prefix=/bar
> should create an additional servlet container?
>
>
> I’m not sure that I totally follow here. It looks like you’re trying to
> create a configuration for another Aries JAX-RS whitboard instance - is
> this really what you want, a second JAX-RS whiteboard? The Aries JAX-RS
> Whiteboard is designed to build on top of a compliant Http Whiteboard, if
> you are actually trying to create another Http Whiteboard (e.g. to get HTTP
> served on another port) then you will need to set that up in PAX-Web.
>
> Then with
> @JaxrsWhiteboardTarget
> or
> "osgi.jaxrs.whiteboard.target="
>
> I can select the servlet/Whiteboard, but how does the LDAP string look?
> (service.pid=org.apache.aries.jax.rs.whiteboard-bar)?
>
>
> This property only applies if you create more than one JAX-RS whiteboard,
> and would be applied to your JAX-RS Whiteboard services (resources,
> applications, extensions), and you would use the filter to select the
> JAX-RS Whiteboard that you wanted them to use. If you do want to do this,
> which seems unlikely, then you would typically add a marker property into
> the configuration for your JAX-RS Whiteboard and then use that property
> name/value in the filter.
>
>
> Any questions that relate to setting up the Http Whiteboard will need to
> be handled by someone with more PAX-Web experience. I would also recommend
> that, in addition to describing the problems that you’ve encountered, you
> include a description of what you’re trying to achieve with your system.
>
> E.g.
>
>
>- Do you want multiple Http ports being served (this would be Http
>Whiteboard not JAX-RS Whiteboard)?
>- Do you want JAX-RS Whiteboard support on top of one or more of the
>available Http Whiteboards)?
>- Do you want to publish JAX-RS resource services, application
>services, or a mixture of the two?
>- Do you want the JAX-RS services that you publish to appear on all
>whiteboards, or just a subset?
>
>
> With this information it will be much easier to help you to achieve your
> goal.
>
> All the best,
>
> Tim
>
> On 6 Nov 2019, at 17:25, Matthias Leinweber 
> wrote:
>
> Hi JB,
> yes that was my first place to start... really like the examples in the
> source, they are really helpful.
>
> ok:
> Fist thing are JAXRs Applications. In OSGI7 we will use
> @JaxrsName("myApp")
> @JaxrsApplicationBase("foo")
> @Component
> class
>
> in OSGI 6 I think we should be able to use
> @Component(property = {"osgi.jaxrs.name=myApp",
> "osgi.jaxrs.application.base=/foo"}, service = A.class)
> class...
> That does not work or did I misunderstood something?
>
> Second how do i create additional Servlets and how do I select them in a
> resource?
> E.g. A configfile/servicepid
> org.apache.aries.jax.rs.whiteboard-bar.cfg
> application.base.prefix=/bar
> should create an additional servlet container?
>
> Then with
> @JaxrsWhiteboardTarget
> or
> "osgi.jaxrs.whiteboard.target="
>
> I can select the servlet/Whiteboard, but how does the LDAP string look?
> (service.pid=org.apache.aries.jax.rs.whiteboard-bar)?
>
> Best regards,
> Matthias
>
>
> Am Mi., 6. Nov. 2019 um 18:00 Uhr schrieb Jean-Baptiste Onofré <
> j...@nanthrax.net>:
>
>> Hi Matthias,
>>
>> did you take a look on the Karaf example ?
>>
>> 

Re: Aries jax-rs whiteboard

2019-11-07 Thread Tim Ward
> in OSGI 6 I think we should be able to use
> @Component(property = {"osgi.jaxrs.name =myApp", 
> "osgi.jaxrs.application.base=/foo"}, service = A.class)
> class...
> That does not work or did I misunderstood something?

If you want to register an application with the whiteboard then you must 
register it as a javax.ws.rs .core.Application in the 
service registry. This is outlined at 
https://osgi.org/specification/osgi.cmpn/7.0.0/service.jaxrs.html#service.jaxrs.application.services
 


> Second how do i create additional Servlets and how do I select them in a 
> resource?
> E.g. A configfile/servicepid
> org.apache.aries.jax.rs.whiteboard-bar.cfg
> application.base.prefix=/bar
> should create an additional servlet container?

I’m not sure that I totally follow here. It looks like you’re trying to create 
a configuration for another Aries JAX-RS whitboard instance - is this really 
what you want, a second JAX-RS whiteboard? The Aries JAX-RS Whiteboard is 
designed to build on top of a compliant Http Whiteboard, if you are actually 
trying to create another Http Whiteboard (e.g. to get HTTP served on another 
port) then you will need to set that up in PAX-Web.

> Then with
> @JaxrsWhiteboardTarget
> or
> "osgi.jaxrs.whiteboard.target="
> 
> I can select the servlet/Whiteboard, but how does the LDAP string look? 
> (service.pid=org.apache.aries.jax.rs.whiteboard-bar)?

This property only applies if you create more than one JAX-RS whiteboard, and 
would be applied to your JAX-RS Whiteboard services (resources, applications, 
extensions), and you would use the filter to select the JAX-RS Whiteboard that 
you wanted them to use. If you do want to do this, which seems unlikely, then 
you would typically add a marker property into the configuration for your 
JAX-RS Whiteboard and then use that property name/value in the filter.


Any questions that relate to setting up the Http Whiteboard will need to be 
handled by someone with more PAX-Web experience. I would also recommend that, 
in addition to describing the problems that you’ve encountered, you include a 
description of what you’re trying to achieve with your system.

E.g.

Do you want multiple Http ports being served (this would be Http Whiteboard not 
JAX-RS Whiteboard)?
Do you want JAX-RS Whiteboard support on top of one or more of the available 
Http Whiteboards)?
Do you want to publish JAX-RS resource services, application services, or a 
mixture of the two?
Do you want the JAX-RS services that you publish to appear on all whiteboards, 
or just a subset?

With this information it will be much easier to help you to achieve your goal.

All the best,

Tim

> On 6 Nov 2019, at 17:25, Matthias Leinweber  
> wrote:
> 
> Hi JB,
> yes that was my first place to start... really like the examples in the 
> source, they are really helpful.
> 
> ok:
> Fist thing are JAXRs Applications. In OSGI7 we will use
> @JaxrsName("myApp")
> @JaxrsApplicationBase("foo")
> @Component
> class
> 
> in OSGI 6 I think we should be able to use
> @Component(property = {"osgi.jaxrs.name =myApp", 
> "osgi.jaxrs.application.base=/foo"}, service = A.class)
> class...
> That does not work or did I misunderstood something?
> 
> Second how do i create additional Servlets and how do I select them in a 
> resource?
> E.g. A configfile/servicepid
> org.apache.aries.jax.rs.whiteboard-bar.cfg
> application.base.prefix=/bar
> should create an additional servlet container?
> 
> Then with
> @JaxrsWhiteboardTarget
> or
> "osgi.jaxrs.whiteboard.target="
> 
> I can select the servlet/Whiteboard, but how does the LDAP string look? 
> (service.pid=org.apache.aries.jax.rs.whiteboard-bar)?
> 
> Best regards,
> Matthias
> 
> 
> Am Mi., 6. Nov. 2019 um 18:00 Uhr schrieb Jean-Baptiste Onofré 
> mailto:j...@nanthrax.net>>:
> Hi Matthias,
> 
> did you take a look on the Karaf example ?
> 
> https://github.com/apache/karaf/tree/master/examples/karaf-rest-example 
> 
> 
> It contains different approaches, including whiteboard.
> 
> Can you describe a bit what you are looking for ? We can then create the
> Jira at Karaf/Aries to improve example/documentation.
> 
> Regards
> JB
> 
> On 06/11/2019 17:56, Matthias Leinweber wrote:
> > Hello Karaf Team,
> > 
> > I know that this not the 100% correct mailing list for aries jax-rs.
> > However my question is what do you plan for further releases of Karaf? I
> > try to use the aries implementation but I struggle with the configuration.
> > Beside the incomplete documentation and the "very special" DSL which is
> > used I dug into the code and understood the following things.
> > 
> > * You can not add additional JAXRSApplications. ("osgi.jaxrs.name 
> > 
> > 

Re: Aries jax-rs whiteboard

2019-11-06 Thread Matthias Leinweber
Hi JB,
yes that was my first place to start... really like the examples in the
source, they are really helpful.

ok:
Fist thing are JAXRs Applications. In OSGI7 we will use
@JaxrsName("myApp")
@JaxrsApplicationBase("foo")
@Component
class

in OSGI 6 I think we should be able to use
@Component(property = {"osgi.jaxrs.name=myApp",
"osgi.jaxrs.application.base=/foo"}, service = A.class)
class...
That does not work or did I misunderstood something?

Second how do i create additional Servlets and how do I select them in a
resource?
E.g. A configfile/servicepid
org.apache.aries.jax.rs.whiteboard-bar.cfg
application.base.prefix=/bar
should create an additional servlet container?

Then with
@JaxrsWhiteboardTarget
or
"osgi.jaxrs.whiteboard.target="

I can select the servlet/Whiteboard, but how does the LDAP string look?
(service.pid=org.apache.aries.jax.rs.whiteboard-bar)?

Best regards,
Matthias


Am Mi., 6. Nov. 2019 um 18:00 Uhr schrieb Jean-Baptiste Onofré <
j...@nanthrax.net>:

> Hi Matthias,
>
> did you take a look on the Karaf example ?
>
> https://github.com/apache/karaf/tree/master/examples/karaf-rest-example
>
> It contains different approaches, including whiteboard.
>
> Can you describe a bit what you are looking for ? We can then create the
> Jira at Karaf/Aries to improve example/documentation.
>
> Regards
> JB
>
> On 06/11/2019 17:56, Matthias Leinweber wrote:
> > Hello Karaf Team,
> >
> > I know that this not the 100% correct mailing list for aries jax-rs.
> > However my question is what do you plan for further releases of Karaf? I
> > try to use the aries implementation but I struggle with the
> configuration.
> > Beside the incomplete documentation and the "very special" DSL which is
> > used I dug into the code and understood the following things.
> >
> > * You can not add additional JAXRSApplications. ("osgi.jaxrs.name
> > =myApp", "osgi.jaxrs.application.base=/approot"}
> > although there is code which should do this?
> > * Additional configurations for other then the default servlet is not
> > possible although there is a service factory manager which should handle
> > additional configs?
> > * With org.apache.aries.jax.rs.whiteboard.default.cfg
> > # application.base.prefix you can add a global url prefix to your
> > JaxRSResoureces. Would be nice if that could be documented somewhere.
> >
> > Don't get me wrong I do not say that the bundle is bad, but at some
> > point it could be easier to understand.
> >
> > regards Matthias
> >
> >
>
> --
> Jean-Baptiste Onofré
> jbono...@apache.org
> http://blog.nanthrax.net
> Talend - http://www.talend.com
>


--


Re: Aries jax-rs whiteboard

2019-11-06 Thread Jean-Baptiste Onofré
Hi Matthias,

did you take a look on the Karaf example ?

https://github.com/apache/karaf/tree/master/examples/karaf-rest-example

It contains different approaches, including whiteboard.

Can you describe a bit what you are looking for ? We can then create the
Jira at Karaf/Aries to improve example/documentation.

Regards
JB

On 06/11/2019 17:56, Matthias Leinweber wrote:
> Hello Karaf Team,
> 
> I know that this not the 100% correct mailing list for aries jax-rs.
> However my question is what do you plan for further releases of Karaf? I
> try to use the aries implementation but I struggle with the configuration.
> Beside the incomplete documentation and the "very special" DSL which is
> used I dug into the code and understood the following things.
> 
> * You can not add additional JAXRSApplications. ("osgi.jaxrs.name
> =myApp", "osgi.jaxrs.application.base=/approot"}
> although there is code which should do this?
> * Additional configurations for other then the default servlet is not
> possible although there is a service factory manager which should handle
> additional configs?
> * With org.apache.aries.jax.rs.whiteboard.default.cfg
> # application.base.prefix you can add a global url prefix to your
> JaxRSResoureces. Would be nice if that could be documented somewhere.
> 
> Don't get me wrong I do not say that the bundle is bad, but at some
> point it could be easier to understand.
> 
> regards Matthias
> 
> 

-- 
Jean-Baptiste Onofré
jbono...@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com


Re: Aries JAX-RS Whiteboard

2018-12-05 Thread Jean-Baptiste Onofré

Hi,

This is the WIP about the Aries JAX-RS Whiteboard features:

https://github.com/apache/aries-jax-rs-whiteboard/pull/11

And here's the WIP for the JAX-RS Whiteboard Karaf example:

https://github.com/jbonofre/karaf/tree/KARAF-5901/examples/karaf-rest-example

I will finalize this tomorrow.

Regards
JB

On 05/12/2018 21:15, Markus Rathgeb wrote:

Hi JB,

can you please point me to the correct repositories?
I cannot find your commits.

Best regards,
Markus


Re: Aries JAX-RS Whiteboard

2018-12-05 Thread Markus Rathgeb
Hi JB,

can you please point me to the correct repositories?
I cannot find your commits.

Best regards,
Markus


Re: Aries JAX-RS Whiteboard

2018-12-03 Thread Jean-Baptiste Onofré
No problem ;)

Regards
JB

On 03/12/2018 14:59, Christian Schneider wrote:
> Pretty cool .. sorry I missed that.
> 
> Christian
> 
> Am Mo., 3. Dez. 2018 um 08:33 Uhr schrieb Jean-Baptiste Onofré
> mailto:j...@nanthrax.net>>:
> 
> Hi,
> 
> yes, it's what I said in my previous e-mail: Karaf example + features in
> Aries.
> 
> Regards
> JB
> 
> On 03/12/2018 08:27, Christian Schneider wrote:
> > Hi JB,
> >
> > can you add the jax-rs-whiteboard feature to the aries repo? I
> think it
> > makes sense to have it with the jax-rs code so it can be used with
> > different karaf versions.
> >
> > Christian
> >
> > Am Mo., 3. Dez. 2018 um 07:39 Uhr schrieb Jean-Baptiste Onofré
> > mailto:j...@nanthrax.net>  >>:
> >
> >     Hi Markus,
> >
> >     yes I will push the PRs (Karaf example with feature repo + Aries
> >     features repo that will replace the one in Karaf example)
> later today.
> >
> >     Regards
> >     JB
> >
> >     On 03/12/2018 06:03, Markus Rathgeb wrote:
> >     > Hi JB,
> >     >
> >     >     as I'm creating the Aries JAXRS feature for Karaf, I'm
> >     currently using
> >     >     the one from Aries.
> >     >
> >     >
> >     > could you share your feature?
> >     >
> >     > Best regards,
> >     > Markus
> >
> >     --
> >     Jean-Baptiste Onofré
> >     jbono...@apache.org 
> >
> >     http://blog.nanthrax.net
> >     Talend - http://www.talend.com
> >
> >
> >
> > --
> > --
> > Christian Schneider
> > http://www.liquid-reality.de
> >
> > Computer Scientist
> > http://www.adobe.com
> >
> 
> -- 
> Jean-Baptiste Onofré
> jbono...@apache.org 
> http://blog.nanthrax.net
> Talend - http://www.talend.com
> 
> 
> 
> -- 
> -- 
> Christian Schneider
> http://www.liquid-reality.de
> 
> Computer Scientist
> http://www.adobe.com
> 

-- 
Jean-Baptiste Onofré
jbono...@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com


Re: Aries JAX-RS Whiteboard

2018-12-03 Thread Christian Schneider
Pretty cool .. sorry I missed that.

Christian

Am Mo., 3. Dez. 2018 um 08:33 Uhr schrieb Jean-Baptiste Onofré <
j...@nanthrax.net>:

> Hi,
>
> yes, it's what I said in my previous e-mail: Karaf example + features in
> Aries.
>
> Regards
> JB
>
> On 03/12/2018 08:27, Christian Schneider wrote:
> > Hi JB,
> >
> > can you add the jax-rs-whiteboard feature to the aries repo? I think it
> > makes sense to have it with the jax-rs code so it can be used with
> > different karaf versions.
> >
> > Christian
> >
> > Am Mo., 3. Dez. 2018 um 07:39 Uhr schrieb Jean-Baptiste Onofré
> > mailto:j...@nanthrax.net>>:
> >
> > Hi Markus,
> >
> > yes I will push the PRs (Karaf example with feature repo + Aries
> > features repo that will replace the one in Karaf example) later
> today.
> >
> > Regards
> > JB
> >
> > On 03/12/2018 06:03, Markus Rathgeb wrote:
> > > Hi JB,
> > >
> > > as I'm creating the Aries JAXRS feature for Karaf, I'm
> > currently using
> > > the one from Aries.
> > >
> > >
> > > could you share your feature?
> > >
> > > Best regards,
> > > Markus
> >
> > --
> > Jean-Baptiste Onofré
> > jbono...@apache.org 
> > http://blog.nanthrax.net
> > Talend - http://www.talend.com
> >
> >
> >
> > --
> > --
> > Christian Schneider
> > http://www.liquid-reality.de
> >
> > Computer Scientist
> > http://www.adobe.com
> >
>
> --
> Jean-Baptiste Onofré
> jbono...@apache.org
> http://blog.nanthrax.net
> Talend - http://www.talend.com
>


-- 
-- 
Christian Schneider
http://www.liquid-reality.de

Computer Scientist
http://www.adobe.com


Re: Aries JAX-RS Whiteboard

2018-12-02 Thread Jean-Baptiste Onofré
Hi,

yes, it's what I said in my previous e-mail: Karaf example + features in
Aries.

Regards
JB

On 03/12/2018 08:27, Christian Schneider wrote:
> Hi JB,
> 
> can you add the jax-rs-whiteboard feature to the aries repo? I think it
> makes sense to have it with the jax-rs code so it can be used with
> different karaf versions.
> 
> Christian
> 
> Am Mo., 3. Dez. 2018 um 07:39 Uhr schrieb Jean-Baptiste Onofré
> mailto:j...@nanthrax.net>>:
> 
> Hi Markus,
> 
> yes I will push the PRs (Karaf example with feature repo + Aries
> features repo that will replace the one in Karaf example) later today.
> 
> Regards
> JB
> 
> On 03/12/2018 06:03, Markus Rathgeb wrote:
> > Hi JB,
> >
> >     as I'm creating the Aries JAXRS feature for Karaf, I'm
> currently using
> >     the one from Aries.
> >
> >
> > could you share your feature?
> >
> > Best regards,
> > Markus
> 
> -- 
> Jean-Baptiste Onofré
> jbono...@apache.org 
> http://blog.nanthrax.net
> Talend - http://www.talend.com
> 
> 
> 
> -- 
> -- 
> Christian Schneider
> http://www.liquid-reality.de
> 
> Computer Scientist
> http://www.adobe.com
> 

-- 
Jean-Baptiste Onofré
jbono...@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com


Re: Aries JAX-RS Whiteboard

2018-12-02 Thread Christian Schneider
Hi JB,

can you add the jax-rs-whiteboard feature to the aries repo? I think it
makes sense to have it with the jax-rs code so it can be used with
different karaf versions.

Christian

Am Mo., 3. Dez. 2018 um 07:39 Uhr schrieb Jean-Baptiste Onofré <
j...@nanthrax.net>:

> Hi Markus,
>
> yes I will push the PRs (Karaf example with feature repo + Aries
> features repo that will replace the one in Karaf example) later today.
>
> Regards
> JB
>
> On 03/12/2018 06:03, Markus Rathgeb wrote:
> > Hi JB,
> >
> > as I'm creating the Aries JAXRS feature for Karaf, I'm currently
> using
> > the one from Aries.
> >
> >
> > could you share your feature?
> >
> > Best regards,
> > Markus
>
> --
> Jean-Baptiste Onofré
> jbono...@apache.org
> http://blog.nanthrax.net
> Talend - http://www.talend.com
>


-- 
-- 
Christian Schneider
http://www.liquid-reality.de

Computer Scientist
http://www.adobe.com


Re: Aries JAX-RS Whiteboard

2018-12-02 Thread Jean-Baptiste Onofré
Hi Markus,

yes I will push the PRs (Karaf example with feature repo + Aries
features repo that will replace the one in Karaf example) later today.

Regards
JB

On 03/12/2018 06:03, Markus Rathgeb wrote:
> Hi JB,
> 
> as I'm creating the Aries JAXRS feature for Karaf, I'm currently using
> the one from Aries.
> 
> 
> could you share your feature?
> 
> Best regards,
> Markus

-- 
Jean-Baptiste Onofré
jbono...@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com


Re: Aries JAX-RS Whiteboard

2018-12-02 Thread Markus Rathgeb
Hi JB,

as I'm creating the Aries JAXRS feature for Karaf, I'm currently using
> the one from Aries.
>

could you share your feature?

Best regards,
Markus


Re: Aries JAX-RS Whiteboard

2018-11-24 Thread tom
> as I'm creating the Aries JAXRS feature for Karaf, I'm currently using
> the one from Aries.
That's the one I used.


Re: Aries JAX-RS Whiteboard

2018-11-24 Thread Jean-Baptiste Onofré
Thanks Ray,

as I'm creating the Aries JAXRS feature for Karaf, I'm currently using
the one from Aries.

Regards
JB

On 25/11/2018 06:06, Raymond Auge wrote:
> 
> 
> On Sat, Nov 24, 2018, 23:48 Jean-Baptiste Onofré   wrote:
> 
> Hi Tom,
> 
> I'm curious: what JAXRS API bundle do you use (that provide the JAXRS
> contract) ?
> 
> 
> There's two you could use. The one in Aries jaxrs whiteboard repo that
> was built to bootstrap the project and the one from Apache Geronimo.
> 
> - Ray
> 
> 
> Regards
> JB
> 
> On 24/11/2018 19:24, t...@quarendon.net  wrote:
> >
> >> The SSE from JAX-RS 2.1 definitely works (client and server side)
> with the Aries implementation, so hopefully that will give you
> everything that you need.
> >
> > I have it all working now. I've had to make one or two changes
> though, as a result of the change from jersey to cxf.
> >
> > Generally, the implementation was pretty easy, it certainly works
> to use Aries JAX-RS Whiteboard within Karaf 4.1.2. Once I worked out
> what the required dependency bundles were, it was OK. Anecdotally
> the requests seem faster than using jersey as well, though I haven't
> done any testing on that.
> >
> > I battled with an issue for a while because I had two bundles
> providing the jaxrs API. I had the original one, plus I also had the
> org.apache.aries.javax.jax.rs-api one (required as it adds a
> required OSGi contract specification). That caused me some issues
> with bundles sometimes working and sometimes reporting "exposed to
> package via two dependency chain" issues, and huge startup times and
> memory use while it figured it out. That took me a while to iron out.
> >
> > An issue I failed to resolve was that we had some use of jaxrs
> http client. I never did manage to get it to use the CXF client
> implementation. The Aries JAX-RS whiteboard bundles the required
> parts of CXF within it, but I don't think they are accessible to
> use. I tried including the relevant parts of CXF, but couldn't get
> it all to work. It seemed to be a bundle initialisation order issue,
> in that the geronimo osgi locator component was being used to find
> the JAX-RS http client classes before it had been initialised. Maybe
> if I'd just included the complete CXF bundle it would all have
> worked OK, but that seemed overkill when all I wanted was the
> client, and when the Aries JAX-RS whiteboard implementation includes
> its own copy of CXF as well. Since we only had one class using it I
> just substituted it for a non-jax-rs http client and the problem
> went away.
> >
> > I encountered an issue with Aries JAX-RS Whiteboard that I will
> raise on github. It doesn't like "void" resource method results. You
> get:
> >   java.lang.NullPointerException
> >         at
> >  org.apache.aries.jax.rs
> 
> .whiteboard.internal.cxf.PromiseAwareJAXRSInvoker.checkFutureResponse(PromiseAwareJAXRSInvoker.java:40)
> >
> > This has caused me a bit of rework to get round to be sure it was
> the problem.
> >
> > I also encountered a difference in behaviour between cxf and
> jersey. I had a resource component with a path of "/a", and another
> with a path of "/a/b". In CXF the second of these didn't seem to get
> matched. Instead I had to add a subresource locator method on the
> first to match "b" and return the second resource component. No big
> deal, and I don't actually know what the spec says is valid. I'm
> assuming that this is in CXF rather than the whiteboard.
> >
> > Apart from all of that, it worked fine.
> > Now to see whether it all actually solves the reliability issues
> we were having with our own homebrew whiteboard.
> >
> > Thanks for the assistance.
> >
> 
> -- 
> Jean-Baptiste Onofré
> jbono...@apache.org 
> http://blog.nanthrax.net
> Talend - http://www.talend.com
> 

-- 
Jean-Baptiste Onofré
jbono...@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com


Re: Aries JAX-RS Whiteboard

2018-11-24 Thread Raymond Auge
On Sat, Nov 24, 2018, 23:48 Jean-Baptiste Onofré  Hi Tom,
>
> I'm curious: what JAXRS API bundle do you use (that provide the JAXRS
> contract) ?
>

There's two you could use. The one in Aries jaxrs whiteboard repo that was
built to bootstrap the project and the one from Apache Geronimo.

- Ray

>
> Regards
> JB
>
> On 24/11/2018 19:24, t...@quarendon.net wrote:
> >
> >> The SSE from JAX-RS 2.1 definitely works (client and server side) with
> the Aries implementation, so hopefully that will give you everything that
> you need.
> >
> > I have it all working now. I've had to make one or two changes though,
> as a result of the change from jersey to cxf.
> >
> > Generally, the implementation was pretty easy, it certainly works to use
> Aries JAX-RS Whiteboard within Karaf 4.1.2. Once I worked out what the
> required dependency bundles were, it was OK. Anecdotally the requests seem
> faster than using jersey as well, though I haven't done any testing on that.
> >
> > I battled with an issue for a while because I had two bundles providing
> the jaxrs API. I had the original one, plus I also had the
> org.apache.aries.javax.jax.rs-api one (required as it adds a required OSGi
> contract specification). That caused me some issues with bundles sometimes
> working and sometimes reporting "exposed to package via two dependency
> chain" issues, and huge startup times and memory use while it figured it
> out. That took me a while to iron out.
> >
> > An issue I failed to resolve was that we had some use of jaxrs http
> client. I never did manage to get it to use the CXF client implementation.
> The Aries JAX-RS whiteboard bundles the required parts of CXF within it,
> but I don't think they are accessible to use. I tried including the
> relevant parts of CXF, but couldn't get it all to work. It seemed to be a
> bundle initialisation order issue, in that the geronimo osgi locator
> component was being used to find the JAX-RS http client classes before it
> had been initialised. Maybe if I'd just included the complete CXF bundle it
> would all have worked OK, but that seemed overkill when all I wanted was
> the client, and when the Aries JAX-RS whiteboard implementation includes
> its own copy of CXF as well. Since we only had one class using it I just
> substituted it for a non-jax-rs http client and the problem went away.
> >
> > I encountered an issue with Aries JAX-RS Whiteboard that I will raise on
> github. It doesn't like "void" resource method results. You get:
> >   java.lang.NullPointerException
> > at
> >  org.apache.aries.jax.rs
> .whiteboard.internal.cxf.PromiseAwareJAXRSInvoker.checkFutureResponse(PromiseAwareJAXRSInvoker.java:40)
> >
> > This has caused me a bit of rework to get round to be sure it was the
> problem.
> >
> > I also encountered a difference in behaviour between cxf and jersey. I
> had a resource component with a path of "/a", and another with a path of
> "/a/b". In CXF the second of these didn't seem to get matched. Instead I
> had to add a subresource locator method on the first to match "b" and
> return the second resource component. No big deal, and I don't actually
> know what the spec says is valid. I'm assuming that this is in CXF rather
> than the whiteboard.
> >
> > Apart from all of that, it worked fine.
> > Now to see whether it all actually solves the reliability issues we were
> having with our own homebrew whiteboard.
> >
> > Thanks for the assistance.
> >
>
> --
> Jean-Baptiste Onofré
> jbono...@apache.org
> http://blog.nanthrax.net
> Talend - http://www.talend.com
>


Re: Aries JAX-RS Whiteboard

2018-11-24 Thread Jean-Baptiste Onofré
Hi Tom,

I'm curious: what JAXRS API bundle do you use (that provide the JAXRS
contract) ?

Regards
JB

On 24/11/2018 19:24, t...@quarendon.net wrote:
> 
>> The SSE from JAX-RS 2.1 definitely works (client and server side) with the 
>> Aries implementation, so hopefully that will give you everything that you 
>> need. 
> 
> I have it all working now. I've had to make one or two changes though, as a 
> result of the change from jersey to cxf.
> 
> Generally, the implementation was pretty easy, it certainly works to use 
> Aries JAX-RS Whiteboard within Karaf 4.1.2. Once I worked out what the 
> required dependency bundles were, it was OK. Anecdotally the requests seem 
> faster than using jersey as well, though I haven't done any testing on that.
> 
> I battled with an issue for a while because I had two bundles providing the 
> jaxrs API. I had the original one, plus I also had the 
> org.apache.aries.javax.jax.rs-api one (required as it adds a required OSGi 
> contract specification). That caused me some issues with bundles sometimes 
> working and sometimes reporting "exposed to package via two dependency chain" 
> issues, and huge startup times and memory use while it figured it out. That 
> took me a while to iron out. 
> 
> An issue I failed to resolve was that we had some use of jaxrs http client. I 
> never did manage to get it to use the CXF client implementation. The Aries 
> JAX-RS whiteboard bundles the required parts of CXF within it, but I don't 
> think they are accessible to use. I tried including the relevant parts of 
> CXF, but couldn't get it all to work. It seemed to be a bundle initialisation 
> order issue, in that the geronimo osgi locator component was being used to 
> find the JAX-RS http client classes before it had been initialised. Maybe if 
> I'd just included the complete CXF bundle it would all have worked OK, but 
> that seemed overkill when all I wanted was the client, and when the Aries 
> JAX-RS whiteboard implementation includes its own copy of CXF as well. Since 
> we only had one class using it I just substituted it for a non-jax-rs http 
> client and the problem went away.
> 
> I encountered an issue with Aries JAX-RS Whiteboard that I will raise on 
> github. It doesn't like "void" resource method results. You get:
>   java.lang.NullPointerException
> at 
>  
> org.apache.aries.jax.rs.whiteboard.internal.cxf.PromiseAwareJAXRSInvoker.checkFutureResponse(PromiseAwareJAXRSInvoker.java:40)
> 
> This has caused me a bit of rework to get round to be sure it was the 
> problem. 
> 
> I also encountered a difference in behaviour between cxf and jersey. I had a 
> resource component with a path of "/a", and another with a path of "/a/b". In 
> CXF the second of these didn't seem to get matched. Instead I had to add a 
> subresource locator method on the first to match "b" and return the second 
> resource component. No big deal, and I don't actually know what the spec says 
> is valid. I'm assuming that this is in CXF rather than the whiteboard.
> 
> Apart from all of that, it worked fine. 
> Now to see whether it all actually solves the reliability issues we were 
> having with our own homebrew whiteboard.
> 
> Thanks for the assistance.
> 

-- 
Jean-Baptiste Onofré
jbono...@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com


Re: Aries JAX-RS Whiteboard

2018-11-24 Thread Tim Ward
Hi Tom,

It looks like you’re having a lot of success. The NPE that you have identified 
for void methods is a known bug in 1.0.1 (introduced by a fix for a different 
problem in 1.0.0) and is already fixed in 1.0.2-SNAPSHOT. 

The release of 1.0.2 is planned soon - the vote would probably be running now  
except we thought it would be worth waiting a week or two to find out what (if 
anything) needed fixing based on getting the work you and JB are doing getting 
the whiteboard running on Karaf. 

As for the other issue Aries does a small amount of work to influence the 
relative ordering of identical resource methods based on service ranking order 
(as per the JAX-RS Whiteboard spec). This shouldn’t affect the scenario that 
you propose, but it is possible that it might. Definitely worth raising a bug 
with the Aries JAX-RS Whiteboard including your testcase, even if it turns out 
to be an issue in CXF we can feed that back (we have a pretty good line to them 
after the bugs we’ve found and fixed already).

Tim

Sent from my iPhone

> On 24 Nov 2018, at 22:10, t...@quarendon.net wrote:
> 
> I have in fact just adapted the cxf "basic" jaxrs example with the below two 
> resource classes and it does what I expect, and the behaviour is different to 
> what I get if I do the same via the Aries JAXRS whiteboard.
> 
> Nothing in the OSGI JAXRS whiteboard spec leaves me to believe that it 
> introduces any different rules in this regard, so this appears to be a 
> behaviour that the Aries JAXRS whiteboard has introduced. Does this seem 
> likely?
> 
> Thanks.
> 
>> On 24 November 2018 at 21:53 t...@quarendon.net wrote:
>> 
>> 
>> The problem I was having with the jaxrs path binding can be summarised like 
>> this. I have one resource:
>> 
>> @Component(immediate = true, service = TestResource.class)
>> @Path("test")
>> @JaxrsResource
>> public class TestResource {
>> 
>>@Path("{a}")
>>public Object getA(@PathParam("a") String a) {
>>return new ResourceA(a);
>>}
>>
>>public static class ResourceA {
>>private String a;
>>public ResourceA(String a) {
>>this.a = a;
>>}
>>
>>@GET
>>@Path("{b}") 
>>public Response getB(@PathParam("b") String b) {
>>System.out.println("test/{a}/{b} where a="+a+" and b="+b);
>>return Response.ok().build();
>>}
>>
>>}
>> }
>> 
>> And another:
>> 
>> @Component(immediate = true, service = TestResource2.class)
>> @Path("test/a/b")
>> @JaxrsResource
>> public class TestResource2 {
>> 
>>@GET
>>public Response getB() {
>>System.out.println("test/a/b");
>>return Response.ok().build();
>>}
>> }
>> 
>> My understanding of the jaxrs url binding is that "most specific wins". I 
>> believe that the above is legal, and that given a request to "test/a/b", the 
>> TestResource2.getB should be matched, though I haven't stepped through the 
>> algorithm in the jaxrs spec yet to see what it produces in this 
>> circumstance. However, the presence of TestResource with it's @Path of 
>> "test" stops anything being matched to TestResource2.
>> At the moment I haven't managed to implement an example of this in "plain" 
>> cxf, only using Aries JAXRS whiteboard, but it's definitely something that 
>> "works" in jersey -- i.e, does what I expect. 
>> 
>> Not being able to quite get my mind around the Aries JAX-RS whiteboard code, 
>> do you think this is something that's likely to be influenced by it, or be 
>> purely at the CXF level? 
>> 
>> Thanks.


Re: Aries JAX-RS Whiteboard

2018-11-24 Thread tom
> Did you notice that the JAX-RS Whiteboard provides a ClientBuilder
> (prototype scoped) service?
> 
> e.g.
> @Reference
> ClientBuilder clientBuilder;
> 

Ah, no, I hadn't. I had read the words, but obviously not understood the 
significance.
Thanks for the pointer.


Re: Aries JAX-RS Whiteboard

2018-11-24 Thread Raymond Auge
On Sat, Nov 24, 2018 at 1:24 PM  wrote:

>
> > The SSE from JAX-RS 2.1 definitely works (client and server side) with
> the Aries implementation, so hopefully that will give you everything that
> you need.
>
> I have it all working now. I've had to make one or two changes though, as
> a result of the change from jersey to cxf.
>
> Generally, the implementation was pretty easy, it certainly works to use
> Aries JAX-RS Whiteboard within Karaf 4.1.2. Once I worked out what the
> required dependency bundles were, it was OK. Anecdotally the requests seem
> faster than using jersey as well, though I haven't done any testing on that.
>
> I battled with an issue for a while because I had two bundles providing
> the jaxrs API. I had the original one, plus I also had the
> org.apache.aries.javax.jax.rs-api one (required as it adds a required OSGi
> contract specification). That caused me some issues with bundles sometimes
> working and sometimes reporting "exposed to package via two dependency
> chain" issues, and huge startup times and memory use while it figured it
> out. That took me a while to iron out.
>
> An issue I failed to resolve was that we had some use of jaxrs http client.


Did you notice that the JAX-RS Whiteboard provides a ClientBuilder
(prototype scoped) service?

e.g.
@Reference
ClientBuilder clientBuilder;

[1]
https://osgi.org/specification/osgi.cmpn/7.0.0/service.jaxrs.html#d0e134114


> I never did manage to get it to use the CXF client implementation. The
> Aries JAX-RS whiteboard bundles the required parts of CXF within it, but I
> don't think they are accessible to use. I tried including the relevant
> parts of CXF, but couldn't get it all to work. It seemed to be a bundle
> initialisation order issue, in that the geronimo osgi locator component was
> being used to find the JAX-RS http client classes before it had been
> initialised. Maybe if I'd just included the complete CXF bundle it would
> all have worked OK, but that seemed overkill when all I wanted was the
> client, and when the Aries JAX-RS whiteboard implementation includes its
> own copy of CXF as well. Since we only had one class using it I just
> substituted it for a non-jax-rs http client and the problem went away.
>
> I encountered an issue with Aries JAX-RS Whiteboard that I will raise on
> github. It doesn't like "void" resource method results. You get:
>   java.lang.NullPointerException
> at
>  org.apache.aries.jax.rs
> .whiteboard.internal.cxf.PromiseAwareJAXRSInvoker.checkFutureResponse(PromiseAwareJAXRSInvoker.java:40)
>
> This has caused me a bit of rework to get round to be sure it was the
> problem.
>
> I also encountered a difference in behaviour between cxf and jersey. I had
> a resource component with a path of "/a", and another with a path of
> "/a/b". In CXF the second of these didn't seem to get matched. Instead I
> had to add a subresource locator method on the first to match "b" and
> return the second resource component. No big deal, and I don't actually
> know what the spec says is valid. I'm assuming that this is in CXF rather
> than the whiteboard.
>
> Apart from all of that, it worked fine.
> Now to see whether it all actually solves the reliability issues we were
> having with our own homebrew whiteboard.
>
> Thanks for the assistance.
>


-- 
*Raymond Augé* 
 (@rotty3000)
Senior Software Architect *Liferay, Inc.* 
 (@Liferay)
Board Member & EEG Co-Chair, OSGi Alliance  (@OSGiAlliance)


Re: Aries JAX-RS Whiteboard

2018-11-24 Thread tom


> The SSE from JAX-RS 2.1 definitely works (client and server side) with the 
> Aries implementation, so hopefully that will give you everything that you 
> need. 

I have it all working now. I've had to make one or two changes though, as a 
result of the change from jersey to cxf.

Generally, the implementation was pretty easy, it certainly works to use Aries 
JAX-RS Whiteboard within Karaf 4.1.2. Once I worked out what the required 
dependency bundles were, it was OK. Anecdotally the requests seem faster than 
using jersey as well, though I haven't done any testing on that.

I battled with an issue for a while because I had two bundles providing the 
jaxrs API. I had the original one, plus I also had the 
org.apache.aries.javax.jax.rs-api one (required as it adds a required OSGi 
contract specification). That caused me some issues with bundles sometimes 
working and sometimes reporting "exposed to package via two dependency chain" 
issues, and huge startup times and memory use while it figured it out. That 
took me a while to iron out. 

An issue I failed to resolve was that we had some use of jaxrs http client. I 
never did manage to get it to use the CXF client implementation. The Aries 
JAX-RS whiteboard bundles the required parts of CXF within it, but I don't 
think they are accessible to use. I tried including the relevant parts of CXF, 
but couldn't get it all to work. It seemed to be a bundle initialisation order 
issue, in that the geronimo osgi locator component was being used to find the 
JAX-RS http client classes before it had been initialised. Maybe if I'd just 
included the complete CXF bundle it would all have worked OK, but that seemed 
overkill when all I wanted was the client, and when the Aries JAX-RS whiteboard 
implementation includes its own copy of CXF as well. Since we only had one 
class using it I just substituted it for a non-jax-rs http client and the 
problem went away.

I encountered an issue with Aries JAX-RS Whiteboard that I will raise on 
github. It doesn't like "void" resource method results. You get:
  java.lang.NullPointerException
at 
 
org.apache.aries.jax.rs.whiteboard.internal.cxf.PromiseAwareJAXRSInvoker.checkFutureResponse(PromiseAwareJAXRSInvoker.java:40)

This has caused me a bit of rework to get round to be sure it was the problem. 

I also encountered a difference in behaviour between cxf and jersey. I had a 
resource component with a path of "/a", and another with a path of "/a/b". In 
CXF the second of these didn't seem to get matched. Instead I had to add a 
subresource locator method on the first to match "b" and return the second 
resource component. No big deal, and I don't actually know what the spec says 
is valid. I'm assuming that this is in CXF rather than the whiteboard.

Apart from all of that, it worked fine. 
Now to see whether it all actually solves the reliability issues we were having 
with our own homebrew whiteboard.

Thanks for the assistance.


Re: Aries JAX-RS Whiteboard

2018-11-23 Thread Tim Ward
Hi,

From a code perspective the enRoute Quickstart example only imports the package 
javax.ws.rs . It uses the OSGi contract for that package, 
which means that you would need to use an API which provides the contract. It 
also uses DS 1.4 annotations (and so picks up a DS 1.4 requirement), and it 
uses the ComponentPropertyType annotations from the HTTP whiteboard and JAX-RS 
Whiteboard. The resulting implementation requirement for the version 1.1 http 
whiteboard might be a problem in Karaf, which I imagine only provides 1.0

In summary, you could use the example, but you would probably need to modify 
the source to use DS 1.3 annotations, not use the Component Property 
annotations, and to use the property member of the Component annotation 
instead. This would avoid the DS 1.4 requirement, and the requirements for the 
HTTP and JAX-RS Whiteboards. While these requirements are correct and useful in 
general they do result in a requirement for features not present in Karaf 4.2, 
and my understanding is that it is not easy to update these parts of Karaf… 

Tim

> On 23 Nov 2018, at 03:57, Jean-Baptiste Onofré  wrote:
> 
> Hi Tim,
> 
> does the enRoute examples work in Karaf ? (as we are on the Karaf
> mailing list ;))
> 
> Regards
> JB
> 
> On 22/11/2018 20:53, Tim Ward wrote:
>> There are some fairly simple examples available in the enRoute project. In 
>> general things should work as you expect, as long as you use the JAX-RS API, 
>> not the Jersey API :)
>> 
>> The SSE from JAX-RS 2.1 definitely works (client and server side) with the 
>> Aries implementation, so hopefully that will give you everything that you 
>> need. 
>> 
>> Tim
>> 
>>> On 22 Nov 2018, at 18:07, t...@quarendon.net wrote:
>>> 
 Honestly, it sounds like you’re about 30 minutes away from having the 
 Aries JAX-RS Whiteboard working...
>>> 
>>> OK, Understand your reference to servicemix annotation earlier. 
>>> I had to pick up the org.apache.felix.http.servlet-api-1.1.2.jar to get the 
>>> JavaServlet contract version 3.1.
>>> 
>>> I've now got karaf starting cleanly, and it's obviously doing *something*. 
>>> I suspect if I created a simple example it would be working, but obviously 
>>> I was naive and greedy and went straight for converting my entire app. I 
>>> mean, what could go wrong?
>>> 
>>> I say it's doing something, in that I can request an api and I get an error 
>>> such as:
>>>   java.lang.ClassNotFoundException: 
>>> org.glassfish.jersey.internal.RuntimeDelegateImpl not found by 
>>> javax.ws.rs-api
>>> 
>>> but the important thing is that what's in the stack trace is my resource 
>>> class. So it's registered the endpoint and routed it correctly, it's just 
>>> I've got some references to jersey. I'll have to clean all that out and 
>>> it'll probably be more successful.
>>> 
>>> Thanks.
>> 
> 
> -- 
> Jean-Baptiste Onofré
> jbono...@apache.org
> http://blog.nanthrax.net
> Talend - http://www.talend.com



Re: Aries JAX-RS Whiteboard

2018-11-22 Thread Jean-Baptiste Onofré
Hi Tim,

does the enRoute examples work in Karaf ? (as we are on the Karaf
mailing list ;))

Regards
JB

On 22/11/2018 20:53, Tim Ward wrote:
> There are some fairly simple examples available in the enRoute project. In 
> general things should work as you expect, as long as you use the JAX-RS API, 
> not the Jersey API :)
> 
> The SSE from JAX-RS 2.1 definitely works (client and server side) with the 
> Aries implementation, so hopefully that will give you everything that you 
> need. 
> 
> Tim
> 
>> On 22 Nov 2018, at 18:07, t...@quarendon.net wrote:
>>
>>> Honestly, it sounds like you’re about 30 minutes away from having the Aries 
>>> JAX-RS Whiteboard working...
>>
>> OK, Understand your reference to servicemix annotation earlier. 
>> I had to pick up the org.apache.felix.http.servlet-api-1.1.2.jar to get the 
>> JavaServlet contract version 3.1.
>>
>> I've now got karaf starting cleanly, and it's obviously doing *something*. I 
>> suspect if I created a simple example it would be working, but obviously I 
>> was naive and greedy and went straight for converting my entire app. I mean, 
>> what could go wrong?
>>
>> I say it's doing something, in that I can request an api and I get an error 
>> such as:
>>java.lang.ClassNotFoundException: 
>> org.glassfish.jersey.internal.RuntimeDelegateImpl not found by 
>> javax.ws.rs-api
>>
>> but the important thing is that what's in the stack trace is my resource 
>> class. So it's registered the endpoint and routed it correctly, it's just 
>> I've got some references to jersey. I'll have to clean all that out and 
>> it'll probably be more successful.
>>
>> Thanks.
> 

-- 
Jean-Baptiste Onofré
jbono...@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com


Re: Aries JAX-RS Whiteboard

2018-11-22 Thread Tim Ward
There are some fairly simple examples available in the enRoute project. In 
general things should work as you expect, as long as you use the JAX-RS API, 
not the Jersey API :)

The SSE from JAX-RS 2.1 definitely works (client and server side) with the 
Aries implementation, so hopefully that will give you everything that you need. 

Tim

> On 22 Nov 2018, at 18:07, t...@quarendon.net wrote:
> 
>> Honestly, it sounds like you’re about 30 minutes away from having the Aries 
>> JAX-RS Whiteboard working...
> 
> OK, Understand your reference to servicemix annotation earlier. 
> I had to pick up the org.apache.felix.http.servlet-api-1.1.2.jar to get the 
> JavaServlet contract version 3.1.
> 
> I've now got karaf starting cleanly, and it's obviously doing *something*. I 
> suspect if I created a simple example it would be working, but obviously I 
> was naive and greedy and went straight for converting my entire app. I mean, 
> what could go wrong?
> 
> I say it's doing something, in that I can request an api and I get an error 
> such as:
>java.lang.ClassNotFoundException: 
> org.glassfish.jersey.internal.RuntimeDelegateImpl not found by javax.ws.rs-api
> 
> but the important thing is that what's in the stack trace is my resource 
> class. So it's registered the endpoint and routed it correctly, it's just 
> I've got some references to jersey. I'll have to clean all that out and it'll 
> probably be more successful.
> 
> Thanks.



Re: Aries JAX-RS Whiteboard

2018-11-22 Thread Jean-Baptiste Onofré
Hi,

In the example I'm doing:

1. I'm using the standard http feature (pax web)
2. I'm using javax.ws.rs/java.ws-rs-api bundle
3. I created a feature for Aries JAXRS Whiteboard (that I will
contribute to Karaf) providing the contract

I'm testing the whiteboard right now.

Regards
JB

On 22/11/2018 19:07, t...@quarendon.net wrote:
>> Honestly, it sounds like you’re about 30 minutes away from having the Aries 
>> JAX-RS Whiteboard working...
> 
> OK, Understand your reference to servicemix annotation earlier. 
> I had to pick up the org.apache.felix.http.servlet-api-1.1.2.jar to get the 
> JavaServlet contract version 3.1.
> 
> I've now got karaf starting cleanly, and it's obviously doing *something*. I 
> suspect if I created a simple example it would be working, but obviously I 
> was naive and greedy and went straight for converting my entire app. I mean, 
> what could go wrong?
> 
> I say it's doing something, in that I can request an api and I get an error 
> such as:
> java.lang.ClassNotFoundException: 
> org.glassfish.jersey.internal.RuntimeDelegateImpl not found by javax.ws.rs-api
> 
> but the important thing is that what's in the stack trace is my resource 
> class. So it's registered the endpoint and routed it correctly, it's just 
> I've got some references to jersey. I'll have to clean all that out and it'll 
> probably be more successful.
> 
> Thanks.
> 

-- 
Jean-Baptiste Onofré
jbono...@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com


Re: Aries JAX-RS Whiteboard

2018-11-22 Thread tom
> Honestly, it sounds like you’re about 30 minutes away from having the Aries 
> JAX-RS Whiteboard working...

OK, Understand your reference to servicemix annotation earlier. 
I had to pick up the org.apache.felix.http.servlet-api-1.1.2.jar to get the 
JavaServlet contract version 3.1.

I've now got karaf starting cleanly, and it's obviously doing *something*. I 
suspect if I created a simple example it would be working, but obviously I was 
naive and greedy and went straight for converting my entire app. I mean, what 
could go wrong?

I say it's doing something, in that I can request an api and I get an error 
such as:
java.lang.ClassNotFoundException: 
org.glassfish.jersey.internal.RuntimeDelegateImpl not found by javax.ws.rs-api

but the important thing is that what's in the stack trace is my resource class. 
So it's registered the endpoint and routed it correctly, it's just I've got 
some references to jersey. I'll have to clean all that out and it'll probably 
be more successful.

Thanks.


Re: Aries JAX-RS Whiteboard

2018-11-22 Thread Tim Ward
Pretty much. The OSGi util specifications are self-implementing, so the OSGi 
version of the JAR contains the spec API and the reference implementation.

This dependency list has everything needed to get the JAX-RS Whiteboard running 
on Java 11 (meaning that there are a few things that you don’t need on Java 8). 
https://github.com/osgi/osgi.enroute/blob/7d534c287aa6e3ee9391f815d03ca4f81e480356/indexes/impl-index/pom.xml#L195-L233
 


The main OSGi pieces are the JAX-RS Whiteboard API, OSGi Promises and OSGi 
Functions. Other than that you have the JAX-RS spec API (including the relevant 
API contract), and the whiteboard implementation bundle.

Tim

> On 22 Nov 2018, at 17:30, Jean-Baptiste Onofré  wrote:
> 
> I guess it's the same thing some org.osgi.util.promise right ?
> 
> Regards
> JB
> 
> On 22/11/2018 18:19, Tim Ward wrote:
>> That’s part of the JAX-RS Whiteboard spec API. You can find the JAX-RS
>> Whiteboard spec API as a standalone jar in Maven
>> Central 
>> https://mvnrepository.com/artifact/org.osgi/org.osgi.service.jaxrs/1.0.0 
>> 
>> The compendium uber jar isn’t actually helpful for deployment anyway as
>> it’s intended to be a compile-time only artefact (there’s a deliberate
>> unresolvable requirement designed to stop it being deployed).
>> 
>> Tim
>> 
>>> On 22 Nov 2018, at 16:48, Jean-Baptiste Onofré >> > wrote:
>>> 
>>> Hi Tim,
>>> 
>>> the missing package is org.osgi.service.jaxrs.client (required by Aries
>>> JAXRS Whiteboard bundle) which seems to be only in Compendium R7 (not R6).
>>> 
>>> Regards
>>> JB
>>> 
>>> 
>>> On 22/11/2018 17:10, Tim Ward wrote:
> that won't work out of the box as Karaf 4.2.x is still R6.
 
 Aries JAX-RS Whiteboard runs quite happily on R6. Obviously the DS
 component property annotations would create a DS 1.4 requirement, but
 the DS reference implementation also runs on R6. Even if you aren’t
 able to use DS 1.4, it’s still pretty easy to set the properties
 using the DS 1.3 annotation syntax. I’m therefore really not sure why
 this would be a problem.
 
> In the mean time, I'm creating a very simply rest whiteboard pattern for
> CXF.
> It doesn't use all the JAXRS whiteboard spec, but just works fine for
> most of the use cases.
 
 Why would you duplicate this effort when there’s a spec which is so
 easy to use? By all means create an alternative implementation, but
 yet another whiteboard…
 
 Tim
 
> On 22 Nov 2018, at 16:03, Jean-Baptiste Onofré  > wrote:
> 
> Hi Tom,
> 
> that won't work out of the box as Karaf 4.2.x is still R6.
> 
> It will work with Karaf 4.3.x that will be R7.
> 
> In the mean time, I'm creating a very simply rest whiteboard pattern for
> CXF.
> It doesn't use all the JAXRS whiteboard spec, but just works fine for
> most of the use cases.
> 
> Regards
> JB
> 
> On 22/11/2018 17:00, t...@quarendon.net  wrote:
>>> You should then be able to get away with relatively few bundles.
>>> The JAX-RS Whiteboard API, OSGi Promises + function, the Aries
>>> wrapping of the JAX-RS API and the Aries JAX-RS Whiteboard
>>> implementation should be enough. This is by far preferable to
>>> using CXF directly, where you don’t have proper resource
>>> isolation, nor do you have a nice way to apply extensions (e.g.
>>> JSON support, CORS headers, etc).
>> 
>> So I've added those bundles (promise, function and the aries jaxrs
>> spec bundle for the JavaJAXRS capability), the problem I now have
>> is that it's missing the JavaAnnotation capability, version 1.3.0.
>> I suspect I have something providing an earlier version of that,
>> but at the moment my OSGi fu hasn't yielded the answer yet.
>> 
>> Good to know though that I'm potentially on the right track.
>> 
> 
> -- 
> Jean-Baptiste Onofré
> jbono...@apache.org 
> http://blog.nanthrax.net
> Talend - http://www.talend.com
 
>>> 
>>> -- 
>>> Jean-Baptiste Onofré
>>> jbono...@apache.org 
>>> http://blog.nanthrax.net
>>> Talend - http://www.talend.com
>> 
> 
> -- 
> Jean-Baptiste Onofré
> jbono...@apache.org
> http://blog.nanthrax.net
> Talend - http://www.talend.com



Re: Aries JAX-RS Whiteboard

2018-11-22 Thread Jean-Baptiste Onofré
OK, it works directly with the bundle (util.function, util.promise,
service.jaxrs). I'm wrapping this in a feature with the requirement (the
JAXRS contract) and I'm testing.

I keep you posted.

Thanks

Regards
JB

On 22/11/2018 18:30, Jean-Baptiste Onofré wrote:
> I guess it's the same thing some org.osgi.util.promise right ?
> 
> Regards
> JB
> 
> On 22/11/2018 18:19, Tim Ward wrote:
>> That’s part of the JAX-RS Whiteboard spec API. You can find the JAX-RS
>> Whiteboard spec API as a standalone jar in Maven
>> Central 
>> https://mvnrepository.com/artifact/org.osgi/org.osgi.service.jaxrs/1.0.0 
>>
>> The compendium uber jar isn’t actually helpful for deployment anyway as
>> it’s intended to be a compile-time only artefact (there’s a deliberate
>> unresolvable requirement designed to stop it being deployed).
>>
>> Tim
>>
>>> On 22 Nov 2018, at 16:48, Jean-Baptiste Onofré >> > wrote:
>>>
>>> Hi Tim,
>>>
>>> the missing package is org.osgi.service.jaxrs.client (required by Aries
>>> JAXRS Whiteboard bundle) which seems to be only in Compendium R7 (not R6).
>>>
>>> Regards
>>> JB
>>>
>>>
>>> On 22/11/2018 17:10, Tim Ward wrote:
> that won't work out of the box as Karaf 4.2.x is still R6.

 Aries JAX-RS Whiteboard runs quite happily on R6. Obviously the DS
 component property annotations would create a DS 1.4 requirement, but
 the DS reference implementation also runs on R6. Even if you aren’t
 able to use DS 1.4, it’s still pretty easy to set the properties
 using the DS 1.3 annotation syntax. I’m therefore really not sure why
 this would be a problem.

> In the mean time, I'm creating a very simply rest whiteboard pattern for
> CXF.
> It doesn't use all the JAXRS whiteboard spec, but just works fine for
> most of the use cases.

 Why would you duplicate this effort when there’s a spec which is so
 easy to use? By all means create an alternative implementation, but
 yet another whiteboard…

 Tim

> On 22 Nov 2018, at 16:03, Jean-Baptiste Onofré  > wrote:
>
> Hi Tom,
>
> that won't work out of the box as Karaf 4.2.x is still R6.
>
> It will work with Karaf 4.3.x that will be R7.
>
> In the mean time, I'm creating a very simply rest whiteboard pattern for
> CXF.
> It doesn't use all the JAXRS whiteboard spec, but just works fine for
> most of the use cases.
>
> Regards
> JB
>
> On 22/11/2018 17:00, t...@quarendon.net  wrote:
>>> You should then be able to get away with relatively few bundles.
>>> The JAX-RS Whiteboard API, OSGi Promises + function, the Aries
>>> wrapping of the JAX-RS API and the Aries JAX-RS Whiteboard
>>> implementation should be enough. This is by far preferable to
>>> using CXF directly, where you don’t have proper resource
>>> isolation, nor do you have a nice way to apply extensions (e.g.
>>> JSON support, CORS headers, etc).
>>
>> So I've added those bundles (promise, function and the aries jaxrs
>> spec bundle for the JavaJAXRS capability), the problem I now have
>> is that it's missing the JavaAnnotation capability, version 1.3.0.
>> I suspect I have something providing an earlier version of that,
>> but at the moment my OSGi fu hasn't yielded the answer yet.
>>
>> Good to know though that I'm potentially on the right track.
>>
>
> -- 
> Jean-Baptiste Onofré
> jbono...@apache.org 
> http://blog.nanthrax.net
> Talend - http://www.talend.com

>>>
>>> -- 
>>> Jean-Baptiste Onofré
>>> jbono...@apache.org 
>>> http://blog.nanthrax.net
>>> Talend - http://www.talend.com
>>
> 

-- 
Jean-Baptiste Onofré
jbono...@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com


Re: Aries JAX-RS Whiteboard

2018-11-22 Thread Jean-Baptiste Onofré
I guess it's the same thing some org.osgi.util.promise right ?

Regards
JB

On 22/11/2018 18:19, Tim Ward wrote:
> That’s part of the JAX-RS Whiteboard spec API. You can find the JAX-RS
> Whiteboard spec API as a standalone jar in Maven
> Central 
> https://mvnrepository.com/artifact/org.osgi/org.osgi.service.jaxrs/1.0.0 
> 
> The compendium uber jar isn’t actually helpful for deployment anyway as
> it’s intended to be a compile-time only artefact (there’s a deliberate
> unresolvable requirement designed to stop it being deployed).
> 
> Tim
> 
>> On 22 Nov 2018, at 16:48, Jean-Baptiste Onofré > > wrote:
>>
>> Hi Tim,
>>
>> the missing package is org.osgi.service.jaxrs.client (required by Aries
>> JAXRS Whiteboard bundle) which seems to be only in Compendium R7 (not R6).
>>
>> Regards
>> JB
>>
>>
>> On 22/11/2018 17:10, Tim Ward wrote:
 that won't work out of the box as Karaf 4.2.x is still R6.
>>>
>>> Aries JAX-RS Whiteboard runs quite happily on R6. Obviously the DS
>>> component property annotations would create a DS 1.4 requirement, but
>>> the DS reference implementation also runs on R6. Even if you aren’t
>>> able to use DS 1.4, it’s still pretty easy to set the properties
>>> using the DS 1.3 annotation syntax. I’m therefore really not sure why
>>> this would be a problem.
>>>
 In the mean time, I'm creating a very simply rest whiteboard pattern for
 CXF.
 It doesn't use all the JAXRS whiteboard spec, but just works fine for
 most of the use cases.
>>>
>>> Why would you duplicate this effort when there’s a spec which is so
>>> easy to use? By all means create an alternative implementation, but
>>> yet another whiteboard…
>>>
>>> Tim
>>>
 On 22 Nov 2018, at 16:03, Jean-Baptiste Onofré >>> > wrote:

 Hi Tom,

 that won't work out of the box as Karaf 4.2.x is still R6.

 It will work with Karaf 4.3.x that will be R7.

 In the mean time, I'm creating a very simply rest whiteboard pattern for
 CXF.
 It doesn't use all the JAXRS whiteboard spec, but just works fine for
 most of the use cases.

 Regards
 JB

 On 22/11/2018 17:00, t...@quarendon.net  wrote:
>> You should then be able to get away with relatively few bundles.
>> The JAX-RS Whiteboard API, OSGi Promises + function, the Aries
>> wrapping of the JAX-RS API and the Aries JAX-RS Whiteboard
>> implementation should be enough. This is by far preferable to
>> using CXF directly, where you don’t have proper resource
>> isolation, nor do you have a nice way to apply extensions (e.g.
>> JSON support, CORS headers, etc).
>
> So I've added those bundles (promise, function and the aries jaxrs
> spec bundle for the JavaJAXRS capability), the problem I now have
> is that it's missing the JavaAnnotation capability, version 1.3.0.
> I suspect I have something providing an earlier version of that,
> but at the moment my OSGi fu hasn't yielded the answer yet.
>
> Good to know though that I'm potentially on the right track.
>

 -- 
 Jean-Baptiste Onofré
 jbono...@apache.org 
 http://blog.nanthrax.net
 Talend - http://www.talend.com
>>>
>>
>> -- 
>> Jean-Baptiste Onofré
>> jbono...@apache.org 
>> http://blog.nanthrax.net
>> Talend - http://www.talend.com
> 

-- 
Jean-Baptiste Onofré
jbono...@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com


Re: Aries JAX-RS Whiteboard

2018-11-22 Thread Jean-Baptiste Onofré
OK thanks, I'm trying with jaxrs bundle directly.

I keep you posted.

Regards
JB

On 22/11/2018 18:19, Tim Ward wrote:
> That’s part of the JAX-RS Whiteboard spec API. You can find the JAX-RS
> Whiteboard spec API as a standalone jar in Maven
> Central 
> https://mvnrepository.com/artifact/org.osgi/org.osgi.service.jaxrs/1.0.0 
> 
> The compendium uber jar isn’t actually helpful for deployment anyway as
> it’s intended to be a compile-time only artefact (there’s a deliberate
> unresolvable requirement designed to stop it being deployed).
> 
> Tim
> 
>> On 22 Nov 2018, at 16:48, Jean-Baptiste Onofré > > wrote:
>>
>> Hi Tim,
>>
>> the missing package is org.osgi.service.jaxrs.client (required by Aries
>> JAXRS Whiteboard bundle) which seems to be only in Compendium R7 (not R6).
>>
>> Regards
>> JB
>>
>>
>> On 22/11/2018 17:10, Tim Ward wrote:
 that won't work out of the box as Karaf 4.2.x is still R6.
>>>
>>> Aries JAX-RS Whiteboard runs quite happily on R6. Obviously the DS
>>> component property annotations would create a DS 1.4 requirement, but
>>> the DS reference implementation also runs on R6. Even if you aren’t
>>> able to use DS 1.4, it’s still pretty easy to set the properties
>>> using the DS 1.3 annotation syntax. I’m therefore really not sure why
>>> this would be a problem.
>>>
 In the mean time, I'm creating a very simply rest whiteboard pattern for
 CXF.
 It doesn't use all the JAXRS whiteboard spec, but just works fine for
 most of the use cases.
>>>
>>> Why would you duplicate this effort when there’s a spec which is so
>>> easy to use? By all means create an alternative implementation, but
>>> yet another whiteboard…
>>>
>>> Tim
>>>
 On 22 Nov 2018, at 16:03, Jean-Baptiste Onofré >>> > wrote:

 Hi Tom,

 that won't work out of the box as Karaf 4.2.x is still R6.

 It will work with Karaf 4.3.x that will be R7.

 In the mean time, I'm creating a very simply rest whiteboard pattern for
 CXF.
 It doesn't use all the JAXRS whiteboard spec, but just works fine for
 most of the use cases.

 Regards
 JB

 On 22/11/2018 17:00, t...@quarendon.net  wrote:
>> You should then be able to get away with relatively few bundles.
>> The JAX-RS Whiteboard API, OSGi Promises + function, the Aries
>> wrapping of the JAX-RS API and the Aries JAX-RS Whiteboard
>> implementation should be enough. This is by far preferable to
>> using CXF directly, where you don’t have proper resource
>> isolation, nor do you have a nice way to apply extensions (e.g.
>> JSON support, CORS headers, etc).
>
> So I've added those bundles (promise, function and the aries jaxrs
> spec bundle for the JavaJAXRS capability), the problem I now have
> is that it's missing the JavaAnnotation capability, version 1.3.0.
> I suspect I have something providing an earlier version of that,
> but at the moment my OSGi fu hasn't yielded the answer yet.
>
> Good to know though that I'm potentially on the right track.
>

 -- 
 Jean-Baptiste Onofré
 jbono...@apache.org 
 http://blog.nanthrax.net
 Talend - http://www.talend.com
>>>
>>
>> -- 
>> Jean-Baptiste Onofré
>> jbono...@apache.org 
>> http://blog.nanthrax.net
>> Talend - http://www.talend.com
> 

-- 
Jean-Baptiste Onofré
jbono...@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com


Re: Aries JAX-RS Whiteboard

2018-11-22 Thread Tim Ward
That’s part of the JAX-RS Whiteboard spec API. You can find the JAX-RS 
Whiteboard spec API as a standalone jar in Maven Central 
https://mvnrepository.com/artifact/org.osgi/org.osgi.service.jaxrs/1.0.0 
 

The compendium uber jar isn’t actually helpful for deployment anyway as it’s 
intended to be a compile-time only artefact (there’s a deliberate unresolvable 
requirement designed to stop it being deployed).

Tim

> On 22 Nov 2018, at 16:48, Jean-Baptiste Onofré  wrote:
> 
> Hi Tim,
> 
> the missing package is org.osgi.service.jaxrs.client (required by Aries
> JAXRS Whiteboard bundle) which seems to be only in Compendium R7 (not R6).
> 
> Regards
> JB
> 
> 
> On 22/11/2018 17:10, Tim Ward wrote:
>>> that won't work out of the box as Karaf 4.2.x is still R6.
>> 
>> Aries JAX-RS Whiteboard runs quite happily on R6. Obviously the DS component 
>> property annotations would create a DS 1.4 requirement, but the DS reference 
>> implementation also runs on R6. Even if you aren’t able to use DS 1.4, it’s 
>> still pretty easy to set the properties using the DS 1.3 annotation syntax. 
>> I’m therefore really not sure why this would be a problem.
>> 
>>> In the mean time, I'm creating a very simply rest whiteboard pattern for
>>> CXF.
>>> It doesn't use all the JAXRS whiteboard spec, but just works fine for
>>> most of the use cases.
>> 
>> Why would you duplicate this effort when there’s a spec which is so easy to 
>> use? By all means create an alternative implementation, but yet another 
>> whiteboard…
>> 
>> Tim
>> 
>>> On 22 Nov 2018, at 16:03, Jean-Baptiste Onofré  wrote:
>>> 
>>> Hi Tom,
>>> 
>>> that won't work out of the box as Karaf 4.2.x is still R6.
>>> 
>>> It will work with Karaf 4.3.x that will be R7.
>>> 
>>> In the mean time, I'm creating a very simply rest whiteboard pattern for
>>> CXF.
>>> It doesn't use all the JAXRS whiteboard spec, but just works fine for
>>> most of the use cases.
>>> 
>>> Regards
>>> JB
>>> 
>>> On 22/11/2018 17:00, t...@quarendon.net wrote:
> You should then be able to get away with relatively few bundles. The 
> JAX-RS Whiteboard API, OSGi Promises + function, the Aries wrapping of 
> the JAX-RS API and the Aries JAX-RS Whiteboard implementation should be 
> enough. This is by far preferable to using CXF directly, where you don’t 
> have proper resource isolation, nor do you have a nice way to apply 
> extensions (e.g. JSON support, CORS headers, etc).
 
 So I've added those bundles (promise, function and the aries jaxrs spec 
 bundle for the JavaJAXRS capability), the problem I now have is that it's 
 missing the JavaAnnotation capability, version 1.3.0. 
 I suspect I have something providing an earlier version of that, but at 
 the moment my OSGi fu hasn't yielded the answer yet.
 
 Good to know though that I'm potentially on the right track.
 
>>> 
>>> -- 
>>> Jean-Baptiste Onofré
>>> jbono...@apache.org
>>> http://blog.nanthrax.net
>>> Talend - http://www.talend.com
>> 
> 
> -- 
> Jean-Baptiste Onofré
> jbono...@apache.org
> http://blog.nanthrax.net
> Talend - http://www.talend.com



Re: Aries JAX-RS Whiteboard

2018-11-22 Thread Jean-Baptiste Onofré
Hi Tim,

the missing package is org.osgi.service.jaxrs.client (required by Aries
JAXRS Whiteboard bundle) which seems to be only in Compendium R7 (not R6).

Regards
JB


On 22/11/2018 17:10, Tim Ward wrote:
>> that won't work out of the box as Karaf 4.2.x is still R6.
> 
> Aries JAX-RS Whiteboard runs quite happily on R6. Obviously the DS component 
> property annotations would create a DS 1.4 requirement, but the DS reference 
> implementation also runs on R6. Even if you aren’t able to use DS 1.4, it’s 
> still pretty easy to set the properties using the DS 1.3 annotation syntax. 
> I’m therefore really not sure why this would be a problem.
> 
>> In the mean time, I'm creating a very simply rest whiteboard pattern for
>> CXF.
>> It doesn't use all the JAXRS whiteboard spec, but just works fine for
>> most of the use cases.
> 
> Why would you duplicate this effort when there’s a spec which is so easy to 
> use? By all means create an alternative implementation, but yet another 
> whiteboard…
> 
> Tim
> 
>> On 22 Nov 2018, at 16:03, Jean-Baptiste Onofré  wrote:
>>
>> Hi Tom,
>>
>> that won't work out of the box as Karaf 4.2.x is still R6.
>>
>> It will work with Karaf 4.3.x that will be R7.
>>
>> In the mean time, I'm creating a very simply rest whiteboard pattern for
>> CXF.
>> It doesn't use all the JAXRS whiteboard spec, but just works fine for
>> most of the use cases.
>>
>> Regards
>> JB
>>
>> On 22/11/2018 17:00, t...@quarendon.net wrote:
 You should then be able to get away with relatively few bundles. The 
 JAX-RS Whiteboard API, OSGi Promises + function, the Aries wrapping of the 
 JAX-RS API and the Aries JAX-RS Whiteboard implementation should be 
 enough. This is by far preferable to using CXF directly, where you don’t 
 have proper resource isolation, nor do you have a nice way to apply 
 extensions (e.g. JSON support, CORS headers, etc).
>>>
>>> So I've added those bundles (promise, function and the aries jaxrs spec 
>>> bundle for the JavaJAXRS capability), the problem I now have is that it's 
>>> missing the JavaAnnotation capability, version 1.3.0. 
>>> I suspect I have something providing an earlier version of that, but at the 
>>> moment my OSGi fu hasn't yielded the answer yet.
>>>
>>> Good to know though that I'm potentially on the right track.
>>>
>>
>> -- 
>> Jean-Baptiste Onofré
>> jbono...@apache.org
>> http://blog.nanthrax.net
>> Talend - http://www.talend.com
> 

-- 
Jean-Baptiste Onofré
jbono...@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com


Re: Aries JAX-RS Whiteboard

2018-11-22 Thread Tim Ward
> I'll hold off for now then. 

Honestly, it sounds like you’re about 30 minutes away from having the Aries 
JAX-RS Whiteboard working...

> On 22 Nov 2018, at 16:14, t...@quarendon.net wrote:
> 
>> that won't work out of the box as Karaf 4.2.x is still R6.
>> 
>> It will work with Karaf 4.3.x that will be R7.
>> 
>> In the mean time, I'm creating a very simply rest whiteboard pattern for
>> CXF.
>> It doesn't use all the JAXRS whiteboard spec, but just works fine for
>> most of the use cases.
> 
> OK, thanks. That's appreciated.
> We're only doing simple things, registering resources and extensions (message 
> body writer, request/response filters etc), but we only have one application. 
> It's what I would have thought was pretty normal stuff to be honest.
> We do use SSE (server sent events) implementation from jersey at the moment, 
> and also multipart, but it looks like CXF supports those, so I'm sure that'll 
> be possible ;-)
> 
> I'll hold off for now then. 
> What's the timescale for Karaf 4.3? 
> 
> Thanks.



Re: Aries JAX-RS Whiteboard

2018-11-22 Thread Jean-Baptiste Onofré
This is the Jira tracking the Aries JAXRS Whiteboard example:

https://issues.apache.org/jira/browse/KARAF-5901

I moving to 4.2.2 and I will provide an update there.

Regards
JB

On 22/11/2018 17:19, Jean-Baptiste Onofré wrote:
> Exactly, I have the same feeling: most of the time, we just want to
> register a pretty simple JAXRS service as we do with blueprint:
> 
> https://github.com/apache/karaf/tree/master/examples/karaf-rest-example/karaf-rest-example-provider
> 
> However, today, using CXF (which works fine), we need to use blueprint
> just register the JAXRS server:
> 
> https://github.com/apache/karaf/blob/master/examples/karaf-rest-example/karaf-rest-example-provider/src/main/resources/OSGI-INF/blueprint/rest.xml
> 
> So the idea is to leverage the service properties to define the CXF
> JAXRS server (address, providers, ...) and then we won't need the
> blueprint dependency.
> 
> For Aries JAXRS, AFAIR, the problem was in the provided features XML.
> 
> Regards
> JB
> 
> On 22/11/2018 17:14, t...@quarendon.net wrote:
>>> that won't work out of the box as Karaf 4.2.x is still R6.
>>>
>>> It will work with Karaf 4.3.x that will be R7.
>>>
>>> In the mean time, I'm creating a very simply rest whiteboard pattern for
>>> CXF.
>>> It doesn't use all the JAXRS whiteboard spec, but just works fine for
>>> most of the use cases.
>>
>> OK, thanks. That's appreciated.
>> We're only doing simple things, registering resources and extensions 
>> (message body writer, request/response filters etc), but we only have one 
>> application. It's what I would have thought was pretty normal stuff to be 
>> honest.
>> We do use SSE (server sent events) implementation from jersey at the moment, 
>> and also multipart, but it looks like CXF supports those, so I'm sure 
>> that'll be possible ;-)
>>
>> I'll hold off for now then. 
>> What's the timescale for Karaf 4.3? 
>>
>> Thanks.
>>
> 

-- 
Jean-Baptiste Onofré
jbono...@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com


Re: Aries JAX-RS Whiteboard

2018-11-22 Thread Jean-Baptiste Onofré
Exactly, I have the same feeling: most of the time, we just want to
register a pretty simple JAXRS service as we do with blueprint:

https://github.com/apache/karaf/tree/master/examples/karaf-rest-example/karaf-rest-example-provider

However, today, using CXF (which works fine), we need to use blueprint
just register the JAXRS server:

https://github.com/apache/karaf/blob/master/examples/karaf-rest-example/karaf-rest-example-provider/src/main/resources/OSGI-INF/blueprint/rest.xml

So the idea is to leverage the service properties to define the CXF
JAXRS server (address, providers, ...) and then we won't need the
blueprint dependency.

For Aries JAXRS, AFAIR, the problem was in the provided features XML.

Regards
JB

On 22/11/2018 17:14, t...@quarendon.net wrote:
>> that won't work out of the box as Karaf 4.2.x is still R6.
>>
>> It will work with Karaf 4.3.x that will be R7.
>>
>> In the mean time, I'm creating a very simply rest whiteboard pattern for
>> CXF.
>> It doesn't use all the JAXRS whiteboard spec, but just works fine for
>> most of the use cases.
> 
> OK, thanks. That's appreciated.
> We're only doing simple things, registering resources and extensions (message 
> body writer, request/response filters etc), but we only have one application. 
> It's what I would have thought was pretty normal stuff to be honest.
> We do use SSE (server sent events) implementation from jersey at the moment, 
> and also multipart, but it looks like CXF supports those, so I'm sure that'll 
> be possible ;-)
> 
> I'll hold off for now then. 
> What's the timescale for Karaf 4.3? 
> 
> Thanks.
> 

-- 
Jean-Baptiste Onofré
jbono...@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com


Re: Aries JAX-RS Whiteboard

2018-11-22 Thread Jean-Baptiste Onofré
When I tested, Aries JAXRS required R7 packages. I will do a new try to
reproduce the issue I have.

My whiteboard is pretty simple and more generic and doesn't have the
pretension to be a full spec implementation: the idea is to bring SCR
support in CXF (which is very blueprint focus for now).

Regards
JB

On 22/11/2018 17:10, Tim Ward wrote:
>> that won't work out of the box as Karaf 4.2.x is still R6.
> 
> Aries JAX-RS Whiteboard runs quite happily on R6. Obviously the DS component 
> property annotations would create a DS 1.4 requirement, but the DS reference 
> implementation also runs on R6. Even if you aren’t able to use DS 1.4, it’s 
> still pretty easy to set the properties using the DS 1.3 annotation syntax. 
> I’m therefore really not sure why this would be a problem.
> 
>> In the mean time, I'm creating a very simply rest whiteboard pattern for
>> CXF.
>> It doesn't use all the JAXRS whiteboard spec, but just works fine for
>> most of the use cases.
> 
> Why would you duplicate this effort when there’s a spec which is so easy to 
> use? By all means create an alternative implementation, but yet another 
> whiteboard…
> 
> Tim
> 
>> On 22 Nov 2018, at 16:03, Jean-Baptiste Onofré  wrote:
>>
>> Hi Tom,
>>
>> that won't work out of the box as Karaf 4.2.x is still R6.
>>
>> It will work with Karaf 4.3.x that will be R7.
>>
>> In the mean time, I'm creating a very simply rest whiteboard pattern for
>> CXF.
>> It doesn't use all the JAXRS whiteboard spec, but just works fine for
>> most of the use cases.
>>
>> Regards
>> JB
>>
>> On 22/11/2018 17:00, t...@quarendon.net wrote:
 You should then be able to get away with relatively few bundles. The 
 JAX-RS Whiteboard API, OSGi Promises + function, the Aries wrapping of the 
 JAX-RS API and the Aries JAX-RS Whiteboard implementation should be 
 enough. This is by far preferable to using CXF directly, where you don’t 
 have proper resource isolation, nor do you have a nice way to apply 
 extensions (e.g. JSON support, CORS headers, etc).
>>>
>>> So I've added those bundles (promise, function and the aries jaxrs spec 
>>> bundle for the JavaJAXRS capability), the problem I now have is that it's 
>>> missing the JavaAnnotation capability, version 1.3.0. 
>>> I suspect I have something providing an earlier version of that, but at the 
>>> moment my OSGi fu hasn't yielded the answer yet.
>>>
>>> Good to know though that I'm potentially on the right track.
>>>
>>
>> -- 
>> Jean-Baptiste Onofré
>> jbono...@apache.org
>> http://blog.nanthrax.net
>> Talend - http://www.talend.com
> 

-- 
Jean-Baptiste Onofré
jbono...@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com


Re: Aries JAX-RS Whiteboard

2018-11-22 Thread tom
> that won't work out of the box as Karaf 4.2.x is still R6.
> 
> It will work with Karaf 4.3.x that will be R7.
> 
> In the mean time, I'm creating a very simply rest whiteboard pattern for
> CXF.
> It doesn't use all the JAXRS whiteboard spec, but just works fine for
> most of the use cases.

OK, thanks. That's appreciated.
We're only doing simple things, registering resources and extensions (message 
body writer, request/response filters etc), but we only have one application. 
It's what I would have thought was pretty normal stuff to be honest.
We do use SSE (server sent events) implementation from jersey at the moment, 
and also multipart, but it looks like CXF supports those, so I'm sure that'll 
be possible ;-)

I'll hold off for now then. 
What's the timescale for Karaf 4.3? 

Thanks.


Re: Aries JAX-RS Whiteboard

2018-11-22 Thread Jean-Baptiste Onofré
By the way, you can take a look on:

https://issues.apache.org/jira/browse/KARAF-5789

for the Felix HTTP feature (light instead of Pax Web, not recommended).

For the Karaf JAXRS Simple Whiteboard, I will share my repo soon.

Regards
JB

On 22/11/2018 17:00, t...@quarendon.net wrote:
>> You should then be able to get away with relatively few bundles. The JAX-RS 
>> Whiteboard API, OSGi Promises + function, the Aries wrapping of the JAX-RS 
>> API and the Aries JAX-RS Whiteboard implementation should be enough. This is 
>> by far preferable to using CXF directly, where you don’t have proper 
>> resource isolation, nor do you have a nice way to apply extensions (e.g. 
>> JSON support, CORS headers, etc).
> 
> So I've added those bundles (promise, function and the aries jaxrs spec 
> bundle for the JavaJAXRS capability), the problem I now have is that it's 
> missing the JavaAnnotation capability, version 1.3.0. 
> I suspect I have something providing an earlier version of that, but at the 
> moment my OSGi fu hasn't yielded the answer yet.
> 
> Good to know though that I'm potentially on the right track.
> 

-- 
Jean-Baptiste Onofré
jbono...@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com


Re: Aries JAX-RS Whiteboard

2018-11-22 Thread Tim Ward
> that won't work out of the box as Karaf 4.2.x is still R6.

Aries JAX-RS Whiteboard runs quite happily on R6. Obviously the DS component 
property annotations would create a DS 1.4 requirement, but the DS reference 
implementation also runs on R6. Even if you aren’t able to use DS 1.4, it’s 
still pretty easy to set the properties using the DS 1.3 annotation syntax. I’m 
therefore really not sure why this would be a problem.

> In the mean time, I'm creating a very simply rest whiteboard pattern for
> CXF.
> It doesn't use all the JAXRS whiteboard spec, but just works fine for
> most of the use cases.

Why would you duplicate this effort when there’s a spec which is so easy to 
use? By all means create an alternative implementation, but yet another 
whiteboard…

Tim

> On 22 Nov 2018, at 16:03, Jean-Baptiste Onofré  wrote:
> 
> Hi Tom,
> 
> that won't work out of the box as Karaf 4.2.x is still R6.
> 
> It will work with Karaf 4.3.x that will be R7.
> 
> In the mean time, I'm creating a very simply rest whiteboard pattern for
> CXF.
> It doesn't use all the JAXRS whiteboard spec, but just works fine for
> most of the use cases.
> 
> Regards
> JB
> 
> On 22/11/2018 17:00, t...@quarendon.net wrote:
>>> You should then be able to get away with relatively few bundles. The JAX-RS 
>>> Whiteboard API, OSGi Promises + function, the Aries wrapping of the JAX-RS 
>>> API and the Aries JAX-RS Whiteboard implementation should be enough. This 
>>> is by far preferable to using CXF directly, where you don’t have proper 
>>> resource isolation, nor do you have a nice way to apply extensions (e.g. 
>>> JSON support, CORS headers, etc).
>> 
>> So I've added those bundles (promise, function and the aries jaxrs spec 
>> bundle for the JavaJAXRS capability), the problem I now have is that it's 
>> missing the JavaAnnotation capability, version 1.3.0. 
>> I suspect I have something providing an earlier version of that, but at the 
>> moment my OSGi fu hasn't yielded the answer yet.
>> 
>> Good to know though that I'm potentially on the right track.
>> 
> 
> -- 
> Jean-Baptiste Onofré
> jbono...@apache.org
> http://blog.nanthrax.net
> Talend - http://www.talend.com



Re: Aries JAX-RS Whiteboard

2018-11-22 Thread Tim Ward
Hi,

This is the set of bundles needed to get enRoute apps up and running: 
https://github.com/osgi/osgi.enroute/blob/7d534c287aa6e3ee9391f815d03ca4f81e480356/examples/quickstart/app/app.bndrun#L11-L25
 


There’s a servicemix version of annotation 1.3.0 which should work for you.

Tim

> On 22 Nov 2018, at 16:00, t...@quarendon.net wrote:
> 
>> You should then be able to get away with relatively few bundles. The JAX-RS 
>> Whiteboard API, OSGi Promises + function, the Aries wrapping of the JAX-RS 
>> API and the Aries JAX-RS Whiteboard implementation should be enough. This is 
>> by far preferable to using CXF directly, where you don’t have proper 
>> resource isolation, nor do you have a nice way to apply extensions (e.g. 
>> JSON support, CORS headers, etc).
> 
> So I've added those bundles (promise, function and the aries jaxrs spec 
> bundle for the JavaJAXRS capability), the problem I now have is that it's 
> missing the JavaAnnotation capability, version 1.3.0. 
> I suspect I have something providing an earlier version of that, but at the 
> moment my OSGi fu hasn't yielded the answer yet.
> 
> Good to know though that I'm potentially on the right track.



Re: Aries JAX-RS Whiteboard

2018-11-22 Thread Jean-Baptiste Onofré
Hi Tom,

that won't work out of the box as Karaf 4.2.x is still R6.

It will work with Karaf 4.3.x that will be R7.

In the mean time, I'm creating a very simply rest whiteboard pattern for
CXF.
It doesn't use all the JAXRS whiteboard spec, but just works fine for
most of the use cases.

Regards
JB

On 22/11/2018 17:00, t...@quarendon.net wrote:
>> You should then be able to get away with relatively few bundles. The JAX-RS 
>> Whiteboard API, OSGi Promises + function, the Aries wrapping of the JAX-RS 
>> API and the Aries JAX-RS Whiteboard implementation should be enough. This is 
>> by far preferable to using CXF directly, where you don’t have proper 
>> resource isolation, nor do you have a nice way to apply extensions (e.g. 
>> JSON support, CORS headers, etc).
> 
> So I've added those bundles (promise, function and the aries jaxrs spec 
> bundle for the JavaJAXRS capability), the problem I now have is that it's 
> missing the JavaAnnotation capability, version 1.3.0. 
> I suspect I have something providing an earlier version of that, but at the 
> moment my OSGi fu hasn't yielded the answer yet.
> 
> Good to know though that I'm potentially on the right track.
> 

-- 
Jean-Baptiste Onofré
jbono...@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com


Re: Aries JAX-RS Whiteboard

2018-11-22 Thread tom
> You should then be able to get away with relatively few bundles. The JAX-RS 
> Whiteboard API, OSGi Promises + function, the Aries wrapping of the JAX-RS 
> API and the Aries JAX-RS Whiteboard implementation should be enough. This is 
> by far preferable to using CXF directly, where you don’t have proper resource 
> isolation, nor do you have a nice way to apply extensions (e.g. JSON support, 
> CORS headers, etc).

So I've added those bundles (promise, function and the aries jaxrs spec bundle 
for the JavaJAXRS capability), the problem I now have is that it's missing the 
JavaAnnotation capability, version 1.3.0. 
I suspect I have something providing an earlier version of that, but at the 
moment my OSGi fu hasn't yielded the answer yet.

Good to know though that I'm potentially on the right track.


Re: Aries JAX-RS Whiteboard

2018-11-22 Thread Tim Ward
> Is aries-jax-rs-whiteboard compatible with karaf does any one know? Or does 
> it depend on things that aren't provided, or rely on other things from later 
> OSGi specs that it doesn't support? I'm finding I'm having to add in a bunch 
> of bundles, and I'm wondering whether ultimately it's a dead end?

The Aries JAX-RS Whiteboard implementation builds on top of the OSGi Http 
Whiteboard spec. Assuming that Karaf’s HTTP whiteboard is compliant with the 
HTTP whiteboard spec (1.0 would be sufficient) then it should be fine. If 
Karaf’s HTTP whiteboard isn’t compliant then you could look at putting Felix 
Http Jetty into Karaf, but that might be pulling at the beginning of a very 
long thread…

You should then be able to get away with relatively few bundles. The JAX-RS 
Whiteboard API, OSGi Promises + function, the Aries wrapping of the JAX-RS API 
and the Aries JAX-RS Whiteboard implementation should be enough. This is by far 
preferable to using CXF directly, where you don’t have proper resource 
isolation, nor do you have a nice way to apply extensions (e.g. JSON support, 
CORS headers, etc).

Best Regards,

Tim


> On 22 Nov 2018, at 15:43, t...@quarendon.net wrote:
> 
> For largely historical reasons we have ended up with a setup where we use the 
> standard karaf HTTP whiteboard service, and then run jersey on top of that 
> with our own homebrew whiteboard service to register JAXRS endpoints.
> 
> I'm looking to replace this with a better solution, presumably based around 
> the OSGi JAXRS whiteboard spec. and aries-jax-rs-whiteboard 
> (https://github.com/apache/aries-jax-rs-whiteboard) since that now exists, 
> which it didn't when we started out.
> 
> Is aries-jax-rs-whiteboard compatible with karaf does any one know? Or does 
> it depend on things that aren't provided, or rely on other things from later 
> OSGi specs that it doesn't support? I'm finding I'm having to add in a bunch 
> of bundles, and I'm wondering whether ultimately it's a dead end?
> 
> Am I better off doing it another way? Karaf comes with CXF doesn't it? My 
> preference is to use the official OSGi whiteboard, but if that's going to be 
> too hard right now I'm not against doing it a CXF specific way. The only 
> example I can find so far though looks something like this:
> 
> @Component(service=TaskServiceRest.class, 
> property={"service.exported.interfaces=*",
>
> "service.exported.configs=org.apache.cxf.rs",
>
> "org.apache.cxf.rs.address=/tasklistRest"})
> 
> Which seems, well, more complex that necessary in comparison to 
> @Component(service=TaskServiceRest.class)
> @JaxrsResource
> 
> 
> What's the "best" route right now? It has to be declarative services based, 
> and whiteboard pattern.
> 
> Thanks.