Java Http POST with basic authorization and redirect
问题 The program does a http post with basic authorization just fine but when the post is complete the page is redirected to a success page. The redirect failes due to 401 authorization failed. final URLConnection conn = url.openConnection(); conn.setDoOutput(true); conn.setRequestProperty("Authorization", "basic " +base64); wr = new OutputStreamWriter(conn.getOutputStream()); wr.write(data); wr.flush(); rd = new BufferedReader(new InputStreamReader(conn.getInputStream())); The line rd = new