You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@sling.apache.org by Robert Munteanu <ro...@apache.org> on 2016/07/24 21:32:45 UTC

Support for the R6 HTTP Whiteboard in the Sling trunk

Hi,

I'm trying to register a servlet based on the HTTP whiteboard spec from
R6. The component descriptor looks like this:

<component name="...">
� <implementation class="..."/>
� <service>
� � <provide interface="javax.servlet.Servlet"/>
� </service>
� <property name="osgi.http.whiteboard.servlet.pattern"
value="/analysis"/>
</component>

However, that does not mount a servlet at /analysis, I get a 404.�

When I use the old 'alias' property, it works just fine.

Some relevant bundle versions:

- org.apache.felix.http.jetty 3.2.2
- org.apache.felix.http.whiteboard 3.0.0

Am I doing something wrong or is this expected not to work?

Thanks,

Robert

Re: Support for the R6 HTTP Whiteboard in the Sling trunk

Posted by Carsten Ziegeler <cz...@apache.org>.
> On Monday 01 August 2016 14:44:02 Carsten Ziegeler wrote:
>>> On Mon, 2016-08-01 at 14:21 +0200, Carsten Ziegeler wrote:
>>>>> Hi,
>>>>>
>>>>> On Mon, 2016-07-25 at 14:37 -0500, Carsten Ziegeler wrote:
>>>>>> Hi,
>>>>>>
>>>>>> did you have a look at the web console plugin whether your
>>>>>> servlet is
>>>>>> listed there? Maybe it is shadowed by something else.
>>>>>
>>>>> If you mean http://localhost:8080/system/console/httpservice, it's
>>>>> not
>>>>> listed there.
>>>>
>>>> Then it's not found at all. Just to check: are you sure that your
>>>> test
>>>> is correct and the servlet is registered correctly?
>>>> You can check the service registry.
>>>
>>> Some dependency updates later the servlet appears in the HTTP service
>>> console. It is registered under the expected path but still not
>>> serving requests.
>>>
>>> Something to note - all other servlets are registered under Servlet
>>> Context 'org.osgi.service.http', while this one is registered under
>>> Servlet Context 'default'.
>>
>> Yepp, as expected - org.osgi.service.http is the default context of the
>> http service, in order to not break the http service, this context has
>> precedence over the "default" context.
>> And as  Sling is registered at "/", your servlet is never reached.
>>
>> You can either register within the context 'org.osgi.service.http'
>> (which only exists for the Felix implementation) or create your own context.
> 
> R6 support is work in progress for Pax Web 6, most should work with latest 
> 6.0.0-SNAPSHOTs: https://ops4j1.jira.com/browse/PAXWEB-804
> 

With the sample from Robert, that implementation should behave the same
- the servlet must be ignored
R7 will have a common way to attach servlets to the context(s) managed
by the http service.

But the best way is to create an own context for each app anyway.

Regards

 Carsten

-- 
Carsten Ziegeler
Adobe Research Switzerland
cziegeler@apache.org


Re: Support for the R6 HTTP Whiteboard in the Sling trunk

Posted by Oliver Lietz <ap...@oliverlietz.de>.
On Monday 01 August 2016 14:44:02 Carsten Ziegeler wrote:
> > On Mon, 2016-08-01 at 14:21 +0200, Carsten Ziegeler wrote:
> >>> Hi,
> >>> 
> >>> On Mon, 2016-07-25 at 14:37 -0500, Carsten Ziegeler wrote:
> >>>> Hi,
> >>>> 
> >>>> did you have a look at the web console plugin whether your
> >>>> servlet is
> >>>> listed there? Maybe it is shadowed by something else.
> >>> 
> >>> If you mean http://localhost:8080/system/console/httpservice, it's
> >>> not
> >>> listed there.
> >> 
> >> Then it's not found at all. Just to check: are you sure that your
> >> test
> >> is correct and the servlet is registered correctly?
> >> You can check the service registry.
> > 
> > Some dependency updates later the servlet appears in the HTTP service
> > console. It is registered under the expected path but still not
> > serving requests.
> > 
> > Something to note - all other servlets are registered under Servlet
> > Context 'org.osgi.service.http', while this one is registered under
> > Servlet Context 'default'.
> 
> Yepp, as expected - org.osgi.service.http is the default context of the
> http service, in order to not break the http service, this context has
> precedence over the "default" context.
> And as  Sling is registered at "/", your servlet is never reached.
> 
> You can either register within the context 'org.osgi.service.http'
> (which only exists for the Felix implementation) or create your own context.

