对于 @GET 操作,使用 @QueryParam 或 @FormParam [英] For a @GET operation which one to use @QueryParam or @FormParam
本文介绍了对于 @GET 操作,使用 @QueryParam 或 @FormParam的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在开发服务器端应用程序(不是客户端).我有一个列表操作,我使用 @GET
并将参数作为 @QueryParam
传递.我应该使用 @FormParam
吗?对开发客户端有帮助吗?
I am developing a server side application (not client). I have a list operation where I am using @GET
and I am passing the parameters as @QueryParam
. Should I use @FormParam
? Will it be helpful while developing the client?
推荐答案
@FormParam
注释将期望参数位于由 HTML form<发送的请求正文中/code> 提交.
The @FormParam
annotation will expect the parameter to be in the body of the request as sent by an HTML form
submit.
HTTP GET 不应该使用请求正文.所以,继续使用 @QueryParam
作为 @GET
.
An HTTP GET should not use a request body. So, keep using @QueryParam
for @GET
.
另见:
这篇关于对于 @GET 操作,使用 @QueryParam 或 @FormParam的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文