Proxy for the ArcGIS Runtime Java SDK

2810
6
11-29-2016 05:19 AM
ThomasPauli
Deactivated User

How can I use a proxy connection within the ArcGIS Runtime Java SDK?

Tags (3)
0 Kudos
6 Replies
EricBader
Honored Contributor

For 100.0, have a look at the static method setProxyInfo on the RequestConfiguration class.

Let us know if this helps. 

ThomasPauli
Deactivated User

Thank you for your answer. I already found this class and my next problem is: how and where can / should I implement the setProxyInfo method to add proxy informations?

0 Kudos
EricBader
Honored Contributor

I don't think it really matters where in your code you put it.

Why do you ask? Are you experiencing unexpected results?

Just let us know. Thanks

0 Kudos
ThomasPauli
Deactivated User

I'm not shure how to become access to the RequestConfiguration class.

I don't use ArcGIS android. I use (or try to use) ArcGIS it with Java FX. Your link redirect me to this url "http://android:8080/docs/api/java/doc/api-doc/arcgis-java/reference/com/esri/arcgisruntime/io/Reques..., int)" which I can't open because the host "android:8080" not exist and I'm not hosting anything like that here on my computer.

0 Kudos
MichaelUhde
Deactivated User

I'm trying to access a ArcGISMapImageLayer(http://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer) over a webproxy, which requires a basic authentication with username and password.
I figured out 2 possibilities, but neither the configuration over the java.net.ProxySelector properties like http.proxyHost/http.proxyPort nor the RequestConfiguration.setProxyInfo("webproxy.sbb.ch", 8080, "http") worked as I expected.

I implemented my own AuthenticationChallengeHandler and registered it over the static method

         AuthenticationManager.setAuthenticationChallengeHandler(..)

, which is never invoked.

When I set


         RequestConfiguration.setProxyInfo("webproxy.sbb.ch", 8080, "https")

then the AuthenticationChallengeHandler is invoked, but instead of the expected USER_CREDENTIAL_CHALLENGE
a SELF_SIGNED_CHALLENGE AuthenticationChallenge is delivered.

The following SSLException had been occured :

javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
at sun.security.ssl.InputRecord.handleUnknownRecord(InputRecord.java:710)
at sun.security.ssl.InputRecord.read(InputRecord.java:527)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:973)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1375)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1403)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1387)
at com.esri.arcgisruntime.internal.httpclient.conn.b.e.a(SourceFile:394)
at com.esri.arcgisruntime.internal.httpclient.conn.b.e.a(SourceFile:353)
at com.esri.arcgisruntime.internal.httpclient.impl.c.e.a(SourceFile:141)

So obviously arcgis establishes a SSL connection to the proxy. Does the AuthenticationChallengeHandler only works with SSL connections or is it a bug?

0 Kudos
MichaelUhde
Deactivated User

Hi,

I'm using Quarz with JavaFX and I want to access the ESRI map server over a proxy which requires an authentication.

WIth the ProxySelector properties (e.g http.proxyHost) I could make the SDK using the proxy. But how I can define the authentication's credentials like username and password? The java.net.Authenticator did not work. The method getPasswordAuthentication() is never called.

        Authenticator.setDefault(new Authenticator() {              @Override             protected PasswordAuthentication getPasswordAuthentication() {                 System.out.println("Authentication for " + getRequestingURL());                 if (getRequestorType() == RequestorType.PROXY && "myproxy.intranet.com".equalsIgnoreCase(getRequestingURL().toString())) {                     System.out.println("getPasswordAuthentication() for " + getRequestingURL());                     return new PasswordAuthentication(                             "userId", "password".toCharArray());                 }                 return null;             }         }); 
0 Kudos