felix-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bruce Jackson <Bruce.Jack...@myriadgroup.com>
Subject Re: Felix http service, whiteboard, DS and HttpContext
Date Thu, 07 Nov 2013 11:46:40 GMT
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" <david_jencks@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 <chetan.mehrotra@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
>> <Bruce.Jackson@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.
Mime
View raw message