gpt4 book ai didi

java - 为什么在 Google App Engine 中使用 HttpMethod.POST 而不是 HttpMethod.GET?

转载 作者:行者123 更新时间:2023-12-02 05:08:14 25 4
gpt4 key购买 nike

Udacity Developing Scalable Apps with Java course ,后端应用程序的一些 API 方法(概念上应该是 HttpMethod.GET )是使用 HttpMethod.POST 实现的。 .

在 Java 文档中可以找到以下注释:

/**
* Normally this kind of method is supposed to get invoked by a GET HTTP
* method, but we do it with POST, in order to receive conferenceQueryForm
* Object via the POST body.
*/

这是否意味着,即使通过 HTTPS 连接,如果我们使用 HttpMethod.GET,JSON 表单也会以明文形式发送(即未加密) ?

最佳答案

没有。这意味着该方法(无论它是什么)用于从服务器检索数据以响应客户端的请求。通常,当客户端只是请求某些内容时,它应该使用 HTTP GET。 HTTP POST 请求旨在将数据发送到服务器。

但是,在这种情况下,客户端想要向服务器发送一个(可能很大)对象(称为 conferenceQueryForm)来描述它想要的内容。使用 GET 请求可能太大或太麻烦,因此他们使用了 POST。

关于java - 为什么在 Google App Engine 中使用 HttpMethod.POST 而不是 HttpMethod.GET?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27574311/

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