You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Bruce Jackson <Br...@myriadgroup.com> on 2013/11/06 17:37:56 UTC

Felix http service, whiteboard, DS and HttpContext

Hi All

Does anyone use the Felix http service, DS and the whiteboard with a
custom HttpContext?
I can register a servlet with DS and the whiteboard, but it doesn¹t appear
to hook into my custom HttpContext. I have the component.xml below for
both the servlet and the HttpContext. Any pointers would be helpful.

<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0"
name="TestServlet">
   <implementation class="com.myriadgroup.httptest.TestServlet"/>
   <reference bind="setHttp" cardinality="1..1"
interface="org.osgi.service.http.HttpService" name="HTTP" policy="dynamic"
unbind="unsetHttp"/>
   <reference cardinality="1..1"
interface="org.osgi.service.log.LogService" name="LOG" policy="static"/>
   <property name="alias" type="String" value="/test"/>
   <property name="contextId" type="String" value="foobar"/>
   <reference cardinality="1..1"
interface="org.osgi.service.http.HttpContext" name="HttpContext"
policy="dynamic"/>
</scr:component>


<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0"
name="MyContext">
   <implementation class="com.myriadgroup.httptest.MyContext"/>
   <service>
      <provide interface="org.osgi.service.http.HttpContext"/>
   </service>
   <property name="contextId" type="String" value="foobar"/>
</scr:component>


Best regards

Bruce

*** DISCLAIMER ***

This message, including attachments, is intended solely for the addressee indicated in this message and is strictly confidential or otherwise privileged. If you are not the intended recipient (or responsible for delivery of the message to such person) : - (1) please immediately (i) notify the sender by reply email and (ii) delete this message and attachments, - (2) any use, copy or dissemination of this transmission is strictly prohibited. If you or your employer does not consent to Internet email messages of this kind, please advise Myriad Group AG by reply e-mail immediately. Opinions, conclusions and other information expressed in this message are not given or endorsed by Myriad Group AG unless otherwise indicated by an authorized representative independent of this message.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Felix http service, whiteboard, DS and HttpContext

Posted by Bruce Jackson <Br...@myriadgroup.com>.
Thanks Chetan, that information has fixed the problem.

On 11/11/2013 04:50, "Chetan Mehrotra" <ch...@gmail.com> wrote:

>Have a look at HttpWhiteboardConstants#CONTEXT_ID [1]. From that it
>appears that to share the context you need to
>
>1. Register a HttpContext as a service with service property
>'contextId' set to some shared name say foo
>2. Register your servlet with property contextId to 'foo'
>3. Also set property 'context.shared' to true with the filter
>
>This seems to allow sharing of the HttpContext across bundles. I have
>also now updated the docs [2].
>
>Chetan Mehrotra
>[1]
>https://github.com/apache/felix/blob/trunk/http/whiteboard/src/main/java/o
>rg/apache/felix/http/whiteboard/HttpWhiteboardConstants.java#L51
>[2]
>http://felix.apache.org/documentation/subprojects/apache-felix-http-servic
>e.html
>
>
>Chetan Mehrotra
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>For additional commands, e-mail: users-help@felix.apache.org
>

*** DISCLAIMER ***

This message, including attachments, is intended solely for the addressee indicated in this message and is strictly confidential or otherwise privileged. If you are not the intended recipient (or responsible for delivery of the message to such person) : - (1) please immediately (i) notify the sender by reply email and (ii) delete this message and attachments, - (2) any use, copy or dissemination of this transmission is strictly prohibited. If you or your employer does not consent to Internet email messages of this kind, please advise Myriad Group AG by reply e-mail immediately. Opinions, conclusions and other information expressed in this message are not given or endorsed by Myriad Group AG unless otherwise indicated by an authorized representative independent of this message.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Felix http service, whiteboard, DS and HttpContext

Posted by Chetan Mehrotra <ch...@gmail.com>.
Have a look at HttpWhiteboardConstants#CONTEXT_ID [1]. From that it
appears that to share the context you need to

1. Register a HttpContext as a service with service property
'contextId' set to some shared name say foo
2. Register your servlet with property contextId to 'foo'
3. Also set property 'context.shared' to true with the filter

This seems to allow sharing of the HttpContext across bundles. I have
also now updated the docs [2].

Chetan Mehrotra
[1]
https://github.com/apache/felix/blob/trunk/http/whiteboard/src/main/java/org/apache/felix/http/whiteboard/HttpWhiteboardConstants.java#L51
[2] http://felix.apache.org/documentation/subprojects/apache-felix-http-service.html


Chetan Mehrotra

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Felix http service, whiteboard, DS and HttpContext

Posted by Bruce Jackson <Br...@myriadgroup.com>.
More info: these problems were discussed in the issues FELIX-3225 (which
originally described the problem of the whiteboard pattern not supporting
custom HttpContext) and FELIX-3226 which reported a bug relating to the
servlet not picking up the custom HttpContext if it was started before the
context was available.

However, the solution introduced in 3226 would seem to break the ability
for the HttpContext and Servlet to be defined in separate bundles.

On 10/11/2013 15:07, "Bruce Jackson" <Br...@myriadgroup.com> wrote:

