Java Http协议后读

Java Http协议后读,java,http,post,Java,Http,Post,我正在尝试用java从POST读取数据。 我在registrationForm.html中有表单: <form action="registratrationResult.html" method="post"> Mail:<br> <input type="text" name="mail"> <br> Password:<br> <input type="password" name="password"&

我正在尝试用java从POST读取数据。 我在registrationForm.html中有表单:

<form action="registratrationResult.html" method="post">
  Mail:<br>
  <input type="text" name="mail">
  <br>
  Password:<br>
  <input type="password" name="password">
  <input type="submit">
</form>
我读到应该有这样的东西:

parameter=value&also=another
如何得到它?
当我更改输入数据时,内容长度正在更改。

正如您所说,实际的POST数据存储为键值对,但它们放在请求正文而不是标题中

使用cURL进行采样:

$ curl --data "fname=stackoverflow&lname=user" --trace - http://www.w3schools.com/tags/demo_form_method_post.asp
注意输出中的发送数据区域:

=> Send data, 30 bytes (0x1e)
0000: 66 6e 61 6d 65 3d 73 74 61 63 6b 6f 76 65 72 66 fname=stackoverf
0010: 6c 6f 77 26 6c 6e 61 6d 65 3d 75 73 65 72       low&lname=user
== Info: upload completely sent off: 30 out of 30 bytes

Post请求通常以
application/x-www-form-urlencoded
的内容类型发送,如发送头中所述。

是否可以用java读取?如何读取请求正文?我想看看如何获得POST响应的代码示例,它是在服务器端还是客户端?
=> Send data, 30 bytes (0x1e)
0000: 66 6e 61 6d 65 3d 73 74 61 63 6b 6f 76 65 72 66 fname=stackoverf
0010: 6c 6f 77 26 6c 6e 61 6d 65 3d 75 73 65 72       low&lname=user
== Info: upload completely sent off: 30 out of 30 bytes