R6 support is work in progress for Pax Web 6, most should work with latest 
6.0.0-SNAPSHOTs: https://ops4j1.jira.com/browse/PAXWEB-804

Regards,
O.

> One we have the Sling context, you can use that one
> 
>  Carsten


Re: Support for the R6 HTTP Whiteboard in the Sling trunk

Posted by Robert Munteanu <ro...@apache.org>.
On Mon, 2016-08-01 at 14:44 +0200, Carsten Ziegeler wrote:
> > 
> > On Mon, 2016-08-01 at 14:21 +0200, Carsten Ziegeler wrote:
> > > 
> > > > 
> > > > 
> > > > Hi,
> > > > 
> > > > On Mon, 2016-07-25 at 14:37 -0500, Carsten Ziegeler wrote:
> > > > > 
> > > > > 
> > > > > Hi,
> > > > > 
> > > > > did you have a look at the web console plugin whether your
> > > > > servlet is
> > > > > listed there? Maybe it is shadowed by something else.
> > > > 
> > > > If you mean http://localhost:8080/system/console/httpservice,
> > > > it's
> > > > not
> > > > listed there.
> > > > 
> > > Then it's not found at all. Just to check: are you sure that your
> > > test
> > > is correct and the servlet is registered correctly?
> > > You can check the service registry.
> > 
> > Some dependency updates later the servlet appears in the HTTP
> > service
> > console. It is registered under the expected path but still not
> > serving requests.
> > 
> > Something to note - all other servlets are registered under Servlet
> > Context 'org.osgi.service.http', while this one is registered under
> > Servlet Context 'default'.
> > 
> Yepp, as expected - org.osgi.service.http is the default context of
> the
> http service, in order to not break the http service, this context
> has
> precedence over the "default" context.
> And as��Sling is registered at "/", your servlet is never reached.
> 
> You can either register within the context 'org.osgi.service.http'
> (which only exists for the Felix implementation) or create your own
> context.
> One we have the Sling context, you can use that one

Right, after setting

@Property(name="osgi.http.whiteboard.context.select",
value="(osgi.http.whiteboard.context.name=org.osgi.service.http)")

the servlet is registered. I'll not add that as IIUC it makes the
registration non-portable and wait until we have a Sling context.

Thanks,

Robert

Re: Support for the R6 HTTP Whiteboard in the Sling trunk

Posted by Carsten Ziegeler <cz...@apache.org>.
> On Mon, 2016-08-01 at 14:21 +0200, Carsten Ziegeler wrote:
>>>
>>> Hi,
>>>
>>> On Mon, 2016-07-25 at 14:37 -0500, Carsten Ziegeler wrote:
>>>>
>>>> Hi,
>>>>
>>>> did you have a look at the web console plugin whether your
>>>> servlet is
>>>> listed there? Maybe it is shadowed by something else.
>>>
>>> If you mean http://localhost:8080/system/console/httpservice, it's
>>> not
>>> listed there.
>>>
>> Then it's not found at all. Just to check: are you sure that your
>> test
>> is correct and the servlet is registered correctly?
>> You can check the service registry.
> 
> Some dependency updates later the servlet appears in the HTTP service
> console. It is registered under the expected path but still not
> serving requests.
> 
> Something to note - all other servlets are registered under Servlet
> Context 'org.osgi.service.http', while this one is registered under
> Servlet Context 'default'.
> 
Yepp, as expected - org.osgi.service.http is the default context of the
http service, in order to not break the http service, this context has
precedence over the "default" context.
And as  Sling is registered at "/", your servlet is never reached.

You can either register within the context 'org.osgi.service.http'
(which only exists for the Felix implementation) or create your own context.
One we have the Sling context, you can use that one

 Carsten

-- 
Carsten Ziegeler
Adobe Research Switzerland
cziegeler@apache.org


Re: Support for the R6 HTTP Whiteboard in the Sling trunk

Posted by Robert Munteanu <ro...@apache.org>.
On Mon, 2016-08-01 at 14:21 +0200, Carsten Ziegeler wrote:
> > 
> > Hi,
> > 
> > On Mon, 2016-07-25 at 14:37 -0500, Carsten Ziegeler wrote:
> > > 
> > > Hi,
> > > 
> > > did you have a look at the web console plugin whether your
> > > servlet is
> > > listed there? Maybe it is shadowed by something else.
> > 
> > If you mean http://localhost:8080/system/console/httpservice, it's
> > not
> > listed there.
> > 
> Then it's not found at all. Just to check: are you sure that your
> test
> is correct and the servlet is registered correctly?
> You can check the service registry.

