While using the below code to get the asset path getting null pointer . Can anybody help me is there any other way to get the asset path?
public class ExamplePostProcessor implements SlingPostProcessor {
@Override
public void process(final SlingHttpServletRequest request, final List<Modification> modifications){
try {
final String assetPath = request.getRequestURI();// this method not giving the required assetPath.It is giving content/dam.html
final Resource rr = request.getResourceResolver().getResource(assetPath);
.......
}
}
Requirement is onclick of save&close button in metada editor it should save all the metadat in a external DB.
Solved! Go to Solution.
Views
Replies
Total Likes
You can develop a sling servlet where you can write your logic connect to External DB.
one of the way is, you can create a clinet lib with categories as "dam.gui.coral.propertieseditor" and
in java script you can write the below click event
$('.granite-form-saveactivator' ).on( "click", trigger);
function trigger(){
// You can make ajax call to your servlet by passing the data. or you can pass the asset url to your servlet, from servlet you can read metadata values and pass to DB.
}
Thansk,
Siva
Thanks,
Siva
You can develop a sling servlet where you can write your logic connect to External DB.
one of the way is, you can create a clinet lib with categories as "dam.gui.coral.propertieseditor" and
in java script you can write the below click event
$('.granite-form-saveactivator' ).on( "click", trigger);
function trigger(){
// You can make ajax call to your servlet by passing the data. or you can pass the asset url to your servlet, from servlet you can read metadata values and pass to DB.
}
Thansk,
Siva
Thanks,
Siva
@SivakumarKanoori Thanks a lot this approach working as expected.
In my opinion, you should rather capture Asset update event and create sling jobs to push data to external DB.
By executing it from frontend, we might loose data in case of unavailability of services. Tracking such discrepancies in long term will be an additional task.
Views
Likes
Replies