Hi OSGi Experts

I would like to ask about HttpService behavior.
Let me assume the following example to explain my question.


<Condition>
HttpService bundle, BundleA and BundleB are running on 
an OSGi framework.

[BundleA]
It gets "Service B" registered by BundleB, and calls the sampleAPI()
method provided by ServiceB.

BundleA is given the following Permission;
(org.osgi.framework.PackagePermission "org.osgi.framework" "import")
(org.osgi.framework.PackagePermission "sample" "import")
(org.osgi.framework.ServicePermission "sample.ServiceB" "get")

[BundleB]
It registers ServiceB.
BundleB create SerlvetB instance and registers ServletB to 
HttpService by HttpService#registerServlet() in that thread. 

When ServletB is accessed, the privileged operation which requires
the specific Permission(PermissionX) is executed. 
Remark that there is no AccessController.doPrivileged() in ServletB's 
implementation.

BundleB is given the AllPermission.


<Question>
In the case, I can suppose following behavior.
>From the OSGi Spec point of view, Which is proper behavior? 
Or is there other correct behavior?

1. PermissionX is required for Bundle A when the processing in ServletB
   is executed, regardless of whether HttpContext object is default
   or user defined.
2. PermissionX is NOT required for Bundle A when the processing in ServletB
   is executed, regardless of whether HttpContext object is default
   or user defined.
3. PermissionX is required for Bundle A when the processing in ServletB
   is executed in case that HttpContext object is default HttpContext.

My understanding is that '1' in above list is correct by checking OSGi 
Service Compendium spec R4.2 section 102.8.


In addition, I implemented above bundles and checked the behavior of several
HttpService bundles which are released from Equinox, Felix and Knopflerfish,
respectivity.

Result of Equinox:
Thrown RuntimeException in the registerServlet processing because
BundleA doesn't have RuntimePermission when Thread#getContextClassLoader()
is called.

Result of Felix:
The behavior is '2' in above list.

Result of Knopflerfish:
The behavior is '2' in above list.


Best Regards,

Shigekuni Kondo
----------------------------


_____________________________________________

  Shigekuni Kondo

  Promotion Project 1
  NTT Cyber Solutions Laboratories
  NIPPON TELEGRAPH AND TELEPHONE CORPORATION

  1-1 Hikarinooka Yokosuka
  Kanagawa 239-0847 Japan
  TEL:+81-46-859-3444
  FAX:+81-46-855-1282
  E-mail:[email protected]
_____________________________________________



_______________________________________________
OSGi Developer Mail List
[email protected]
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to