简体   繁体   English

嵌入式Jetty服务器中的POST中的GET参数分开

[英]Separate GET parameters from POST in embedded Jetty server

I need to know wheather the parameter is GET or POST but in handle method request.getParameter(name) gives me all parameters. 我需要知道该参数是GET还是POST,但是在handle方法request.getParameter(name)提供了所有参数。 Is it possible to do something like request.getGETParameter(name) and request.getPOSTParameter(name) or do I have to parse raw data myself? 是否可以执行诸如request.getGETParameter(name)request.getPOSTParameter(name)事情,还是我必须自己解析原始数据?

There is no such thing as GET parameters and POST parameters. 没有诸如GET参数和POST参数这样的东西。 GET and POST are methods of HTTP request. GET和POST是HTTP请求的方法。 You can find out which method your request is by calling 您可以通过调用来确定您的请求是哪种方法

public String getMethod();

on your request. 根据您的要求。 You might also want to take a look on the description of HTTP protocol http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol The difference between parameters being sent in GET in and POST method is that in GET request parameters are sent in query string, and in POST request these are sent in request body. 您可能还想看一下HTTP协议的描述http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol在GET in和POST方法中发送的参数之间的区别在于,GET请求中的参数以查询字符串的形式发送,并且在POST请求中将这些发送到请求正文中。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM