Uploading image from Tomcat to Dam
Hi I am trying to upload an image from tomcat to AEM 6.3 DAM. But seems createAsset method of package com.adobe.granite.asset.api.AssetManager is not working as expected. Could anyone please help me as I am able to upload the image if I am using method from com.day.cq.dam.api.AssetManager pthis package.
My code below
HttpURLConnection con = null;
AssetManager assetManager = resolver.adaptTo(AssetManager.class);
URL urlObj = new URL(assetUrl);
con = (HttpURLConnection) urlObj.openConnection();
con.setRequestMethod("GET");
InputStream is = con.getInputStream();
Asset asset = assetManager.createAsset(path);
Map<String, Object> map = new HashMap<>();
map.put(RenditionHandler.PROPERTY_RENDITION_MIME_TYPE, "image/jpeg");
asset.setRendition("original", is, map);
Method Call :-
.downloadAndSaveAsset(resolver, "http://localhost:8080/images/new1.jpg",
"/content/dam/new-folder/new1.jpg");