several requests from one HttpURLConnection
问题 How can I do several request in one HttpURLConnection with 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 Thanks. 回答1: From the Javadoc