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]

Reply via email to