RestEasy ClientRequest followRedirect 在 POST 上的行为
据我所知,从安全的角度来看,处理新资源创建的正确方法是 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
该 API 已专门实现为不会自动遵循重定向。
The API has been specifically implemented to not automatically follow redirects.