コード例 #1
0
 @Override
 public void setUp() throws Exception {
   super.setUp();
   deployContrib(CORE_BUNDLE, "OSGI-INF/SecurityService.xml");
   deployContrib(CORE_BUNDLE, "OSGI-INF/permissions-contrib.xml");
   deployContrib(CORE_BUNDLE, "OSGI-INF/security-policy-contrib.xml");
   service = Framework.getService(SecurityPolicyService.class);
   assertNotNull(service);
 }
コード例 #2
0
ファイル: WebRoot.java プロジェクト: eclipse/apricot
 @GET
 @Path("skin/{path:.*}")
 public Response getSkinResource(@PathParam("path") String path) throws IOException {
   URL url = getApplication().resolve("resources/" + path);
   String mimeType = null;
   if (url != null) {
     URLConnection conn = url.openConnection();
     int x = url.getPath().lastIndexOf('.');
     if (x > -1) {
       mimeType =
           Framework.getLocalService(WebFramework.class).getMimeType(url.getPath(), "text/plain");
     }
     ResponseBuilder resp = Response.ok(conn);
     addCacheHeaders(resp, conn, path);
     resp.type(mimeType);
     return resp.build();
   }
   return Response.status(404).build();
 }