felix-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Felix Meschberger <fmesc...@adobe.com>
Subject Re: Resource Accessing in Services: question about how HttpService works
Date Wed, 05 Dec 2012 15:37:15 GMT
Hi,

In the case of the Felix Http Service implementation, the Http Service is implemented as a
ServiceFactory. So each bundle will gets its own Http Service instance which knows about the
using bundle. So The default Http Context can access this bundle and read the resources.

Regards
Felix

Am 05.12.2012 um 16:02 schrieb Reto Bachmann-Gmür:

> On Wed, Dec 5, 2012 at 3:27 PM, Felix Meschberger <fmeschbe@adobe.com>wrote:
> 
>> Hi,
>> 
>> Am 05.12.2012 um 12:58 schrieb Reto Bachmann-Gmür:
>> 
>>> Hello,
>>> 
>>> When resources are registered via the registerResources of HttpService
>> the
>>> specified name is (IIUC) a path within theresources of the caller, i.e.
>>> what the caller would get invoking getClass().getResource(name). However
>>> the HttpService is a service exposed by another bundle, how can this
>> access
>>> the resources in the caller (or know from which bundle it was invoked
>> from)?
>> 
>> The Http Service does not access the resources. In stead it derives a
>> resource path from the request URL and the resource registration and calls
>> the getResource method of the HttpContext supplied with the resource
>> registration. Generally the HttpContext is created by the bundle
>> registering the resource and thus has access to its own resources.
>> 
> 
> If I invoke the service on the clerezza shell with:
> 
> zz>import org.osgi.service.http.HttpService
> zz>val s = $[HttpService]
> zz>s.registerResources("/test", "/META-INF", null);
> 
> at http://localhost:8080/test/MANIFEST.MF I get the manifest of the
> Clerezza Shell Service bundle. This bundle never created an HttpContext, it
> still looks magic to me how the webservers knows what to expose...
> 
> Cheers,
> Reto
> 
> 
>> 
>> Regards
>> Felix
>> ---------------------------------------------------------------------
>> 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


Mime
View raw message