任何人都可以告诉我正确的启动方式,配置以及吊索的CRUD操作.我按照下面的教程,但它不适用于CRUD.
http://sling.apache.org/documentation/getting-started/discover-sling-in-15-minutes.html
任何人都可以与Sling框架分享经验吗?
只允许有经验的人(谁曾与Sling合作过).
CRUD操作是通过HTTP请求完成的.我会用卷曲在我的例子,在一个节点上运行http://localhost:8080/content/mynode,因为这就是在使用您已经阅读教程.
ç reate:要创建的内容,你做一个HTTP POST请求.在本教程中,使用以下示例:
curl -u admin:admin -F"sling:resourceType=foo/bar" -F"title=some title" http://localhost:8080/content/mynode
Run Code Online (Sandbox Code Playgroud)
这将http://localhost:8080/content/mynode使用单个property title= 创建新内容some title
R ead:简单地向内容节点发出GET请求:
curl http://localhost:8080/content/mynode
Run Code Online (Sandbox Code Playgroud)
...甚至更简单,使用您的网络浏览器并导航到 http://localhost:8080/content/mynode
U pdate:您还可以使用POST请求进行更新,例如:
curl -u admin:admin -F"sling:resourceType=foo/bar" -F"title=some other title" http://localhost:8080/content/mynode
Run Code Online (Sandbox Code Playgroud)
这会将已存在的内容节点的标题设置为some other title.您还可以添加新属性:
curl -u admin:admin -F"sling:resourceType=foo/bar" -F"myProperty=my value" http://localhost:8080/content/mynode
Run Code Online (Sandbox Code Playgroud)
...添加属性myProperty和值my value.
D elete:您通过发送HTTP DELETE请求删除内容节点:
curl -u admin:admin -X DELETE http://localhost:8080/content/mynode
Run Code Online (Sandbox Code Playgroud)
有关您可以执行的所有操作,请参阅Apache Sling:操作内容 - SlingPostServlet
| 归档时间: |
|
| 查看次数: |
443 次 |
| 最近记录: |