我已经创建并部署了一个包(Servlet的)成功接受来自用户的用户名和密码,现在我想将它保存在JCR库在/内容/ MYDATA /我得到异常
java.lang.IllegalArgumentException: relPath is not a relative path: {} {}oliver
这里是我的代码
public class CustomerJCRAccessImp implements CustomerService {
@Reference
protected SlingRepository repository;
protected static final Logger log = LoggerFactory.getLogger(CustomerJCRAccessImp.class);
public void insertData(String username, String password) throws Exception {
log.error("Username ::"+username+" Password ::"+password);
log.error("XXX:: Inside the Service Method");
Session session= repository.loginAdministrative(null);
Node node= session.getRootNode();
Node contentNode = node.getNode("content");
//node.i
Node myAppNode = contentNode.getNode("myApp");
log.error("THE VALUE OF myApp NODE ::"+myAppNode);
Node user = myAppNode.addNode("/"+username);
user.setProperty("Roll No", "1");
user.setProperty("Age", "10");
user.setPrimaryType("nt:unstructured");
session.save();
session.logout();
}
protected void bindRepository(SlingRepository repository) {
this.repository = repository;
}
}
我已经通过参考这个链接来实现这个http://helpx.adobe.com/experience-manager/using/persisting-cq-data-java-content.html在此先感谢。