Hi all, Could anyone give opinion on it ?
On Wed, 09 Mar 2011 10:27:15 +0900 Shigekuni Kondo <[email protected]> wrote: Shigekuni> Hi OSGi Experts Shigekuni> Shigekuni> Shigekuni> I would like to ask about HttpService behavior. Shigekuni> Let me assume the following example to explain my question. Shigekuni> Shigekuni> Shigekuni> <Condition> Shigekuni> HttpService bundle, BundleA and BundleB are running on Shigekuni> an OSGi framework. Shigekuni> Shigekuni> [BundleA] Shigekuni> It gets "Service B" registered by BundleB, and calls the sampleAPI() Shigekuni> method provided by ServiceB. Shigekuni> Shigekuni> BundleA is given the following Permission; Shigekuni> (org.osgi.framework.PackagePermission "org.osgi.framework" "import") Shigekuni> (org.osgi.framework.PackagePermission "sample" "import") Shigekuni> (org.osgi.framework.ServicePermission "sample.ServiceB" "get") Shigekuni> Shigekuni> [BundleB] Shigekuni> It registers ServiceB. Shigekuni> BundleB create SerlvetB instance and registers ServletB to Shigekuni> HttpService by HttpService#registerServlet() in that thread. Shigekuni> Shigekuni> When ServletB is accessed, the privileged operation which requires Shigekuni> the specific Permission(PermissionX) is executed. Shigekuni> Remark that there is no AccessController.doPrivileged() in ServletB's Shigekuni> implementation. Shigekuni> Shigekuni> BundleB is given the AllPermission. Shigekuni> Shigekuni> Shigekuni> <Question> Shigekuni> In the case, I can suppose following behavior. Shigekuni> >From the OSGi Spec point of view, Which is proper behavior? Shigekuni> Or is there other correct behavior? Shigekuni> Shigekuni> 1. PermissionX is required for Bundle A when the processing in ServletB Shigekuni> is executed, regardless of whether HttpContext object is default Shigekuni> or user defined. Shigekuni> 2. PermissionX is NOT required for Bundle A when the processing in ServletB Shigekuni> is executed, regardless of whether HttpContext object is default Shigekuni> or user defined. Shigekuni> 3. PermissionX is required for Bundle A when the processing in ServletB Shigekuni> is executed in case that HttpContext object is default HttpContext. Shigekuni> Shigekuni> My understanding is that '1' in above list is correct by checking OSGi Shigekuni> Service Compendium spec R4.2 section 102.8. Shigekuni> Shigekuni> Shigekuni> In addition, I implemented above bundles and checked the behavior of several Shigekuni> HttpService bundles which are released from Equinox, Felix and Knopflerfish, Shigekuni> respectivity. Shigekuni> Shigekuni> Result of Equinox: Shigekuni> Thrown RuntimeException in the registerServlet processing because Shigekuni> BundleA doesn't have RuntimePermission when Thread#getContextClassLoader() Shigekuni> is called. Shigekuni> Shigekuni> Result of Felix: Shigekuni> The behavior is '2' in above list. Shigekuni> Shigekuni> Result of Knopflerfish: Shigekuni> The behavior is '2' in above list. Shigekuni> Shigekuni> Shigekuni> Best Regards, Shigekuni> Shigekuni> Shigekuni Kondo Shigekuni> ---------------------------- Shigekuni> Shigekuni> Shigekuni> _____________________________________________ Shigekuni> Shigekuni> Shigekuni Kondo Shigekuni> Shigekuni> Promotion Project 1 Shigekuni> NTT Cyber Solutions Laboratories Shigekuni> NIPPON TELEGRAPH AND TELEPHONE CORPORATION Shigekuni> Shigekuni> 1-1 Hikarinooka Yokosuka Shigekuni> Kanagawa 239-0847 Japan Shigekuni> TEL:+81-46-859-3444 Shigekuni> FAX:+81-46-855-1282 Shigekuni> E-mail:[email protected] Shigekuni> _____________________________________________ Shigekuni> Shigekuni> Shigekuni> Shigekuni> _______________________________________________ Shigekuni> OSGi Developer Mail List Shigekuni> [email protected] Shigekuni> https://mail.osgi.org/mailman/listinfo/osgi-dev ======= Ikuo YAMASAKI _______________________________________________ OSGi Developer Mail List [email protected] https://mail.osgi.org/mailman/listinfo/osgi-dev
