我有时含糊不清地听到了
Apache Sling比Spring-mvc更多REST
来自我的同事们.
我没有机会从他们那里了解它.我对Spring-mvc有足够的经验,我是Apache Sling的新手.
任何人都可以解释上述引用吗?
PS
我想查看这些产品的非REST功能列表.
例如:
Spring-mvc
允许使用会话属性,它与REST原则相矛盾 - 无状态.
我有一个String,它是页面的路径,例如/content/xperia/public/events/eventeditor
.我正在创建此页面的XML并将其保存到DAM,但我想将其保存在类似的树结构下/content
.
我尝试了以下代码
String page = "/content/xperia/public/events/eventeditor";
page = page.replace("/content", "/content/dam");
if (adminSession.nodeExists(page+ "/"+ "jcr:content")) {
Node node = adminSession.getNode(page+ "/"+ "jcr:content");
node.setProperty("jcr:data", sb.toString());
} else {
Node feedNode = JcrUtil.createPath(page,"nt:file", adminSession);
Node dataNode = JcrUtil.createPath(feedNode.getPath() + "/"+ "jcr:content", "nt:resource", adminSession);
dataNode.setProperty("jcr:data",sb.toString());
}
Run Code Online (Sandbox Code Playgroud)
但它给出了以下错误
找不到{ http://www.jcp.org/jcr/1.0 }内容的匹配子节点定义
因为存储库中没有这样的路径.有没有办法可以动态创建目录.由于保存此文件,我需要建立整个树xperia/public/events
底下/content/dam
,然后保存eventeditor.xml
在该目录中.
请建议.
我是AdobeCQ5的新手.我在发布表格时遇到一些麻烦.这是我的结构 -
/apps/<myproject>/components/mytestcomponent
Run Code Online (Sandbox Code Playgroud)
mytestcomopnent.jsp有以下代码 -
<form id="myForm" action="<%=resource.getPath()+".html" %>">
<input type="text" id="t1" class="input-small" placeholder="Temprature F" />
<input type="text" id="t2" class="input-small" placeholder="Temprature C" readonly/>
<button type="button" id="cbtn" class="btn">Convert</button>
</form>
<script>
$(document).ready(function() {
$('#cbtn').click(function () {
var URL = $("#myForm").attr("action");
alert(URL);
var t1=$("#t1").val();
var t2=$("#t2").val();
$.ajax({
url: URL,
data:{'t1':t1},
type:"post",
success: function(data, status) {
$("#t2").val(data);
},
error: function( xhr, txtStat, errThrown ) {
alert("ajax error! " + txtStat + ":::" + errThrown);
}
});
});
});
</script>
Run Code Online (Sandbox Code Playgroud)
这是我的响应代码200(成功),但不需要输出.我的mycomponent.POST.jsp有以下代码 -
<%
// TODO …
Run Code Online (Sandbox Code Playgroud)