Java URL encoding of query string parameters

前端 未结 12 1020
清歌不尽
清歌不尽 2020-11-21 05:27

Say I have a URL

http://example.com/query?q=

and I have a query entered by the user such as:

random word £500 bank

12条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-21 06:16

    Apache Http Components library provides a neat option for building and encoding query params -

    With HttpComponents 4.x use - URLEncodedUtils

    For HttpClient 3.x use - EncodingUtil

提交回复
热议问题