[CONTROLLER-280] JAX-RS applications should use whiteboard pattern instead of WAB Created: 07/Apr/14  Updated: 25/Jul/23  Resolved: 22/Apr/14

Status: Resolved
Project: controller
Component/s: config
Affects Version/s: None
Fix Version/s: None

Type: Improvement
Reporter: Tomas Olvecky Assignee: Tomas Olvecky
Resolution: Won't Do Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: All
Platform: All


Issue Links:
Blocks
blocks CONTROLLER-289 Milestone: Container cleanup Resolved

 Comments   
Comment by Giovanni Meo [ 07/Apr/14 ]

Tomas,

The WAB specification uses the whiteboard pattern internally. In fact all the WAB modules register a service of type javax.servlet. So what is exactly this enhancement for?

Thanks,
Giovanni

Comment by Tomas Olvecky [ 07/Apr/14 ]

WAB imposes additional requirements on underlying infrastructure, namely a fully compliant servlet container. For things like restconf we want to experiment with switching to netty for performance reasons. This should be significantly easier if we don't implement whole servlet specification.
WAB also exposes too much information that should be configurable, e.g. CORS filter settings that might be dependent on distribution.
Third reason is that WAB does not work well with dynamic nature of services: programmer of each WAB needs to:
1.specify context under which web app will be available (and we have a use case with multiple md-sals in system)
2.provide a custom error handling if request comes before dependent services are initialized (might not be an issue, but with 'SR whiteboard' pattern this can be avoided by registering only after dependencies are resolved.)
Of course I am open to discussion and I am not about to switch all JAX-RS apps now, just restconf.
Tomas

Comment by Tomas Olvecky [ 07/Apr/14 ]

I failed to explain that I want to register javax.ws.rs.core.Application service in restconf's Activator

Comment by Giovanni Meo [ 07/Apr/14 ]

(In reply to Tomas Olvecky from comment #3)
> I failed to explain that I want to register javax.ws.rs.core.Application
> service in restconf's Activator

Thanks, i was commenting exactly asking this one. That sounds reasonable, but be aware that if you do this way and define JAXB annotation on inherited classes the JAXB context calculated by JAXRS may not consider all the subclasses, for that one we made a specific enhancement in the controller implemented by the bundlescanner and bundlescanner.implementation. Just FYI. Not sure what is your use case but be aware of it.

(In reply to Tomas Olvecky from comment #2)
> WAB imposes additional requirements on underlying infrastructure, namely a
> fully compliant servlet container. For things like restconf we want to
> experiment with switching to netty for performance reasons. This should be
> significantly easier if we don't implement whole servlet specification.
> WAB also exposes too much information that should be configurable, e.g. CORS
> filter settings that might be dependent on distribution.
> Third reason is that WAB does not work well with dynamic nature of services:
> programmer of each WAB needs to:

This is not true, you can register and unregister WAB dynamically you can try it with existing northbounds modules.

> 1.specify context under which web app will be available (and we have a use
> case with multiple md-sals in system)

This can be relocated depending on the servlet container used.

> 2.provide a custom error handling if request comes before dependent services
> are initialized (might not be an issue, but with 'SR whiteboard' pattern
> this can be avoided by registering only after dependencies are resolved.)
> Of course I am open to discussion and I am not about to switch all JAX-RS
> apps now, just restconf.

As long as it's restconf i'm fine.

Thanks,
Giovanni

> Tomas

Comment by Tomas Olvecky [ 22/Apr/14 ]

Thanks for response,

(In reply to Giovanni Meo from comment #4)
> (In reply to Tomas Olvecky from comment #3)
> > I failed to explain that I want to register javax.ws.rs.core.Application
> > service in restconf's Activator
>
> Thanks, i was commenting exactly asking this one. That sounds reasonable,
> but be aware that if you do this way and define JAXB annotation on inherited
> classes the JAXB context calculated by JAXRS may not consider all the
> subclasses, for that one we made a specific enhancement in the controller
> implemented by the bundlescanner and bundlescanner.implementation. Just FYI.
> Not sure what is your use case but be aware of it.
>
> (In reply to Tomas Olvecky from comment #2)
> > WAB imposes additional requirements on underlying infrastructure, namely a
> > fully compliant servlet container. For things like restconf we want to
> > experiment with switching to netty for performance reasons. This should be
> > significantly easier if we don't implement whole servlet specification.
> > WAB also exposes too much information that should be configurable, e.g. CORS
> > filter settings that might be dependent on distribution.
> > Third reason is that WAB does not work well with dynamic nature of services:
> > programmer of each WAB needs to:
>
> This is not true, you can register and unregister WAB dynamically you can
> try it with existing northbounds modules.

Not really, it is bound with bundle lifecycle, which services are not.

>
> > 1.specify context under which web app will be available (and we have a use
> > case with multiple md-sals in system)
>
> This can be relocated depending on the servlet container used.
>
> > 2.provide a custom error handling if request comes before dependent services
> > are initialized (might not be an issue, but with 'SR whiteboard' pattern
> > this can be avoided by registering only after dependencies are resolved.)
> > Of course I am open to discussion and I am not about to switch all JAX-RS
> > apps now, just restconf.
>
> As long as it's restconf i'm fine.
>
> Thanks,
> Giovanni
>
> > Tomas

I have decided to wontwix it now, it is mainly a research that would allow optimizing away servlet container and using netty for JAX-RS directly. This turns out to be more complicated as I imagined and is not a priority for now.

Generated at Wed Feb 07 19:52:38 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.