简体   繁体   English

如何在Spring中提取URL编码字符串中的参数

[英]How to extract parameters in URL Encoded String in Spring

How do I extract the parameters from a String that is URL Encoded?. 如何从URL编码的字符串中提取参数?

Given I have the ff. 鉴于我有ff。 that I have already extracted and decrypted from a request. 我已经从请求中提取并解密了。

Param1=Value1&Param2=Value2&Param3=Value3

I want to be able to get individual parameters such that I could selective get parameters values like Param1 = Value1 Param3 = Value3 我希望能够获取单个参数,以便可以有选择地获取参数值,例如Param1 = Value1 Param3 = Value3

And not get Param2 而不是获得Param2

The same question was already asked for Android here 对于Android ,已经问过相同的问题

But the library could not be imported in Spring. 但是该库无法在Spring中导入。 Any other library in spring that could do this functionality?. 春天是否有其他库可以执行此功能? TIA. TIA。

You simply need to specify this attributes in parameters method, for example: 您只需要在参数方法中指定此属性,例如:

@GetMapping("/teste")
public List<String> myMethod(String Param1, String Param2, String Param3) {
  ...
}

Good luck!!! 祝好运!!!

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

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