/** * Undeploy. */ public void undeploy() { if (deployed) { deployed = false; manager.undeploy(this); } }
/** * <p>Returns the URL of an asset located in the assets package of the application.</p> * * <p>If the controller is not under the scope of a request, null is returned.</p> * * @param path the path * @return the asset url * @throws NullPointerException when the path argument is null */ public String byPath(String path) throws NullPointerException { return AssetServer.renderAssetURLByPath(AssetLocation.APPLICATION, path); }
public AssetNode(String id, String type, AssetLocation location, String value, Boolean header, String minified, Integer maxAge, URL resource, Set<String> iDependOn) { // this.id = id; this.location = location; this.value = value; this.header = header; this.minified = minified; this.asset = new Asset(id, type, header, location, value, minified, maxAge); this.resource = resource; this.iDependOn = iDependOn; }
@Test public void testCycle2() { AssetManager mgr = new AssetManager("", ResourceResolver.NULL_RESOLVER); assertTrue(mgr.createDeployment().addAsset("foo", "script", AssetLocation.APPLICATION, "foo.js", null, null, null, DUMMY_URL, "bar").deploy()); assertTrue(mgr.createDeployment().addAsset("bar", "script", AssetLocation.APPLICATION, "bar.js", null, null, null, DUMMY_URL, "juu").deploy()); assertFalse(mgr.createDeployment().addAsset("juu", "script", AssetLocation.APPLICATION, "juu.js", null, null, null, DUMMY_URL, "foo").deploy()); }
@Override public void init() throws ServletException { AssetServer server = (AssetServer)getServletContext().getAttribute("asset.server"); if (server == null) { server = new AssetServer(); getServletContext().setAttribute("asset.server", server); } }
/** * Attempt to deploy. * * @return if the deployment was succesfully deployed */ public boolean deploy() { return deployed = manager.deploy(this); }
/** * Generate an asset URL from the specified id. * * @param id the asset id * @return null if the asset id does not exists * @throws NullPointerException if the asset id is null */ public String byId(String id) throws NullPointerException { return AssetServer.renderAssetURLById(id); }
public AssetDeployment createDeployment() { return new AssetDeployment(this); }
@Test public void testCycle1() { AssetManager mgr = new AssetManager("", ResourceResolver.NULL_RESOLVER); assertTrue(mgr.createDeployment().addAsset("foo", "script", AssetLocation.APPLICATION, "foo.js", null, null, null, DUMMY_URL, "bar").deploy()); assertFalse(mgr.createDeployment().addAsset("bar", "script", AssetLocation.APPLICATION, "bar.js", null, null, null, DUMMY_URL, "foo").deploy()); }
@Override public void init() throws ServletException { AssetServer server = (AssetServer)getServletContext().getAttribute("asset.server"); if (server == null) { server = new AssetServer(); getServletContext().setAttribute("asset.server", server); } }
/** * <p>Returns the URL of an asset located in the assets package of the application.</p> * * <p>If the controller is not under the scope of a request, null is returned.</p> * * @param path the path * @return the asset url * @throws NullPointerException when the path argument is null */ public String byPath(String path) throws NullPointerException { return AssetServer.renderAssetURLByPath(AssetLocation.APPLICATION, path); }
/** * Undeploy. */ public void undeploy() { if (deployed) { deployed = false; manager.undeploy(this); } }
public AssetNode(String id, String type, AssetLocation location, String value, Boolean header, String minified, Integer maxAge, URL resource, Set<String> iDependOn) { // this.id = id; this.location = location; this.value = value; this.header = header; this.minified = minified; this.asset = new Asset(id, type, header, location, value, minified, maxAge); this.resource = resource; this.iDependOn = iDependOn; }
/** * Attempt to deploy. * * @return if the deployment was succesfully deployed */ public boolean deploy() { return deployed = manager.deploy(this); }
/** * Generate an asset URL from the specified id. * * @param id the asset id * @return null if the asset id does not exists * @throws NullPointerException if the asset id is null */ public String byId(String id) throws NullPointerException { return AssetServer.renderAssetURLById(id); }
public AssetDeployment createDeployment() { return new AssetDeployment(this); }
@Test public void testCycle2() { AssetManager mgr = new AssetManager("", ResourceResolver.NULL_RESOLVER); assertTrue(mgr.createDeployment().addAsset("foo", "script", AssetLocation.APPLICATION, "foo.js", null, null, null, DUMMY_URL, "bar").deploy()); assertTrue(mgr.createDeployment().addAsset("bar", "script", AssetLocation.APPLICATION, "bar.js", null, null, null, DUMMY_URL, "juu").deploy()); assertFalse(mgr.createDeployment().addAsset("juu", "script", AssetLocation.APPLICATION, "juu.js", null, null, null, DUMMY_URL, "foo").deploy()); }
/** * <p>Returns the URL of an asset.</p> * * <p>If the controller is not under the scope of a request, null is returned.</p> * * @param location the asset location * @param uri the asset uri * @return the asset url * @throws NullPointerException when the path argument is null */ public String byPath(AssetLocation location, String uri) throws NullPointerException { return AssetServer.renderAssetURLByPath(location, uri); } }
@Test public void testCycle1() { AssetManager mgr = new AssetManager("", ResourceResolver.NULL_RESOLVER); assertTrue(mgr.createDeployment().addAsset("foo", "script", AssetLocation.APPLICATION, "foo.js", null, null, null, DUMMY_URL, "bar").deploy()); assertFalse(mgr.createDeployment().addAsset("bar", "script", AssetLocation.APPLICATION, "bar.js", null, null, null, DUMMY_URL, "foo").deploy()); }
/** * <p>Returns the URL of an asset.</p> * * <p>If the controller is not under the scope of a request, null is returned.</p> * * @param location the asset location * @param uri the asset uri * @return the asset url * @throws NullPointerException when the path argument is null */ public String byPath(AssetLocation location, String uri) throws NullPointerException { return AssetServer.renderAssetURLByPath(location, uri); } }