On Wed, Dec 5, 2012 at 3:27 PM, Felix Meschberger <[email protected]>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: [email protected]
> For additional commands, e-mail: [email protected]
>
>