>Looking further into this problem it seems that the issues is actually
>that the provider HttpContext MUST be in the same bundle as the Servlet
>that consumes it. The property ��contextId�� seems to be scoped to the
>bundle in which it is defined, which means that unless you have both the
>servlet and the httpcontext implementation in the same bundle, this won��t
>work. This seems very odd to me: the whiteboard spec doesn��t suggest that
>this must be the case, but clearly the HttpContextManager does some
>juggling of contentId names prepending either ��shared-�� or the bundle id
>to the contextId property. This means that the whiteboard doesn��t match
>the properties defined in the context component and the servlet component
>(as they are different), and the servlet never starts as it can��t find the
>context its been bound to.
>
>Is this correct behaviour?
>
>Thanks
>
>Bruce
>
>
>
>On 08/11/2013 19:31, "David Jencks" <da...@yahoo.com> wrote:
>
>>I don't know enough about httpService to help directly.  However if you
>>set up ds debug level logging you should be able to see exactly what is
>>going on in mind numbing detail with DS components and figure out why
>>references are or aren't getting bound.  Be sure you aren't setting up a
>>circular dependency by having references in both directions between the
>>servlet and http service.
>>
>>hope this helps
>>david jencks
>>
>>On Nov 8, 2013, at 8:31 AM, Bruce Jackson <Br...@myriadgroup.com>
>>wrote:
>>
>>> Anyone have any ideas?
>>>
>>> I guess the question is quite simple: how do you get a servlet
>>>component
>>> registered using DS pick up a HttpContext? In vanilla OSGi, I can do
>>>this
>>> quite simply in code, and using the whiteboard, I can do the same thing
>>> programatically, but how does this work using DS?
>>>
>>> Thanks
>>>
>>> Bruce
>>>
>>> On 07/11/2013 11:46, "Bruce Jackson" <Br...@myriadgroup.com>
>>>wrote:
>>>
>>>> Sorry, that was my error. In fact this does have an exposed interface
>>>>for
>>>> Servlet (see below). The problem seems to be that (either) DS or
>>>> whiteboard don��t match the contextId required by the servlet with the
>>>> contentId property declared by the component that provides it. As soon
>>>>as
>>>> the servlet has the property contentId set, then it no longer is
>>>> accessible (felix http generates a 404).
>>>>
>>>> Any ideas?
>>>>
>>>> Thanks
>>>>
>>>> Bruce
>>>>
>>>> <scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0"
>>>> name="TestServlet">
>>>>  <implementation class="com.myriadgroup.httptest.TestServlet"/>
>>>>  <reference cardinality="1..1"
>>>> interface="org.osgi.service.http.HttpService" name="HTTP"
>>>> policy="static"/>
>>>>  <reference cardinality="1..1"
>>>> interface="org.osgi.service.log.LogService" name="LOG"
>>>>policy="static"/>
>>>>  <property name="contextId" type="String" value="foobar"/>
>>>>  <service>
>>>>     <provide interface="javax.servlet.Servlet"/>
>>>>  </service>
>>>>  <reference cardinality="1..1"
>>>> interface="org.osgi.service.http.HttpContext" name="HttpContext"
>>>> policy="static"/>
>>>>  <property name="alias" type="String" value="/test"/>
>>>> </scr:component>
>>>>
>>>>
>>>>
>>>> On 07/11/2013 07:36, "David Jencks" <da...@yahoo.com> wrote:
>>>>
>>>>> I think you may need to have TestServlet expose an interface for
>>>>> httpservice to find on the whiteboard, probably Servlet or
>>>>>HttpServlet.
>>>>> With your xml as shown, TestServlet does not register as a service at
>>>>> all.
>>>>>
>>>>> david jencks
>>>>>
>>>>> On Nov 6, 2013, at 9:19 PM, Chetan Mehrotra
>>>>><ch...@gmail.com>
>>>>> wrote:
>>>>>
>>>>>> From the component descriptors I see that you are mixing two
>>>>>>approaches
>>>>>>
>>>>>> 1. TestServlet is obtaining a reference to HttpService and
>>>>>>HttpContext
>>>>>> 2. TestServlet is being registered with properties required by
>>>>>> whiteboard i.e. alias and contextId
>>>>>>
>>>>>> Are you using httpService to programatically register the servlet?
>>>>>>If
>>>>>> you just rely on whiteboard support then you need not use
>>>>>>HttpService
>>>>>> or access HttpContext from within servlet. Instead you just need to
>>>>>> register your services with required properties i.e. alias and
>>>>>> contextId for Servlet and contextId for HttpContext and whiteboard
>>>>>> support would do the job of registering the servlet with proper
>>>>>> context
>>>>>> Chetan Mehrotra
>>>>>>
>>>>>>
>>>>>> On Wed, Nov 6, 2013 at 10:07 PM, Bruce Jackson
>>>>>> <Br...@myriadgroup.com> wrote:
>>>>>>> Hi All
>>>>>>>
>>>>>>> Does anyone use the Felix http service, DS and the whiteboard with
>>>>>>>a
>>>>>>> custom HttpContext?
>>>>>>> I can register a servlet with DS and the whiteboard, but it doesn��t
>>>>>>> appear
>>>>>>> to hook into my custom HttpContext. I have the component.xml below
>>>>>>>for
>>>>>>> both the servlet and the HttpContext. Any pointers would be
>>>>>>>helpful.
>>>>>>>
>>>>>>> <scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0"
>>>>>>> name="TestServlet">
>>>>>>>  <implementation class="com.myriadgroup.httptest.TestServlet"/>
>>>>>>>  <reference bind="setHttp" cardinality="1..1"
>>>>>>> interface="org.osgi.service.http.HttpService" name="HTTP"
>>>>>>> policy="dynamic"
>>>>>>> unbind="unsetHttp"/>
>>>>>>>  <reference cardinality="1..1"
>>>>>>> interface="org.osgi.service.log.LogService" name="LOG"
>>>>>>> policy="static"/>
>>>>>>>  <property name="alias" type="String" value="/test"/>
>>>>>>>  <property name="contextId" type="String" value="foobar"/>
>>>>>>>  <reference cardinality="1..1"
>>>>>>> interface="org.osgi.service.http.HttpContext" name="HttpContext"
>>>>>>> policy="dynamic"/>
>>>>>>> </scr:component>
>>>>>>>
>>>>>>>
>>>>>>> <scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0"
>>>>>>> name="MyContext">
>>>>>>>  <implementation class="com.myriadgroup.httptest.MyContext"/>
>>>>>>>  <service>
>>>>>>>     <provide interface="org.osgi.service.http.HttpContext"/>
>>>>>>>  </service>
>>>>>>>  <property name="contextId" type="String" value="foobar"/>
>>>>>>> </scr:component>
>>>>>>>
>>>>>>>
>>>>>>> Best regards
>>>>>>>
>>>>>>> Bruce
>>>>>>>
>>>>>>> *** DISCLAIMER ***
>>>>>>>
>>>>>>> This message, including attachments, is intended solely for the
>>>>>>> addressee indicated in this message and is strictly confidential or
>>>>>>> otherwise privileged. If you are not the intended recipient (or
>>>>>>> responsible for delivery of the message to such person) : - (1)
>>>>>>>please
>>>>>>> immediately (i) notify the sender by reply email and (ii) delete
>>>>>>>this
>>>>>>> message and attachments, - (2) any use, copy or dissemination of
>>>>>>>this
>>>>>>> transmission is strictly prohibited. If you or your employer does
>>>>>>>not
>>>>>>> consent to Internet email messages of this kind, please advise
>>>>>>>Myriad
>>>>>>> Group AG by reply e-mail immediately. Opinions, conclusions and
>>>>>>>other
>>>>>>> information expressed in this message are not given or endorsed by
>>>>>>> Myriad Group AG unless otherwise indicated by an authorized
>>>>>>> representative independent of this message.
>>>>>>>
>>>>>>>
>>>>>>>--------------------------------------------------------------------
>>>>>>>-
>>>>>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>>>>>> For additional commands, e-mail: users-help@felix.apache.org
>>>>>>>
>>>>>>
>>>>>>
>>>>>>---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>>>>> For additional commands, e-mail: users-help@felix.apache.org
>>>>>>
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>>>> For additional commands, e-mail: users-help@felix.apache.org
>>>>>
>>>>
>>>> *** DISCLAIMER ***
>>>>
>>>> This message, including attachments, is intended solely for the
>>>>addressee
>>>> indicated in this message and is strictly confidential or otherwise
>>>> privileged. If you are not the intended recipient (or responsible for
>>>> delivery of the message to such person) : - (1) please immediately (i)
>>>> notify the sender by reply email and (ii) delete this message and
>>>> attachments, - (2) any use, copy or dissemination of this transmission
>>>>is
>>>> strictly prohibited. If you or your employer does not consent to
>>>>Internet
>>>> email messages of this kind, please advise Myriad Group AG by reply
>>>> e-mail immediately. Opinions, conclusions and other information
>>>>expressed
>>>> in this message are not given or endorsed by Myriad Group AG unless
>>>> otherwise indicated by an authorized representative independent of
>>>>this
>>>> message.
>>>>
>>>>?B�KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
>>>>C
>>>>B*
>>>> ??[�?��ܚX�K??K[XZ[?�?\?�?[�?��ܚX�P?�[?^?�\?X?K�??���??Y??]?[?[??��
>>>> [X[�???K[XZ[?�?\?�??[???�[?^?�\?X?K�??
>>>
>>> *** DISCLAIMER ***
>>>
>>> This message, including attachments, is intended solely for the
>>>addressee indicated in this message and is strictly confidential or
>>>otherwise privileged. If you are not the intended recipient (or
>>>responsible for delivery of the message to such person) : - (1) please
>>>immediately (i) notify the sender by reply email and (ii) delete this
>>>message and attachments, - (2) any use, copy or dissemination of this
>>>transmission is strictly prohibited. If you or your employer does not
>>>consent to Internet email messages of this kind, please advise Myriad
>>>Group AG by reply e-mail immediately. Opinions, conclusions and other
>>>information expressed in this message are not given or endorsed by
>>>Myriad Group AG unless otherwise indicated by an authorized
>>>representative independent of this message.
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>> For additional commands, e-mail: users-help@felix.apache.org
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>For additional commands, e-mail: users-help@felix.apache.org
>
>*** DISCLAIMER ***
>
>This message, including attachments, is intended solely for the addressee
>indicated in this message and is strictly confidential or otherwise
>privileged. If you are not the intended recipient (or responsible for
>delivery of the message to such person) : - (1) please immediately (i)
>notify the sender by reply email and (ii) delete this message and
>attachments, - (2) any use, copy or dissemination of this transmission is
>strictly prohibited. If you or your employer does not consent to Internet
>email messages of this kind, please advise Myriad Group AG by reply
>e-mail immediately. Opinions, conclusions and other information expressed
>in this message are not given or endorsed by Myriad Group AG unless
>otherwise indicated by an authorized representative independent of this
>message.

*** DISCLAIMER ***

This message, including attachments, is intended solely for the addressee indicated in this message and is strictly confidential or otherwise privileged. If you are not the intended recipient (or responsible for delivery of the message to such person) : - (1) please immediately (i) notify the sender by reply email and (ii) delete this message and attachments, - (2) any use, copy or dissemination of this transmission is strictly prohibited. If you or your employer does not consent to Internet email messages of this kind, please advise Myriad Group AG by reply e-mail immediately. Opinions, conclusions and other information expressed in this message are not given or endorsed by Myriad Group AG unless otherwise indicated by an authorized representative independent of this message.

Re: Felix http service, whiteboard, DS and HttpContext

Posted by Bruce Jackson <Br...@myriadgroup.com>.
Looking further into this problem it seems that the issues is actually
that the provider HttpContext MUST be in the same bundle as the Servlet
that consumes it. The property ��contextId�� seems to be scoped to the
bundle in which it is defined, which means that unless you have both the
servlet and the httpcontext implementation in the same bundle, this won��t
work. This seems very odd to me: the whiteboard spec doesn��t suggest that
this must be the case, but clearly the HttpContextManager does some
juggling of contentId names prepending either ��shared-�� or the bundle id
to the contextId property. This means that the whiteboard doesn��t match
the properties defined in the context component and the servlet component
(as they are different), and the servlet never starts as it can��t find the
context its been bound to.

Is this correct behaviour?

Thanks

Bruce



On 08/11/2013 19:31, "David Jencks" <da...@yahoo.com> wrote:

>I don't know enough about httpService to help directly.  However if you
>set up ds debug level logging you should be able to see exactly what is
>going on in mind numbing detail with DS components and figure out why
>references are or aren't getting bound.  Be sure you aren't setting up a
>circular dependency by having references in both directions between the
>servlet and http service.
>
>hope this helps
>david jencks
>
>On Nov 8, 2013, at 8:31 AM, Bruce Jackson <Br...@myriadgroup.com>
>wrote:
>
>> Anyone have any ideas?
>>
>> I guess the question is quite simple: how do you get a servlet component
>> registered using DS pick up a HttpContext? In vanilla OSGi, I can do
>>this
>> quite simply in code, and using the whiteboard, I can do the same thing
>> programatically, but how does this work using DS?
>>
>> Thanks
>>
>> Bruce
>>
>> On 07/11/2013 11:46, "Bruce Jackson" <Br...@myriadgroup.com>
>>wrote:
>>
>>> Sorry, that was my error. In fact this does have an exposed interface
>>>for
>>> Servlet (see below). The problem seems to be that (either) DS or
>>> whiteboard don��t match the contextId required by the servlet with the
>>> contentId property declared by the component that provides it. As soon
>>>as
>>> the servlet has the property contentId set, then it no longer is
>>> accessible (felix http generates a 404).
>>>
>>> Any ideas?
>>>
>>> Thanks
>>>
>>> Bruce
>>>
>>> <scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0"
>>> name="TestServlet">
>>>  <implementation class="com.myriadgroup.httptest.TestServlet"/>
>>>  <reference cardinality="1..1"
>>> interface="org.osgi.service.http.HttpService" name="HTTP"
>>> policy="static"/>
>>>  <reference cardinality="1..1"
>>> interface="org.osgi.service.log.LogService" name="LOG"
>>>policy="static"/>
>>>  <property name="contextId" type="String" value="foobar"/>
>>>  <service>
>>>     <provide interface="javax.servlet.Servlet"/>
>>>  </service>
>>>  <reference cardinality="1..1"
>>> interface="org.osgi.service.http.HttpContext" name="HttpContext"
>>> policy="static"/>
>>>  <property name="alias" type="String" value="/test"/>
>>> </scr:component>
>>>
>>>
>>>
>>> On 07/11/2013 07:36, "David Jencks" <da...@yahoo.com> wrote:
>>>
>>>> I think you may need to have TestServlet expose an interface for
>>>> httpservice to find on the whiteboard, probably Servlet or
>>>>HttpServlet.
>>>> With your xml as shown, TestServlet does not register as a service at
>>>> all.
>>>>
>>>> david jencks
>>>>
>>>> On Nov 6, 2013, at 9:19 PM, Chetan Mehrotra
>>>><ch...@gmail.com>
>>>> wrote:
>>>>
>>>>> From the component descriptors I see that you are mixing two
>>>>>approaches
>>>>>
>>>>> 1. TestServlet is obtaining a reference to HttpService and
>>>>>HttpContext
>>>>> 2. TestServlet is being registered with properties required by
>>>>> whiteboard i.e. alias and contextId
>>>>>
>>>>> Are you using httpService to programatically register the servlet? If
>>>>> you just rely on whiteboard support then you need not use HttpService
>>>>> or access HttpContext from within servlet. Instead you just need to
>>>>> register your services with required properties i.e. alias and
>>>>> contextId for Servlet and contextId for HttpContext and whiteboard
>>>>> support would do the job of registering the servlet with proper
>>>>> context
>>>>> Chetan Mehrotra
>>>>>
>>>>>
>>>>> On Wed, Nov 6, 2013 at 10:07 PM, Bruce Jackson
>>>>> <Br...@myriadgroup.com> wrote:
>>>>>> Hi All
>>>>>>
>>>>>> Does anyone use the Felix http service, DS and the whiteboard with a
>>>>>> custom HttpContext?
>>>>>> I can register a servlet with DS and the whiteboard, but it doesn��t
>>>>>> appear
>>>>>> to hook into my custom HttpContext. I have the component.xml below
>>>>>>for
>>>>>> both the servlet and the HttpContext. Any pointers would be helpful.
>>>>>>
>>>>>> <scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0"
>>>>>> name="TestServlet">
>>>>>>  <implementation class="com.myriadgroup.httptest.TestServlet"/>
>>>>>>  <reference bind="setHttp" cardinality="1..1"
>>>>>> interface="org.osgi.service.http.HttpService" name="HTTP"
>>>>>> policy="dynamic"
>>>>>> unbind="unsetHttp"/>
>>>>>>  <reference cardinality="1..1"
>>>>>> interface="org.osgi.service.log.LogService" name="LOG"
>>>>>> policy="static"/>
>>>>>>  <property name="alias" type="String" value="/test"/>
>>>>>>  <property name="contextId" type="String" value="foobar"/>
>>>>>>  <reference cardinality="1..1"
>>>>>> interface="org.osgi.service.http.HttpContext" name="HttpContext"
>>>>>> policy="dynamic"/>
>>>>>> </scr:component>
>>>>>>
>>>>>>
>>>>>> <scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0"
>>>>>> name="MyContext">
>>>>>>  <implementation class="com.myriadgroup.httptest.MyContext"/>
>>>>>>  <service>
>>>>>>     <provide interface="org.osgi.service.http.HttpContext"/>
>>>>>>  </service>
>>>>>>  <property name="contextId" type="String" value="foobar"/>
>>>>>> </scr:component>
>>>>>>
>>>>>>
>>>>>> Best regards
>>>>>>
>>>>>> Bruce
>>>>>>
>>>>>> *** DISCLAIMER ***
>>>>>>
>>>>>> This message, including attachments, is intended solely for the
>>>>>> addressee indicated in this message and is strictly confidential or
>>>>>> otherwise privileged. If you are not the intended recipient (or
>>>>>> responsible for delivery of the message to such person) : - (1)
>>>>>>please
>>>>>> immediately (i) notify the sender by reply email and (ii) delete
>>>>>>this
>>>>>> message and attachments, - (2) any use, copy or dissemination of
>>>>>>this
>>>>>> transmission is strictly prohibited. If you or your employer does
>>>>>>not
>>>>>> consent to Internet email messages of this kind, please advise
>>>>>>Myriad
>>>>>> Group AG by reply e-mail immediately. Opinions, conclusions and
>>>>>>other
>>>>>> information expressed in this message are not given or endorsed by
>>>>>> Myriad Group AG unless otherwise indicated by an authorized
>>>>>> representative independent of this message.
>>>>>>
>>>>>>
>>>>>>---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>>>>> For additional commands, e-mail: users-help@felix.apache.org
>>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>>>> For additional commands, e-mail: users-help@felix.apache.org
>>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>>> For additional commands, e-mail: users-help@felix.apache.org
>>>>
>>>
>>> *** DISCLAIMER ***
>>>
>>> This message, including attachments, is intended solely for the
>>>addressee
>>> indicated in this message and is strictly confidential or otherwise
>>> privileged. If you are not the intended recipient (or responsible for
>>> delivery of the message to such person) : - (1) please immediately (i)
>>> notify the sender by reply email and (ii) delete this message and
>>> attachments, - (2) any use, copy or dissemination of this transmission
>>>is
>>> strictly prohibited. If you or your employer does not consent to
>>>Internet
>>> email messages of this kind, please advise Myriad Group AG by reply
>>> e-mail immediately. Opinions, conclusions and other information
>>>expressed
>>> in this message are not given or endorsed by Myriad Group AG unless
>>> otherwise indicated by an authorized representative independent of this
>>> message.
>>>
>>>?B�KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKC
>>>B*
>>> ??[�?��ܚX�K??K[XZ[?�?\?�?[�?��ܚX�P?�[?^?�\?X?K�??���??Y??]?[?[??��
>>> [X[�???K[XZ[?�?\?�??[???�[?^?�\?X?K�??
>>
>> *** DISCLAIMER ***
>>
>> This message, including attachments, is intended solely for the
>>addressee indicated in this message and is strictly confidential or
>>otherwise privileged. If you are not the intended recipient (or
>>responsible for delivery of the message to such person) : - (1) please
>>immediately (i) notify the sender by reply email and (ii) delete this
>>message and attachments, - (2) any use, copy or dissemination of this
>>transmission is strictly prohibited. If you or your employer does not
>>consent to Internet email messages of this kind, please advise Myriad
>>Group AG by reply e-mail immediately. Opinions, conclusions and other
>>information expressed in this message are not given or endorsed by
>>Myriad Group AG unless otherwise indicated by an authorized
>>representative independent of this message.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>For additional commands, e-mail: users-help@felix.apache.org

*** DISCLAIMER ***

This message, including attachments, is intended solely for the addressee indicated in this message and is strictly confidential or otherwise privileged. If you are not the intended recipient (or responsible for delivery of the message to such person) : - (1) please immediately (i) notify the sender by reply email and (ii) delete this message and attachments, - (2) any use, copy or dissemination of this transmission is strictly prohibited. If you or your employer does not consent to Internet email messages of this kind, please advise Myriad Group AG by reply e-mail immediately. Opinions, conclusions and other information expressed in this message are not given or endorsed by Myriad Group AG unless otherwise indicated by an authorized representative independent of this message.

Re: Felix http service, whiteboard, DS and HttpContext

Posted by David Jencks <da...@yahoo.com>.
I don't know enough about httpService to help directly.  However if you set up ds debug level logging you should be able to see exactly what is going on in mind numbing detail with DS components and figure out why references are or aren't getting bound.  Be sure you aren't setting up a circular dependency by having references in both directions between the servlet and http service.

hope this helps
david jencks

On Nov 8, 2013, at 8:31 AM, Bruce Jackson <Br...@myriadgroup.com> wrote:

> Anyone have any ideas?
> 
> I guess the question is quite simple: how do you get a servlet component
> registered using DS pick up a HttpContext? In vanilla OSGi, I can do this
> quite simply in code, and using the whiteboard, I can do the same thing
> programatically, but how does this work using DS?
> 
> Thanks
> 
> Bruce
> 
> On 07/11/2013 11:46, "Bruce Jackson" <Br...@myriadgroup.com> wrote:
> 
>> Sorry, that was my error. In fact this does have an exposed interface for
>> Servlet (see below). The problem seems to be that (either) DS or
>> whiteboard don’t match the contextId required by the servlet with the
>> contentId property declared by the component that provides it. As soon as
>> the servlet has the property contentId set, then it no longer is
>> accessible (felix http generates a 404).
>> 
>> Any ideas?
>> 
>> Thanks
>> 
>> Bruce
>> 
>> <scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0"
>> name="TestServlet">
>>  <implementation class="com.myriadgroup.httptest.TestServlet"/>
>>  <reference cardinality="1..1"
>> interface="org.osgi.service.http.HttpService" name="HTTP"
>> policy="static"/>
>>  <reference cardinality="1..1"
>> interface="org.osgi.service.log.LogService" name="LOG" policy="static"/>
>>  <property name="contextId" type="String" value="foobar"/>
>>  <service>
>>     <provide interface="javax.servlet.Servlet"/>
>>  </service>
>>  <reference cardinality="1..1"
>> interface="org.osgi.service.http.HttpContext" name="HttpContext"
>> policy="static"/>
>>  <property name="alias" type="String" value="/test"/>
>> </scr:component>
>> 
>> 
>> 
>> On 07/11/2013 07:36, "David Jencks" <da...@yahoo.com> wrote:
>> 
>>> I think you may need to have TestServlet expose an interface for
>>> httpservice to find on the whiteboard, probably Servlet or HttpServlet.
>>> With your xml as shown, TestServlet does not register as a service at
>>> all.
>>> 
>>> david jencks
>>> 
>>> On Nov 6, 2013, at 9:19 PM, Chetan Mehrotra <ch...@gmail.com>
>>> wrote:
>>> 
>>>> From the component descriptors I see that you are mixing two approaches
>>>> 
>>>> 1. TestServlet is obtaining a reference to HttpService and HttpContext
>>>> 2. TestServlet is being registered with properties required by
>>>> whiteboard i.e. alias and contextId
>>>> 
>>>> Are you using httpService to programatically register the servlet? If
>>>> you just rely on whiteboard support then you need not use HttpService
>>>> or access HttpContext from within servlet. Instead you just need to
>>>> register your services with required properties i.e. alias and
>>>> contextId for Servlet and contextId for HttpContext and whiteboard
>>>> support would do the job of registering the servlet with proper
>>>> context
>>>> Chetan Mehrotra
>>>> 
>>>> 
>>>> On Wed, Nov 6, 2013 at 10:07 PM, Bruce Jackson
>>>> <Br...@myriadgroup.com> wrote:
>>>>> Hi All
>>>>> 
>>>>> Does anyone use the Felix http service, DS and the whiteboard with a
>>>>> custom HttpContext?
>>>>> I can register a servlet with DS and the whiteboard, but it doesn¹t
>>>>> appear
>>>>> to hook into my custom HttpContext. I have the component.xml below for
>>>>> both the servlet and the HttpContext. Any pointers would be helpful.
>>>>> 
>>>>> <scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0"
>>>>> name="TestServlet">
>>>>>  <implementation class="com.myriadgroup.httptest.TestServlet"/>
>>>>>  <reference bind="setHttp" cardinality="1..1"
>>>>> interface="org.osgi.service.http.HttpService" name="HTTP"
>>>>> policy="dynamic"
>>>>> unbind="unsetHttp"/>
>>>>>  <reference cardinality="1..1"
>>>>> interface="org.osgi.service.log.LogService" name="LOG"
>>>>> policy="static"/>
>>>>>  <property name="alias" type="String" value="/test"/>
>>>>>  <property name="contextId" type="String" value="foobar"/>
>>>>>  <reference cardinality="1..1"
>>>>> interface="org.osgi.service.http.HttpContext" name="HttpContext"
>>>>> policy="dynamic"/>
>>>>> </scr:component>
>>>>> 
>>>>> 
>>>>> <scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0"
>>>>> name="MyContext">
>>>>>  <implementation class="com.myriadgroup.httptest.MyContext"/>
>>>>>  <service>
>>>>>     <provide interface="org.osgi.service.http.HttpContext"/>
>>>>>  </service>
>>>>>  <property name="contextId" type="String" value="foobar"/>
>>>>> </scr:component>
>>>>> 
>>>>> 
>>>>> Best regards
>>>>> 
>>>>> Bruce
>>>>> 
>>>>> *** DISCLAIMER ***
>>>>> 
>>>>> This message, including attachments, is intended solely for the
>>>>> addressee indicated in this message and is strictly confidential or
>>>>> otherwise privileged. If you are not the intended recipient (or
>>>>> responsible for delivery of the message to such person) : - (1) please
>>>>> immediately (i) notify the sender by reply email and (ii) delete this
>>>>> message and attachments, - (2) any use, copy or dissemination of this
>>>>> transmission is strictly prohibited. If you or your employer does not
>>>>> consent to Internet email messages of this kind, please advise Myriad
>>>>> Group AG by reply e-mail immediately. Opinions, conclusions and other
>>>>> information expressed in this message are not given or endorsed by
>>>>> Myriad Group AG unless otherwise indicated by an authorized
>>>>> representative independent of this message.
>>>>> 
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>>>> For additional commands, e-mail: users-help@felix.apache.org
>>>>> 
>>>> 
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>>> For additional commands, e-mail: users-help@felix.apache.org
>>>> 
>>> 
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>> For additional commands, e-mail: users-help@felix.apache.org
>>> 
>> 
>> *** DISCLAIMER ***
>> 
>> This message, including attachments, is intended solely for the addressee
>> indicated in this message and is strictly confidential or otherwise
>> privileged. If you are not the intended recipient (or responsible for
>> delivery of the message to such person) : - (1) please immediately (i)
>> notify the sender by reply email and (ii) delete this message and
>> attachments, - (2) any use, copy or dissemination of this transmission is
>> strictly prohibited. If you or your employer does not consent to Internet
>> email messages of this kind, please advise Myriad Group AG by reply
>> e-mail immediately. Opinions, conclusions and other information expressed
>> in this message are not given or endorsed by Myriad Group AG unless
>> otherwise indicated by an authorized representative independent of this
>> message.
>> ?B‹KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKCB*
>> ??[œ?œ昧šX™K??K[XZ[?ˆ?\?œ?[œ?œ昧šX™P?™[?^?˜\?X?K›??‘›??Y??]?[?[??栢
>> [X[™???K[XZ[?ˆ?\?œ??[???™[?^?˜\?X?K›??
> 
> *** DISCLAIMER ***
> 
> This message, including attachments, is intended solely for the addressee indicated in this message and is strictly confidential or otherwise privileged. If you are not the intended recipient (or responsible for delivery of the message to such person) : - (1) please immediately (i) notify the sender by reply email and (ii) delete this message and attachments, - (2) any use, copy or dissemination of this transmission is strictly prohibited. If you or your employer does not consent to Internet email messages of this kind, please advise Myriad Group AG by reply e-mail immediately. Opinions, conclusions and other information expressed in this message are not given or endorsed by Myriad Group AG unless otherwise indicated by an authorized representative independent of this message.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Felix http service, whiteboard, DS and HttpContext

Posted by Bruce Jackson <Br...@myriadgroup.com>.
The tutorial you’ve referred to doesn’t mention HttpContext?

On 08/11/2013 16:49, "Ferry Huberts" <ma...@hupie.com> wrote:

>have a look here:
>https://github.com/osgi/osgi.enroute.blog/blob/master/OSGi-enRoute-blog.pd
>f?raw=true
>
>On 08/11/13 17:31, Bruce Jackson wrote:
>> Anyone have any ideas?
>>
>> I guess the question is quite simple: how do you get a servlet component
>> registered using DS pick up a HttpContext? In vanilla OSGi, I can do
>>this
>> quite simply in code, and using the whiteboard, I can do the same thing
>> programatically, but how does this work using DS?
>>
>> Thanks
>>
>> Bruce
>>
>> On 07/11/2013 11:46, "Bruce Jackson" <Br...@myriadgroup.com>
>>wrote:
>>
>>> Sorry, that was my error. In fact this does have an exposed interface
>>>for
>>> Servlet (see below). The problem seems to be that (either) DS or
>>> whiteboard don’t match the contextId required by the servlet with the
>>> contentId property declared by the component that provides it. As soon
>>>as
>>> the servlet has the property contentId set, then it no longer is
>>> accessible (felix http generates a 404).
>>>
>>> Any ideas?
>>>
>>> Thanks
>>>
>>> Bruce
>>>
>>> <scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0"
>>> name="TestServlet">
>>>    <implementation class="com.myriadgroup.httptest.TestServlet"/>
>>>    <reference cardinality="1..1"
>>> interface="org.osgi.service.http.HttpService" name="HTTP"
>>> policy="static"/>
>>>    <reference cardinality="1..1"
>>> interface="org.osgi.service.log.LogService" name="LOG"
>>>policy="static"/>
>>>    <property name="contextId" type="String" value="foobar"/>
>>>    <service>
>>>       <provide interface="javax.servlet.Servlet"/>
>>>    </service>
>>>    <reference cardinality="1..1"
>>> interface="org.osgi.service.http.HttpContext" name="HttpContext"
>>> policy="static"/>
>>>    <property name="alias" type="String" value="/test"/>
>>> </scr:component>
>>>
>>>
>>>
>>> On 07/11/2013 07:36, "David Jencks" <da...@yahoo.com> wrote:
>>>
>>>> I think you may need to have TestServlet expose an interface for
>>>> httpservice to find on the whiteboard, probably Servlet or
>>>>HttpServlet.
>>>> With your xml as shown, TestServlet does not register as a service at
>>>> all.
>>>>
>>>> david jencks
>>>>
>>>> On Nov 6, 2013, at 9:19 PM, Chetan Mehrotra
>>>><ch...@gmail.com>
>>>> wrote:
>>>>
>>>>>  From the component descriptors I see that you are mixing two
>>>>>approaches
>>>>>
>>>>> 1. TestServlet is obtaining a reference to HttpService and
>>>>>HttpContext
>>>>> 2. TestServlet is being registered with properties required by
>>>>> whiteboard i.e. alias and contextId
>>>>>
>>>>> Are you using httpService to programatically register the servlet? If
>>>>> you just rely on whiteboard support then you need not use HttpService
>>>>> or access HttpContext from within servlet. Instead you just need to
>>>>> register your services with required properties i.e. alias and
>>>>> contextId for Servlet and contextId for HttpContext and whiteboard
>>>>> support would do the job of registering the servlet with proper
>>>>> context
>>>>> Chetan Mehrotra
>>>>>
>>>>>
>>>>> On Wed, Nov 6, 2013 at 10:07 PM, Bruce Jackson
>>>>> <Br...@myriadgroup.com> wrote:
>>>>>> Hi All
>>>>>>
>>>>>> Does anyone use the Felix http service, DS and the whiteboard with a
>>>>>> custom HttpContext?
>>>>>> I can register a servlet with DS and the whiteboard, but it doesn¹t
>>>>>> appear
>>>>>> to hook into my custom HttpContext. I have the component.xml below
>>>>>>for
>>>>>> both the servlet and the HttpContext. Any pointers would be helpful.
>>>>>>
>>>>>> <scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0"
>>>>>> name="TestServlet">
>>>>>>    <implementation class="com.myriadgroup.httptest.TestServlet"/>
>>>>>>    <reference bind="setHttp" cardinality="1..1"
>>>>>> interface="org.osgi.service.http.HttpService" name="HTTP"
>>>>>> policy="dynamic"
>>>>>> unbind="unsetHttp"/>
>>>>>>    <reference cardinality="1..1"
>>>>>> interface="org.osgi.service.log.LogService" name="LOG"
>>>>>> policy="static"/>
>>>>>>    <property name="alias" type="String" value="/test"/>
>>>>>>    <property name="contextId" type="String" value="foobar"/>
>>>>>>    <reference cardinality="1..1"
>>>>>> interface="org.osgi.service.http.HttpContext" name="HttpContext"
>>>>>> policy="dynamic"/>
>>>>>> </scr:component>
>>>>>>
>>>>>>
>>>>>> <scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0"
>>>>>> name="MyContext">
>>>>>>    <implementation class="com.myriadgroup.httptest.MyContext"/>
>>>>>>    <service>
>>>>>>       <provide interface="org.osgi.service.http.HttpContext"/>
>>>>>>    </service>
>>>>>>    <property name="contextId" type="String" value="foobar"/>
>>>>>> </scr:component>
>>>>>>
>>>>>>
>>>>>> Best regards
>>>>>>
>>>>>> Bruce
>>>>>>
>>>>>> *** DISCLAIMER ***
>>>>>>
>>>>>> This message, including attachments, is intended solely for the
>>>>>> addressee indicated in this message and is strictly confidential or
>>>>>> otherwise privileged. If you are not the intended recipient (or
>>>>>> responsible for delivery of the message to such person) : - (1)
>>>>>>please
>>>>>> immediately (i) notify the sender by reply email and (ii) delete
>>>>>>this
>>>>>> message and attachments, - (2) any use, copy or dissemination of
>>>>>>this
>>>>>> transmission is strictly prohibited. If you or your employer does
>>>>>>not
>>>>>> consent to Internet email messages of this kind, please advise
>>>>>>Myriad
>>>>>> Group AG by reply e-mail immediately. Opinions, conclusions and
>>>>>>other
>>>>>> information expressed in this message are not given or endorsed by
>>>>>> Myriad Group AG unless otherwise indicated by an authorized
>>>>>> representative independent of this message.
>>>>>>
>>>>>>
>>>>>>---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>>>>> For additional commands, e-mail: users-help@felix.apache.org
>>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>>>> For additional commands, e-mail: users-help@felix.apache.org
>>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>>> For additional commands, e-mail: users-help@felix.apache.org
>>>>
>>>
>>> *** DISCLAIMER ***
>>>
>>> This message, including attachments, is intended solely for the
>>>addressee
>>> indicated in this message and is strictly confidential or otherwise
>>> privileged. If you are not the intended recipient (or responsible for
>>> delivery of the message to such person) : - (1) please immediately (i)
>>> notify the sender by reply email and (ii) delete this message and
>>> attachments, - (2) any use, copy or dissemination of this transmission
>>>is
>>> strictly prohibited. If you or your employer does not consent to
>>>Internet
>>> email messages of this kind, please advise Myriad Group AG by reply
>>> e-mail immediately. Opinions, conclusions and other information
>>>expressed
>>> in this message are not given or endorsed by Myriad Group AG unless
>>> otherwise indicated by an authorized representative independent of this
>>> message.
>>>
>>>?B딮KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKCB
>>>*
>>> ??[�?쒁�X셁??K[XZ[?�?\?�?[�?쒁�X셆?�[?^?�\?X?K�??‘�??Y??]?[?[??栢
>>> [X[�???K[XZ[?�?\?�??[???�[?^?�\?X?K�??
>>
>> *** DISCLAIMER ***
>>
>> This message, including attachments, is intended solely for the
>>addressee indicated in this message and is strictly confidential or
>>otherwise privileged. If you are not the intended recipient (or
>>responsible for delivery of the message to such person) : - (1) please
>>immediately (i) notify the sender by reply email and (ii) delete this
>>message and attachments, - (2) any use, copy or dissemination of this
>>transmission is strictly prohibited. If you or your employer does not
>>consent to Internet email messages of this kind, please advise Myriad
>>Group AG by reply e-mail immediately. Opinions, conclusions and other
>>information expressed in this message are not given or endorsed by
>>Myriad Group AG unless otherwise indicated by an authorized
>>representative independent of this message.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>>
>
>--
>Ferry Huberts
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>For additional commands, e-mail: users-help@felix.apache.org
>

*** DISCLAIMER ***

This message, including attachments, is intended solely for the addressee indicated in this message and is strictly confidential or otherwise privileged. If you are not the intended recipient (or responsible for delivery of the message to such person) : - (1) please immediately (i) notify the sender by reply email and (ii) delete this message and attachments, - (2) any use, copy or dissemination of this transmission is strictly prohibited. If you or your employer does not consent to Internet email messages of this kind, please advise Myriad Group AG by reply e-mail immediately. Opinions, conclusions and other information expressed in this message are not given or endorsed by Myriad Group AG unless otherwise indicated by an authorized representative independent of this message.

Re: Felix http service, whiteboard, DS and HttpContext

Posted by Ferry Huberts <ma...@hupie.com>.
have a look here:
https://github.com/osgi/osgi.enroute.blog/blob/master/OSGi-enRoute-blog.pdf?raw=true

On 08/11/13 17:31, Bruce Jackson wrote:
> Anyone have any ideas?
> 
> I guess the question is quite simple: how do you get a servlet component
> registered using DS pick up a HttpContext? In vanilla OSGi, I can do this
> quite simply in code, and using the whiteboard, I can do the same thing
> programatically, but how does this work using DS?
> 
> Thanks
> 
> Bruce
> 
> On 07/11/2013 11:46, "Bruce Jackson" <Br...@myriadgroup.com> wrote:
> 
>> Sorry, that was my error. In fact this does have an exposed interface for
>> Servlet (see below). The problem seems to be that (either) DS or
>> whiteboard don’t match the contextId required by the servlet with the
>> contentId property declared by the component that provides it. As soon as
>> the servlet has the property contentId set, then it no longer is
>> accessible (felix http generates a 404).
>>
>> Any ideas?
>>
>> Thanks
>>
>> Bruce
>>
>> <scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0"
>> name="TestServlet">
>>    <implementation class="com.myriadgroup.httptest.TestServlet"/>
>>    <reference cardinality="1..1"
>> interface="org.osgi.service.http.HttpService" name="HTTP"
>> policy="static"/>
>>    <reference cardinality="1..1"
>> interface="org.osgi.service.log.LogService" name="LOG" policy="static"/>
>>    <property name="contextId" type="String" value="foobar"/>
>>    <service>
>>       <provide interface="javax.servlet.Servlet"/>
>>    </service>
>>    <reference cardinality="1..1"
>> interface="org.osgi.service.http.HttpContext" name="HttpContext"
>> policy="static"/>
>>    <property name="alias" type="String" value="/test"/>
>> </scr:component>
>>
>>
>>
>> On 07/11/2013 07:36, "David Jencks" <da...@yahoo.com> wrote:
>>
>>> I think you may need to have TestServlet expose an interface for
>>> httpservice to find on the whiteboard, probably Servlet or HttpServlet.
>>> With your xml as shown, TestServlet does not register as a service at
>>> all.
>>>
>>> david jencks
>>>
>>> On Nov 6, 2013, at 9:19 PM, Chetan Mehrotra <ch...@gmail.com>
>>> wrote:
>>>
>>>>  From the component descriptors I see that you are mixing two approaches
>>>>
>>>> 1. TestServlet is obtaining a reference to HttpService and HttpContext
>>>> 2. TestServlet is being registered with properties required by
>>>> whiteboard i.e. alias and contextId
>>>>
>>>> Are you using httpService to programatically register the servlet? If
>>>> you just rely on whiteboard support then you need not use HttpService
>>>> or access HttpContext from within servlet. Instead you just need to
>>>> register your services with required properties i.e. alias and
>>>> contextId for Servlet and contextId for HttpContext and whiteboard
>>>> support would do the job of registering the servlet with proper
>>>> context
>>>> Chetan Mehrotra
>>>>
>>>>
>>>> On Wed, Nov 6, 2013 at 10:07 PM, Bruce Jackson
>>>> <Br...@myriadgroup.com> wrote:
>>>>> Hi All
>>>>>
>>>>> Does anyone use the Felix http service, DS and the whiteboard with a
>>>>> custom HttpContext?
>>>>> I can register a servlet with DS and the whiteboard, but it doesn¹t
>>>>> appear
>>>>> to hook into my custom HttpContext. I have the component.xml below for
>>>>> both the servlet and the HttpContext. Any pointers would be helpful.
>>>>>
>>>>> <scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0"
>>>>> name="TestServlet">
>>>>>    <implementation class="com.myriadgroup.httptest.TestServlet"/>
>>>>>    <reference bind="setHttp" cardinality="1..1"
>>>>> interface="org.osgi.service.http.HttpService" name="HTTP"
>>>>> policy="dynamic"
>>>>> unbind="unsetHttp"/>
>>>>>    <reference cardinality="1..1"
>>>>> interface="org.osgi.service.log.LogService" name="LOG"
>>>>> policy="static"/>
>>>>>    <property name="alias" type="String" value="/test"/>
>>>>>    <property name="contextId" type="String" value="foobar"/>
>>>>>    <reference cardinality="1..1"
>>>>> interface="org.osgi.service.http.HttpContext" name="HttpContext"
>>>>> policy="dynamic"/>
>>>>> </scr:component>
>>>>>
>>>>>
>>>>> <scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0"
>>>>> name="MyContext">
>>>>>    <implementation class="com.myriadgroup.httptest.MyContext"/>
>>>>>    <service>
>>>>>       <provide interface="org.osgi.service.http.HttpContext"/>
>>>>>    </service>
>>>>>    <property name="contextId" type="String" value="foobar"/>
>>>>> </scr:component>
>>>>>
>>>>>
>>>>> Best regards
>>>>>
>>>>> Bruce
>>>>>
>>>>> *** DISCLAIMER ***
>>>>>
>>>>> This message, including attachments, is intended solely for the
>>>>> addressee indicated in this message and is strictly confidential or
>>>>> otherwise privileged. If you are not the intended recipient (or
>>>>> responsible for delivery of the message to such person) : - (1) please
>>>>> immediately (i) notify the sender by reply email and (ii) delete this
>>>>> message and attachments, - (2) any use, copy or dissemination of this
>>>>> transmission is strictly prohibited. If you or your employer does not
>>>>> consent to Internet email messages of this kind, please advise Myriad
>>>>> Group AG by reply e-mail immediately. Opinions, conclusions and other
>>>>> information expressed in this message are not given or endorsed by
>>>>> Myriad Group AG unless otherwise indicated by an authorized
>>>>> representative independent of this message.
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>>>> For additional commands, e-mail: users-help@felix.apache.org
>>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>>> For additional commands, e-mail: users-help@felix.apache.org
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>> For additional commands, e-mail: users-help@felix.apache.org
>>>
>>
>> *** DISCLAIMER ***
>>
>> This message, including attachments, is intended solely for the addressee
>> indicated in this message and is strictly confidential or otherwise
>> privileged. If you are not the intended recipient (or responsible for
>> delivery of the message to such person) : - (1) please immediately (i)
>> notify the sender by reply email and (ii) delete this message and
>> attachments, - (2) any use, copy or dissemination of this transmission is
>> strictly prohibited. If you or your employer does not consent to Internet
>> email messages of this kind, please advise Myriad Group AG by reply
>> e-mail immediately. Opinions, conclusions and other information expressed
>> in this message are not given or endorsed by Myriad Group AG unless
>> otherwise indicated by an authorized representative independent of this
>> message.
>> ?B딮KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKCB*
>> ??[�?쒁�X셁??K[XZ[?�?\?�?[�?쒁�X셆?�[?^?�\?X?K�??‘�??Y??]?[?[??栢
>> [X[�???K[XZ[?�?\?�??[???�[?^?�\?X?K�??
> 
> *** DISCLAIMER ***
> 
> This message, including attachments, is intended solely for the addressee indicated in this message and is strictly confidential or otherwise privileged. If you are not the intended recipient (or responsible for delivery of the message to such person) : - (1) please immediately (i) notify the sender by reply email and (ii) delete this message and attachments, - (2) any use, copy or dissemination of this transmission is strictly prohibited. If you or your employer does not consent to Internet email messages of this kind, please advise Myriad Group AG by reply e-mail immediately. Opinions, conclusions and other information expressed in this message are not given or endorsed by Myriad Group AG unless otherwise indicated by an authorized representative independent of this message.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
> 

-- 
Ferry Huberts

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Felix http service, whiteboard, DS and HttpContext

Posted by Bruce Jackson <Br...@myriadgroup.com>.
Anyone have any ideas?

I guess the question is quite simple: how do you get a servlet component
registered using DS pick up a HttpContext? In vanilla OSGi, I can do this
quite simply in code, and using the whiteboard, I can do the same thing
programatically, but how does this work using DS?

Thanks

Bruce

On 07/11/2013 11:46, "Bruce Jackson" <Br...@myriadgroup.com> wrote:

>Sorry, that was my error. In fact this does have an exposed interface for
>Servlet (see below). The problem seems to be that (either) DS or
>whiteboard don��t match the contextId required by the servlet with the
>contentId property declared by the component that provides it. As soon as
>the servlet has the property contentId set, then it no longer is
>accessible (felix http generates a 404).
>
>Any ideas?
>
>Thanks
>
>Bruce
>
><scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0"
>name="TestServlet">
>   <implementation class="com.myriadgroup.httptest.TestServlet"/>
>   <reference cardinality="1..1"
>interface="org.osgi.service.http.HttpService" name="HTTP"
>policy="static"/>
>   <reference cardinality="1..1"
>interface="org.osgi.service.log.LogService" name="LOG" policy="static"/>
>   <property name="contextId" type="String" value="foobar"/>
>   <service>
>      <provide interface="javax.servlet.Servlet"/>
>   </service>
>   <reference cardinality="1..1"
>interface="org.osgi.service.http.HttpContext" name="HttpContext"
>policy="static"/>
>   <property name="alias" type="String" value="/test"/>
></scr:component>
>
>
>
>On 07/11/2013 07:36, "David Jencks" <da...@yahoo.com> wrote:
>
>>I think you may need to have TestServlet expose an interface for
>>httpservice to find on the whiteboard, probably Servlet or HttpServlet.
>>With your xml as shown, TestServlet does not register as a service at
>>all.
>>
>>david jencks
>>
>>On Nov 6, 2013, at 9:19 PM, Chetan Mehrotra <ch...@gmail.com>
>>wrote:
>>
>>> From the component descriptors I see that you are mixing two approaches
>>>
>>> 1. TestServlet is obtaining a reference to HttpService and HttpContext
>>> 2. TestServlet is being registered with properties required by
>>> whiteboard i.e. alias and contextId
>>>
>>> Are you using httpService to programatically register the servlet? If
>>> you just rely on whiteboard support then you need not use HttpService
>>> or access HttpContext from within servlet. Instead you just need to
>>> register your services with required properties i.e. alias and
>>> contextId for Servlet and contextId for HttpContext and whiteboard
>>> support would do the job of registering the servlet with proper
>>> context
>>> Chetan Mehrotra
>>>
>>>
>>> On Wed, Nov 6, 2013 at 10:07 PM, Bruce Jackson
>>> <Br...@myriadgroup.com> wrote:
>>>> Hi All
>>>>
>>>> Does anyone use the Felix http service, DS and the whiteboard with a
>>>> custom HttpContext?
>>>> I can register a servlet with DS and the whiteboard, but it doesn��t
>>>>appear
>>>> to hook into my custom HttpContext. I have the component.xml below for
>>>> both the servlet and the HttpContext. Any pointers would be helpful.
>>>>
>>>> <scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0"
>>>> name="TestServlet">
>>>>   <implementation class="com.myriadgroup.httptest.TestServlet"/>
>>>>   <reference bind="setHttp" cardinality="1..1"
>>>> interface="org.osgi.service.http.HttpService" name="HTTP"
>>>>policy="dynamic"
>>>> unbind="unsetHttp"/>
>>>>   <reference cardinality="1..1"
>>>> interface="org.osgi.service.log.LogService" name="LOG"
>>>>policy="static"/>
>>>>   <property name="alias" type="String" value="/test"/>
>>>>   <property name="contextId" type="String" value="foobar"/>
>>>>   <reference cardinality="1..1"
>>>> interface="org.osgi.service.http.HttpContext" name="HttpContext"
>>>> policy="dynamic"/>
>>>> </scr:component>
>>>>
>>>>
>>>> <scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0"
>>>> name="MyContext">
>>>>   <implementation class="com.myriadgroup.httptest.MyContext"/>
>>>>   <service>
>>>>      <provide interface="org.osgi.service.http.HttpContext"/>
>>>>   </service>
>>>>   <property name="contextId" type="String" value="foobar"/>
>>>> </scr:component>
>>>>
>>>>
>>>> Best regards
>>>>
>>>> Bruce
>>>>
>>>> *** DISCLAIMER ***
>>>>
>>>> This message, including attachments, is intended solely for the
>>>>addressee indicated in this message and is strictly confidential or
>>>>otherwise privileged. If you are not the intended recipient (or
>>>>responsible for delivery of the message to such person) : - (1) please
>>>>immediately (i) notify the sender by reply email and (ii) delete this
>>>>message and attachments, - (2) any use, copy or dissemination of this
>>>>transmission is strictly prohibited. If you or your employer does not
>>>>consent to Internet email messages of this kind, please advise Myriad
>>>>Group AG by reply e-mail immediately. Opinions, conclusions and other
>>>>information expressed in this message are not given or endorsed by
>>>>Myriad Group AG unless otherwise indicated by an authorized
>>>>representative independent of this message.
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>>> For additional commands, e-mail: users-help@felix.apache.org
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>> For additional commands, e-mail: users-help@felix.apache.org
>>>
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>For additional commands, e-mail: users-help@felix.apache.org
>>
>
>*** DISCLAIMER ***
>
>This message, including attachments, is intended solely for the addressee
>indicated in this message and is strictly confidential or otherwise
>privileged. If you are not the intended recipient (or responsible for
>delivery of the message to such person) : - (1) please immediately (i)
>notify the sender by reply email and (ii) delete this message and
>attachments, - (2) any use, copy or dissemination of this transmission is
>strictly prohibited. If you or your employer does not consent to Internet
>email messages of this kind, please advise Myriad Group AG by reply
>e-mail immediately. Opinions, conclusions and other information expressed
>in this message are not given or endorsed by Myriad Group AG unless
>otherwise indicated by an authorized representative independent of this
>message.
>?B�KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKCB*
>??[�?��ܚX�K??K[XZ[?�?\?�?[�?��ܚX�P?�[?^?�\?X?K�??���??Y??]?[?[??��
>[X[�???K[XZ[?�?\?�??[???�[?^?�\?X?K�??

*** DISCLAIMER ***

This message, including attachments, is intended solely for the addressee indicated in this message and is strictly confidential or otherwise privileged. If you are not the intended recipient (or responsible for delivery of the message to such person) : - (1) please immediately (i) notify the sender by reply email and (ii) delete this message and attachments, - (2) any use, copy or dissemination of this transmission is strictly prohibited. If you or your employer does not consent to Internet email messages of this kind, please advise Myriad Group AG by reply e-mail immediately. Opinions, conclusions and other information expressed in this message are not given or endorsed by Myriad Group AG unless otherwise indicated by an authorized representative independent of this message.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org

Re: Felix http service, whiteboard, DS and HttpContext

Posted by Bruce Jackson <Br...@myriadgroup.com>.
Sorry, that was my error. In fact this does have an exposed interface for
Servlet (see below). The problem seems to be that (either) DS or
whiteboard don’t match the contextId required by the servlet with the
contentId property declared by the component that provides it. As soon as
the servlet has the property contentId set, then it no longer is
accessible (felix http generates a 404).

Any ideas?

Thanks

Bruce

<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0"
name="TestServlet">
   <implementation class="com.myriadgroup.httptest.TestServlet"/>
   <reference cardinality="1..1"
interface="org.osgi.service.http.HttpService" name="HTTP" policy="static"/>
   <reference cardinality="1..1"
interface="org.osgi.service.log.LogService" name="LOG" policy="static"/>
   <property name="contextId" type="String" value="foobar"/>
   <service>
      <provide interface="javax.servlet.Servlet"/>
   </service>
   <reference cardinality="1..1"
interface="org.osgi.service.http.HttpContext" name="HttpContext"
policy="static"/>
   <property name="alias" type="String" value="/test"/>
</scr:component>



On 07/11/2013 07:36, "David Jencks" <da...@yahoo.com> wrote:

>I think you may need to have TestServlet expose an interface for
>httpservice to find on the whiteboard, probably Servlet or HttpServlet.
>With your xml as shown, TestServlet does not register as a service at all.
>
>david jencks
>
>On Nov 6, 2013, at 9:19 PM, Chetan Mehrotra <ch...@gmail.com>
>wrote:
>
>> From the component descriptors I see that you are mixing two approaches
>>
>> 1. TestServlet is obtaining a reference to HttpService and HttpContext
>> 2. TestServlet is being registered with properties required by
>> whiteboard i.e. alias and contextId
>>
>> Are you using httpService to programatically register the servlet? If
>> you just rely on whiteboard support then you need not use HttpService
>> or access HttpContext from within servlet. Instead you just need to
>> register your services with required properties i.e. alias and
>> contextId for Servlet and contextId for HttpContext and whiteboard
>> support would do the job of registering the servlet with proper
>> context
>> Chetan Mehrotra
>>
>>
>> On Wed, Nov 6, 2013 at 10:07 PM, Bruce Jackson
>> <Br...@myriadgroup.com> wrote:
>>> Hi All
>>>
>>> Does anyone use the Felix http service, DS and the whiteboard with a
>>> custom HttpContext?
>>> I can register a servlet with DS and the whiteboard, but it doesn¹t
>>>appear
>>> to hook into my custom HttpContext. I have the component.xml below for
>>> both the servlet and the HttpContext. Any pointers would be helpful.
>>>
>>> <scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0"
>>> name="TestServlet">
>>>   <implementation class="com.myriadgroup.httptest.TestServlet"/>
>>>   <reference bind="setHttp" cardinality="1..1"
>>> interface="org.osgi.service.http.HttpService" name="HTTP"
>>>policy="dynamic"
>>> unbind="unsetHttp"/>
>>>   <reference cardinality="1..1"
>>> interface="org.osgi.service.log.LogService" name="LOG"
>>>policy="static"/>
>>>   <property name="alias" type="String" value="/test"/>
>>>   <property name="contextId" type="String" value="foobar"/>
>>>   <reference cardinality="1..1"
>>> interface="org.osgi.service.http.HttpContext" name="HttpContext"
>>> policy="dynamic"/>
>>> </scr:component>
>>>
>>>
>>> <scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0"
>>> name="MyContext">
>>>   <implementation class="com.myriadgroup.httptest.MyContext"/>
>>>   <service>
>>>      <provide interface="org.osgi.service.http.HttpContext"/>
>>>   </service>
>>>   <property name="contextId" type="String" value="foobar"/>
>>> </scr:component>
>>>
>>>
>>> Best regards
>>>
>>> Bruce
>>>
>>> *** DISCLAIMER ***
>>>
>>> This message, including attachments, is intended solely for the
>>>addressee indicated in this message and is strictly confidential or
>>>otherwise privileged. If you are not the intended recipient (or
>>>responsible for delivery of the message to such person) : - (1) please
>>>immediately (i) notify the sender by reply email and (ii) delete this
>>>message and attachments, - (2) any use, copy or dissemination of this
>>>transmission is strictly prohibited. If you or your employer does not
>>>consent to Internet email messages of this kind, please advise Myriad
>>>Group AG by reply e-mail immediately. Opinions, conclusions and other
>>>information expressed in this message are not given or endorsed by
>>>Myriad Group AG unless otherwise indicated by an authorized
>>>representative independent of this message.
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>> For additional commands, e-mail: users-help@felix.apache.org
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>For additional commands, e-mail: users-help@felix.apache.org
>

*** DISCLAIMER ***

This message, including attachments, is intended solely for the addressee indicated in this message and is strictly confidential or otherwise privileged. If you are not the intended recipient (or responsible for delivery of the message to such person) : - (1) please immediately (i) notify the sender by reply email and (ii) delete this message and attachments, - (2) any use, copy or dissemination of this transmission is strictly prohibited. If you or your employer does not consent to Internet email messages of this kind, please advise Myriad Group AG by reply e-mail immediately. Opinions, conclusions and other information expressed in this message are not given or endorsed by Myriad Group AG unless otherwise indicated by an authorized representative independent of this message.

Re: Felix http service, whiteboard, DS and HttpContext

Posted by David Jencks <da...@yahoo.com>.
I think you may need to have TestServlet expose an interface for httpservice to find on the whiteboard, probably Servlet or HttpServlet.  With your xml as shown, TestServlet does not register as a service at all.

david jencks

On Nov 6, 2013, at 9:19 PM, Chetan Mehrotra <ch...@gmail.com> wrote:

> From the component descriptors I see that you are mixing two approaches
> 
> 1. TestServlet is obtaining a reference to HttpService and HttpContext
> 2. TestServlet is being registered with properties required by
> whiteboard i.e. alias and contextId
> 
> Are you using httpService to programatically register the servlet? If
> you just rely on whiteboard support then you need not use HttpService
> or access HttpContext from within servlet. Instead you just need to
> register your services with required properties i.e. alias and
> contextId for Servlet and contextId for HttpContext and whiteboard
> support would do the job of registering the servlet with proper
> context
> Chetan Mehrotra
> 
> 
> On Wed, Nov 6, 2013 at 10:07 PM, Bruce Jackson
> <Br...@myriadgroup.com> wrote:
>> Hi All
>> 
>> Does anyone use the Felix http service, DS and the whiteboard with a
>> custom HttpContext?
>> I can register a servlet with DS and the whiteboard, but it doesn¹t appear
>> to hook into my custom HttpContext. I have the component.xml below for
>> both the servlet and the HttpContext. Any pointers would be helpful.
>> 
>> <scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0"
>> name="TestServlet">
>>   <implementation class="com.myriadgroup.httptest.TestServlet"/>
>>   <reference bind="setHttp" cardinality="1..1"
>> interface="org.osgi.service.http.HttpService" name="HTTP" policy="dynamic"
>> unbind="unsetHttp"/>
>>   <reference cardinality="1..1"
>> interface="org.osgi.service.log.LogService" name="LOG" policy="static"/>
>>   <property name="alias" type="String" value="/test"/>
>>   <property name="contextId" type="String" value="foobar"/>
>>   <reference cardinality="1..1"
>> interface="org.osgi.service.http.HttpContext" name="HttpContext"
>> policy="dynamic"/>
>> </scr:component>
>> 
>> 
>> <scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0"
>> name="MyContext">
>>   <implementation class="com.myriadgroup.httptest.MyContext"/>
>>   <service>
>>      <provide interface="org.osgi.service.http.HttpContext"/>
>>   </service>
>>   <property name="contextId" type="String" value="foobar"/>
>> </scr:component>
>> 
>> 
>> Best regards
>> 
>> Bruce
>> 
>> *** DISCLAIMER ***
>> 
>> This message, including attachments, is intended solely for the addressee indicated in this message and is strictly confidential or otherwise privileged. If you are not the intended recipient (or responsible for delivery of the message to such person) : - (1) please immediately (i) notify the sender by reply email and (ii) delete this message and attachments, - (2) any use, copy or dissemination of this transmission is strictly prohibited. If you or your employer does not consent to Internet email messages of this kind, please advise Myriad Group AG by reply e-mail immediately. Opinions, conclusions and other information expressed in this message are not given or endorsed by Myriad Group AG unless otherwise indicated by an authorized representative independent of this message.
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Felix http service, whiteboard, DS and HttpContext

Posted by Chetan Mehrotra <ch...@gmail.com>.
>From the component descriptors I see that you are mixing two approaches

1. TestServlet is obtaining a reference to HttpService and HttpContext
2. TestServlet is being registered with properties required by
whiteboard i.e. alias and contextId

Are you using httpService to programatically register the servlet? If
you just rely on whiteboard support then you need not use HttpService
or access HttpContext from within servlet. Instead you just need to
register your services with required properties i.e. alias and
contextId for Servlet and contextId for HttpContext and whiteboard
support would do the job of registering the servlet with proper
context
Chetan Mehrotra


On Wed, Nov 6, 2013 at 10:07 PM, Bruce Jackson
<Br...@myriadgroup.com> wrote:
> Hi All
>
> Does anyone use the Felix http service, DS and the whiteboard with a
> custom HttpContext?
> I can register a servlet with DS and the whiteboard, but it doesn¹t appear
> to hook into my custom HttpContext. I have the component.xml below for
> both the servlet and the HttpContext. Any pointers would be helpful.
>
> <scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0"
> name="TestServlet">
>    <implementation class="com.myriadgroup.httptest.TestServlet"/>
>    <reference bind="setHttp" cardinality="1..1"
> interface="org.osgi.service.http.HttpService" name="HTTP" policy="dynamic"
> unbind="unsetHttp"/>
>    <reference cardinality="1..1"
> interface="org.osgi.service.log.LogService" name="LOG" policy="static"/>
>    <property name="alias" type="String" value="/test"/>
>    <property name="contextId" type="String" value="foobar"/>
>    <reference cardinality="1..1"
> interface="org.osgi.service.http.HttpContext" name="HttpContext"
> policy="dynamic"/>
> </scr:component>
>
>
> <scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0"
> name="MyContext">
>    <implementation class="com.myriadgroup.httptest.MyContext"/>
>    <service>
>       <provide interface="org.osgi.service.http.HttpContext"/>
>    </service>
>    <property name="contextId" type="String" value="foobar"/>
> </scr:component>
>
>
> Best regards
>
> Bruce
>
> *** DISCLAIMER ***
>
> This message, including attachments, is intended solely for the addressee indicated in this message and is strictly confidential or otherwise privileged. If you are not the intended recipient (or responsible for delivery of the message to such person) : - (1) please immediately (i) notify the sender by reply email and (ii) delete this message and attachments, - (2) any use, copy or dissemination of this transmission is strictly prohibited. If you or your employer does not consent to Internet email messages of this kind, please advise Myriad Group AG by reply e-mail immediately. Opinions, conclusions and other information expressed in this message are not given or endorsed by Myriad Group AG unless otherwise indicated by an authorized representative independent of this message.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org