gpt4 book ai didi

java - RestEasy GET 方法接受 HEAD 请求

转载 作者:行者123 更新时间:2023-12-01 23:31:09 24 4
gpt4 key购买 nike

我已经用 @GET 注释了 merhod。但是当出现HEAD请求时,就用这个方法处理。在方法主体中,我从 HttpRequest 对象获取请求类型 HEAD。为什么 GET 方法响应 HEAD 请求?

最佳答案

[...] By default the JAX-RS runtime will automatically support the methods HEAD and OPTIONS, if not explicitly implemented. For HEAD the runtime will invoke the implemented GET method (if present) and ignore the response entity (if set) [...]

这就是您所看到的行为的原因。

https://jersey.github.io/documentation/latest/jaxrs-resources.html#d0e2129

关于java - RestEasy GET 方法接受 HEAD 请求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19254220/

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