Some dependency updates later the servlet appears in the HTTP service
console. It is registered under the expected path but still not
serving requests.

Something to note - all other servlets are registered under Servlet
Context 'org.osgi.service.http', while this one is registered under
Servlet Context 'default'.

Robert


Re: Support for the R6 HTTP Whiteboard in the Sling trunk

Posted by Carsten Ziegeler <cz...@apache.org>.
> Hi,
> 
> On Mon, 2016-07-25 at 14:37 -0500, Carsten Ziegeler wrote:
>> Hi,
>>
>> did you have a look at the web console plugin whether your servlet is
>> listed there? Maybe it is shadowed by something else.
> 
> If you mean http://localhost:8080/system/console/httpservice, it's not
> listed there.
> 
Then it's not found at all. Just to check: are you sure that your test
is correct and the servlet is registered correctly?
You can check the service registry.

Carsten

 

-- 
Carsten Ziegeler
Adobe Research Switzerland
cziegeler@apache.org


Re: Support for the R6 HTTP Whiteboard in the Sling trunk

Posted by Robert Munteanu <ro...@apache.org>.
Hi,

On Mon, 2016-07-25 at 14:37 -0500, Carsten Ziegeler wrote:
> Hi,
> 
> did you have a look at the web console plugin whether your servlet is
> listed there? Maybe it is shadowed by something else.

If you mean�http://localhost:8080/system/console/httpservice, it's not
listed there.

> Or in other words, yes this should work, it would register your
> servlet
> with the default servlet context. If you have Sling running, then I
> think this doesn't work as Sling is registering itself with the http
> service at "/" which has precedence over the default http whiteboard
> context (I think, but this should be visible from the web console
> plugin).

Yes, I am running Sling.

> We really should use the whiteboard for Sling, I've already created
> an
> issue for that and changes are minimal

I've added a disabled test case to svn, see�

��https://issues.apache.org/jira/browse/SLING-5931

Robert

> 
> Carsten
> 
> > 
> > Hi,
> > 
> > I'm trying to register a servlet based on the HTTP whiteboard spec
> > from
> > R6. The component descriptor looks like this:
> > 
> > <component name="...">
> > � <implementation class="..."/>
> > � <service>
> > ����<provide interface="javax.servlet.Servlet"/>
> > � </service>
> > � <property name="osgi.http.whiteboard.servlet.pattern"
> > value="/analysis"/>
> > </component>
> > 
> > However, that does not mount a servlet at /analysis, I get a 404.�
> > 
> > When I use the old 'alias' property, it works just fine.
> > 
> > Some relevant bundle versions:
> > 
> > - org.apache.felix.http.jetty 3.2.2
> > - org.apache.felix.http.whiteboard 3.0.0
> > 
> > Am I doing something wrong or is this expected not to work?
> > 
> > Thanks,
> > 
> > Robert
> > 
> 
> 
> �
> 


Re: Support for the R6 HTTP Whiteboard in the Sling trunk

Posted by Carsten Ziegeler <cz...@apache.org>.
Hi,

did you have a look at the web console plugin whether your servlet is
listed there? Maybe it is shadowed by something else.
Or in other words, yes this should work, it would register your servlet
with the default servlet context. If you have Sling running, then I
think this doesn't work as Sling is registering itself with the http
service at "/" which has precedence over the default http whiteboard
context (I think, but this should be visible from the web console plugin).
We really should use the whiteboard for Sling, I've already created an
issue for that and changes are minimal

Carsten

> Hi,
> 
> I'm trying to register a servlet based on the HTTP whiteboard spec from
> R6. The component descriptor looks like this:
> 
> <component name="...">
>   <implementation class="..."/>
>   <service>
>     <provide interface="javax.servlet.Servlet"/>
>   </service>
>   <property name="osgi.http.whiteboard.servlet.pattern"
> value="/analysis"/>
> </component>
> 
> However, that does not mount a servlet at /analysis, I get a 404. 
> 
> When I use the old 'alias' property, it works just fine.
> 
> Some relevant bundle versions:
> 
> - org.apache.felix.http.jetty 3.2.2
> - org.apache.felix.http.whiteboard 3.0.0
> 
> Am I doing something wrong or is this expected not to work?
> 
> Thanks,
> 
> Robert
> 


 

-- 
Carsten Ziegeler
Adobe Research Switzerland
cziegeler@apache.org