Proxy-authorization. Help

susinmn

Well-known member
16.10.2007
529
3
#1
Делаю так:

Код:
System.getProperties().put( "proxySet", "true" );
System.getProperties().put( "proxyHost", "ip" );
System.getProperties().put( "proxyPort", "порт" );

URL url = new URL("путь к файлу");

URLConnection conn = url.openConnection();

String password = "логин:пароль";

conn.setRequestProperty( "Proxy-Authorization", password );
conn.connect();
На conn.connect() ловлю:

Код:
java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:352)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:214)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:201)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:378)
at java.net.Socket.connect(Socket.java:537)
at java.net.Socket.connect(Socket.java:487)
at sun.net.NetworkClient.doConnect(NetworkClient.java:175)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:395)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:530)
at sun.net.www.http.HttpClient.<init>(HttpClient.java:234)
at sun.net.www.http.HttpClient.New(HttpClient.java:307)
at sun.net.www.http.HttpClient.New(HttpClient.java:278)
at COM.ibm.JEmpower.applet.http.HttpURLConnection.connect(HttpURLConnection.java:315)
at JavaAgent.NotesMain(Unknown Source)
at lotus.domino.AgentBase.runNotes(Unknown Source)
at lotus.domino.NotesThread.run(Unknown Source)
 

susinmn

Well-known member
16.10.2007
529
3
#2
Вот на такое:
Код:
Authenticator.setDefault(new Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
System.out.println("Try get pass authentication");
return new PasswordAuthentication("логин", "пароль".toCharArray());
}
});
выдает:
Код:
java.security.AccessControlException: Access denied (java.net.NetPermission setDefaultAuthenticator)
at java.security.AccessController.checkPermission(AccessController.java:108)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:533)
at COM.ibm.JEmpower.applet.AppletSecurity.superDotCheckPermission(AppletSecurity.java:1449)
at COM.ibm.JEmpower.applet.AppletSecurity.checkPermission(AppletSecurity.java:1480)
at COM.ibm.JEmpower.applet.AppletSecurity.checkPermission(AppletSecurity.java:1464)
at java.net.Authenticator.setDefault(Authenticator.java:122)
at JavaAgent.NotesMain(Unknown Source)
at lotus.domino.AgentBase.runNotes(Unknown Source)
at lotus.domino.NotesThread.run(Unknown Source)
 

lmike

нет, пердело совершенство
Lotus team
27.08.2008
6 583
269
#3
java.security.AccessControlException - это значит надо добавлять сюды jbm/lib/security/java.policy, пермишн
на вот это:
java.net.NetPermission setDefaultAuthenticator;
в секцию grant
 

susinmn

Well-known member
16.10.2007
529
3
#4
Код:
permission java.util.PropertyPermission "java.net.NetPermission", "read";
и
Код:
permission java.util.PropertyPermission "java.net.NetPermission", "write";
добавлял, ошибка остается.
 

susinmn

Well-known member
16.10.2007
529
3
#6
Теперь
Код:
HttpURLConnection conn = (HttpURLConnection)url.openConnection(proxy);

java.lang.UnsupportedOperationException: Method not implemented.
at java.net.URLStreamHandler.openConnection(URLStreamHandler.java:80)
at java.net.URL.openConnection(URL.java:994)
at JavaAgent.NotesMain(Unknown Source)
at lotus.domino.AgentBase.runNotes(Unknown Source)
at lotus.domino.NotesThread.run(Unknown Source)
пишут - http://www-10.lotus.com/ldd/nd85forum.nsf/...c5?OpenDocument