AEM CSRF Issue / Forbidden POST Call in AEM

AEM CSRF Issue / Forbidden POST Call in AEM

AEM providing CSRF Protection from 6.0 version on wards. if you are using granite.jquery dependency it will automatically provide CSRF protection framework.

if you are not using cq provided jQuery you must add granite.csrf.standalone as dependency.


if you don't want use above client libs as dependency. you can pass 'CSRF-Token' as header property for async XHR request. Call to '/libs/granite/csrf/token.json' will give 'CSRF-Token' value.



Adobe Document 

CQ5/AEM Issue while reading multifield values using Node API

How to read multifield  using Node API

if you configure one item it will set String type to content node.

if you configure more than one items it will set as Sting[] type to component.

Below snippet code works for both String and String[] types
 
if(currentNode.hasProperty("multifieldProp")){
Value[] options = (currentNode.getProperty("multifieldProp").isMultiple()) ? currentNode.getProperty("multifieldProp").getValues() : null;
if (options == null) {//has single value
Value[] option = {currentNode.getProperty( "optionsConfig" ).getValue()};
options = option;
if ( options != null ) {
for(Value option : options){
System.out.println(option);
}
}
}