Nicht in der Lage, durch den Proxy abzutunern. Proxy gibt "HTTP/1.1 407 Proxy -Autorisierung erforderlich" zurück "Java

Java-Forum
Anonymous
 Nicht in der Lage, durch den Proxy abzutunern. Proxy gibt "HTTP/1.1 407 Proxy -Autorisierung erforderlich" zurück "

Post by Anonymous »

Ich habe versucht, die HTTPS -URL für Google API zu klettern.DataInputStream di = null;

FileOutputStream fo = null;

byte[] b = new byte[1];

// PROXY
System.setProperty("https.proxyHost", "my proxy");
System.setProperty("https.proxyPort", "8080");

Authenticator.setDefault(new PasswordAuthenticator());

URL u = new URL("https://maps.googleapis.com/maps/api/pl ... =keyforuse");

HttpURLConnection con = (HttpURLConnection) u.openConnection();

sun.misc.BASE64Encoder encoder = new sun.misc.BASE64Encoder();
String encodedUserPwd = encoder.encode("domain\\user:password"
.getBytes());
con.setRequestProperty("Proxy-Authorization", "Basic "
+ encodedUserPwd);

di = new DataInputStream(con.getInputStream());
// result = parseJSON(di);
while (-1 != di.read(b, 0, 1)) {
System.out.print(new String(b));
}
< /code>

, aber ein Fehler unter < /p>

erhalten.java.io.IOException: Unable to tunnel through proxy. Proxy returns "HTTP/1.1 407 Proxy Authorization Required"
at sun.net.www.protocol.http.HttpURLConnection.doTunneling(HttpURLConnection.java:1648)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:164)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1172)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:234)
at kf.store.locator.googlemaps.test.main(test.java:58)
< /code>

Irgendwelche Hilfe ???? < /p>

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post