ResourceFactory { public static IResource createLibraryResource(String resourcePath) { ResourceRuntimeContext ctx = ResourceRuntimeContext.ctx(); String type = ctx.getConfig().getRegistry().getResourceType(FileUtil.getExtension(resourcePath)); IResourceUrn urn = new ResourceUrn(type, ResourceManager.SHARED, resourcePath); return ResourceManager.INSTANCE.resolve(urn); }  static IAggregatedResource createAggregatedResource(List<IResource> resources); static IInlineResource createInlineResource(String type, String content); static IExternalResource createExternalResource(String type, String url); static IResource createLibraryResource(String resourcePath); static IResource createResource(IResourceUrn urn, URL url, IResourceLocale locale, IResourceLibrary library); static IResource createResource(String resourcePath); static IResource createResourceByEl(String el); static IResource createResource(String resourceType, String namespace, String resourcePath); static IResource createResource(String resourceType, String namespace, String resourcePath,
         Map<String, Object> arguments); static IResource createResource(URL url, String locale, IResourceLibrary libraryInfo); static IResource createWarResource(String resourcePath);  }
@Test public void testSharedResource() { IResource resource = ResourceFactory.createLibraryResource("/js/sample/sample1.js"); Assert.assertEquals("document.write('this is shared sample1.js<br>');", new String(resource.getOriginalContent())); Assert.assertEquals( "Resource [m_urn=js.shared:/js/sample/sample1.js, m_libInfo=ResourceLibrary [m_id=sharedlib, m_version=1.0.0, m_type=JAR]]", resource.toString()); }