如何在Java HttpsURLConnection中增加头大小限制?
正在尝试通过url post请求连接到web服务
String SIGNATURE = "signature"; //(This data is huge)
String url = "someUrl";
URL obj = new URL(url);
HttpsURLConnection con = (HttpsURLConnection) obj.openConnection();
//add reuqest header
con.setRequestMethod("POST");
con.setRequestProperty("Accept-Language", "en-US,en;q=0.5");
con.setRequestProperty("PS-Sign",SIGNATURE);
// Send post request
con.setDoOutput(true);
DataOutputStream wr = new DataOutputStream(con.getOutputStream());
wr.flush();
wr.close();
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
//print result
System.out.println(response.toString());
getInputStream()
引发异常:服务器为URL返回了HTTP响应代码400:
我知道返回400可能有多种原因,但在这种情况下,我100%知道这是由“签名”标题引起的。字符是可以的,它的大小导致错误的请求
如何增加尺寸限制
共 (0) 个答案