简体   繁体   English

使用java连接到站点和POST,HTTP状态代码200

[英]Using java to connect to a site and POST, HTTP Status Code 200

I am using java to connect to a website which has a form of type "multipart/form-data". 我使用java连接到一个网站,其形式为“multipart / form-data”。 It asks a user, pass, and file to upload. 它要求用户,传递和文件上传。

When i run my java project, the response i get is "200". 当我运行我的java项目时,我得到的响应是“200”。 According to w3.org, anything in the 2xx class of HTTP responses indicates that "the client's request was successfully received, understood, and accepted." 根据w3.org,2xx类HTTP响应中的任何内容都表明“客户端的请求已成功接收,理解和接受”。

My question is, if this is the response code i get, can i assume that the file was DEFINITELY uploaded to the site, and that there was no error? 我的问题是,如果这是我得到的响应代码,我可以假设该文件是完全上传到网站,并且没有错误? To put it in other wording, is the code "200" a guarantee that the file i sent is on the server, or is it just indicating that my POST request was understood? 换句话说,代码“200”是我发送的文件在服务器上的保证,还是只是表明我的POST请求被理解了?

Thank you! 谢谢!

The HTTP status code 200 states that HTTP状态代码200表明了这一点

The request has succeeded.

The server is therefore telling you that the request you made was successful. 因此,服务器会告诉您所做的请求是成功的。 However, this doesn't tell you anything about what the web application did. 但是,这并不能告诉您Web应用程序的功能。 It's up to the web application itself to tell you, possibly as part of the HTTP response. Web应用程序本身可以告诉您,可能是HTTP响应的一部分。

You should check the web application API or specification and interpret the HTTP response accordingly. 您应该检查Web应用程序API或规范并相应地解释HTTP响应。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 HTTP 500错误失败,并显示200状态代码 - HTTP 500 error failed with 200 status code 使用java中的代理代码连接到站点 - Connect to a site using proxy code in java 使用CXF从Java消耗Web服务会导致com.sun.xml.ws.client.ClientTransportException:服务器发送了HTTP状态代码200:确定 - Consuming webservice from java using CXF results in com.sun.xml.ws.client.ClientTransportException: The server sent HTTP status code 200: OK 使用ETag但状态代码始终为200而不是304 - using ETag but the status code is always 200 and not 304 HTTP 状态代码总是从 HttpServletResponse 返回 200 - HTTP status code always returning 200 from HttpServletResponse 手动停止服务器时,WebClientResponseException 返回 200 HTTP 状态代码 - WebClientResponseException returns with 200 HTTP Status Code when the server is stopped manually Restlet获取HTTP状态代码204而不是200 - Restlet Getting HTTP Status code 204 instead of 200 带有正文的 RestAssured Post 调用会引发错误“java.lang.AssertionError:1 期望失败。 预期状态代码 &lt;200&gt; 但为 &lt;415&gt;。” - RestAssured Post call with body throws an error “java.lang.AssertionError: 1 expectation failed. Expected status code <200> but was <415>.” Jetty 在使用 http2 时响应状态 200 而不是 304 - Jetty respond with status 200 instead of 304 while using http2 使用Java RestAssured创建POST请求,返回状态码422 - Create POST request, using Java RestAssured, returns status code 422
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM