gpt4 book ai didi

sling - Apache 吊索框架

转载 作者:行者123 更新时间:2023-12-04 05:59:57 28 4
gpt4 key购买 nike

任何人都可以告诉我正确的方法来启动、配置以及对 sling 进行 CRUD 操作。我遵循了下面的教程,但它不适用于 CRUD。

http://sling.apache.org/documentation/getting-started/discover-sling-in-15-minutes.html

任何人都可以分享使用 Sling 框架的经验吗?

只允许有经验的人(使用过 Sling 的人)。

最佳答案

CRUD 操作是通过 HTTP 请求完成的。我将使用 curl在我的示例中,在 http://localhost:8080/content/mynode 的节点上操作,因为这就是 the tutorial you have read 中使用的节点.

C创建:要创建内容,您需要执行 HTTP POST 请求。在本教程中使用了以下示例:

curl -u admin:admin -F"sling:resourceType=foo/bar" -F"title=some title" http://localhost:8080/content/mynode

这会在 http://localhost:8080/content/mynode 上创建新内容,具有一个属性 title=some title

R阅读:简单地向内容节点发送 GET 请求:

curl http://localhost:8080/content/mynode

... 或者更简单,使用您的网络浏览器并导航到 http://localhost:8080/content/mynode

U更新:您也可以使用 POST 请求进行更新,例如:

curl -u admin:admin -F"sling:resourceType=foo/bar" -F"title=some other title" http://localhost:8080/content/mynode

这会将现有内容节点的标题设置为其他一些标题。您还可以添加新属性:

curl -u admin:admin -F"sling:resourceType=foo/bar" -F"myProperty=my value" http://localhost:8080/content/mynode

... 添加属性 myProperty,值为 my value

Delete:您通过发送 HTTP DELETE 请求删除内容节点:

curl -u admin:admin -X DELETE http://localhost:8080/content/mynode

有关您可以执行的全部操作,请参阅 Apache Sling: Manipulating Content - The SlingPostServlet

关于sling - Apache 吊索框架,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27484902/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com