来自一个 HttpURLConnection 的多个请求
2022-09-03 06:27:48
我如何在一个HttpURL中使用Java进行多个请求连接?
URL url = new URL("http://my.com");
HttpURLConnection connection = (HttpURLConnection)url.openConnection();
HttpURLConnection.setFollowRedirects( true );
connection.setDoOutput( true );
connection.setRequestMethod("GET");
PrintStream ps = new PrintStream( connection.getOutputStream() );
ps.print(params);
ps.close();
connection.connect();
//TODO: do next request with other url, but in same connection
谢谢。