Apache Sling 在上传文件时给出访问被拒绝的错误
Apache Sling giving access denied error when uploading a file
通过下面的命令我创建了节点
curl -u admin:admin -F"sling:resourceType=fileu/script" -F"title=node for file upload" http://localhost:8080/fileu/mynode
通过下面的命令我添加了 resourceType
curl -X MKCOL -u admin:admin http://localhost:8080/apps/fileu
curl -X MKCOL -u admin:admin http://localhost:8080/apps/fileu/script
脚本即 JSP 页面是通过以下命令添加的
curl -u admin:admin -T fileu.script/html.jsp http://localhost:8080/apps/fileu/script/html.jsp
JSP 页面内的代码是:
<html>
<body>
<form method="POST" action="/fileu" enctype="multipart/form-data">
<input type="file" name="*" />
<input type="hidden" name="*@TypeHint" value="nt:file" />
<input type="Submit" />
</form>
</body>
</html>
我通过以下方式访问脚本URL
http://localhost:8080/fileu/mynode.html
当我在浏览器中上传文件时出现错误:
Error while processing /fileu
Status
500
Message
javax.jcr.AccessDeniedException: Access denied.
Location /fileu
Parent Location /
Path
/fileu
Referer http://localhost:8080/fileu/mynode.html
ChangeLog
<pre></pre>
这是什么问题?请帮忙。谢谢。
您当前的用户似乎是 'anonymous'。确保允许 'anonymous' 添加文件或节点。
通过下面的命令我创建了节点
curl -u admin:admin -F"sling:resourceType=fileu/script" -F"title=node for file upload" http://localhost:8080/fileu/mynode
通过下面的命令我添加了 resourceType
curl -X MKCOL -u admin:admin http://localhost:8080/apps/fileu
curl -X MKCOL -u admin:admin http://localhost:8080/apps/fileu/script
脚本即 JSP 页面是通过以下命令添加的
curl -u admin:admin -T fileu.script/html.jsp http://localhost:8080/apps/fileu/script/html.jsp
JSP 页面内的代码是:
<html>
<body>
<form method="POST" action="/fileu" enctype="multipart/form-data">
<input type="file" name="*" />
<input type="hidden" name="*@TypeHint" value="nt:file" />
<input type="Submit" />
</form>
</body>
</html>
我通过以下方式访问脚本URL
http://localhost:8080/fileu/mynode.html
当我在浏览器中上传文件时出现错误:
Error while processing /fileu
Status
500
Message
javax.jcr.AccessDeniedException: Access denied.
Location /fileu
Parent Location /
Path
/fileu
Referer http://localhost:8080/fileu/mynode.html
ChangeLog
<pre></pre>
这是什么问题?请帮忙。谢谢。
您当前的用户似乎是 'anonymous'。确保允许 'anonymous' 添加文件或节点。