RestEasy ClientRequest followRedirect 在 POST 上的行为

发布于 2024-09-16 16:07:14 字数 250 浏览 2 评论 0原文

据我所知,从安全的角度来看,处理新资源创建的正确方法是 POST 请求,然后通过标头位置字段将客户端重定向到结果。

看来 ClientRequest 不支持这个。我无法让 ClientRequest 在帖子后自动遵循“查看其他”(303) 重定向。当 RestEasy 客户端框架创建 PostMethod 时,followRedirect 设置为 false,忽略 ClientRequest 上设置的 followRedirect。

还有别的办法吗?

To my knowledge the correct way, in a restful sense, to handle creation of a new resource is to POST the request and then redirect the client to the result via header location field.

It seems ClientRequest does not support this. I cannot get the ClientRequest to automatically follow the see other (303) redirect after a post. When a PostMethod is created by the RestEasy client framework followRedirect is set to false ignoring the followRedirect set on the ClientRequest.

Is there another way?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

哆兒滾 2024-09-23 16:07:14

该 API 已专门实现为不会自动遵循重定向。

The API has been specifically implemented to not automatically follow redirects.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文