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 <[email protected]> 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" <[email protected]> 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" <[email protected]> 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 <[email protected]>
>>> 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
>>>> <[email protected]> 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: [email protected]
>>>>> For additional commands, e-mail: [email protected]
>>>>> 
>>>> 
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: [email protected]
>>>> For additional commands, e-mail: [email protected]
>>>> 
>>> 
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [email protected]
>>> For additional commands, e-mail: [email protected]
>>> 
>> 
>> *** 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: [email protected]
> For additional commands, e-mail: [email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to