Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

Send a get request with parameters and solve the httpclient coding problem

Shulou Source: shulou.com Published: 2022-06-03 04:34:27 11月25日 Update

Package cn.wemart.httppost

Import java.io.BufferedReader

Import java.io.IOException

Import java.io.InputStreamReader

Import java.io.UnsupportedEncodingException

Import java.net.URI

Import java.net.URISyntaxException

Import java.util.ArrayList

Import java.util.HashMap

Import java.util.List

Import java.util.Map

Import net.sf.json.JSONObject

Import org.apache.http.HttpEntity

Import org.apache.http.NameValuePair

Import org.apache.http.client.ClientProtocolException

Import org.apache.http.client.entity.UrlEncodedFormEntity

Import org.apache.http.client.methods.CloseableHttpResponse

Import org.apache.http.client.methods.HttpGet

Import org.apache.http.client.methods.HttpPost

Import org.apache.http.impl.client.CloseableHttpClient

Import org.apache.http.impl.client.HttpClients

Import org.apache.http.message.BasicNameValuePair

Import org.apache.http.protocol.HTTP

Import org.apache.http.util.EntityUtils

Import org.dom4j.DocumentException

Public class ExecuteGet {

/ * *

* Assembly request parameters

* @ param keyVlaueList

, /

Public static Map setPostPara (String [] keyVlaueList) throws DocumentException {

Map map = new HashMap ()

For (int I = 0 position I)

Tags: Character string parameter encoding interface format UTF-8 Chinese processing problem Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology Xiaomi MySQL Linux Microsoft