<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Using Example from behind a proxy in Java Maps SDK Questions</title>
    <link>https://community.esri.com/t5/java-maps-sdk-questions/using-example-from-behind-a-proxy/m-p/683672#M2078</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am trying to get the example to run from behind a proxy, and somehow I seem to be missing something crucial.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Below is, what I've tried so far&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I get &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;--- result ---&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;starting main&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://google.com" rel="nofollow"&gt;http://google.com&lt;/A&gt;&lt;BR /&gt;&lt;SPAN&gt;Response code of the object is 200&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;OK&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer" rel="nofollow"&gt;http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer&lt;/A&gt;&lt;BR /&gt;&lt;SPAN&gt;Response code of the object is 200&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;OK&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Java version : 1.7.0_51 (Oracle Corporation) amd64&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Rendering engine : DirectX&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;com.esri.core.io.EsriServiceException: &lt;/SPAN&gt;&lt;SPAN style="color:&amp;quot;#FF0000&amp;quot;;"&gt;Proxy Authentication Required ( Forefront TMG requires authorization to fulfill the request. Access to the Web &lt;BR /&gt;Proxy filter is denied. )&lt;/SPAN&gt;&lt;SPAN&gt; at com.esri.core.internal.io.handler.c.a(Unknown Source)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at com.esri.core.internal.io.handler.n$1.handleResponse(Unknown Source)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at com.esri.core.internal.io.handler.n$1.handleResponse(Unknown Source)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:735)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:709)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:700)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at com.esri.core.internal.io.handler.n.a(Unknown Source)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at com.esri.core.internal.io.handler.n.a(Unknown Source)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at com.esri.core.internal.tasks.ags.n.a(Unknown Source)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at com.esri.core.internal.tasks.ags.n.execute(Unknown Source)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at com.esri.map.Layer.loadServiceInfo(Unknown Source)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at com.esri.map.Layer.getMapServerInfo(Unknown Source)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at com.esri.map.ArcGISTiledMapServiceLayer$1.run(Unknown Source)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at java.util.concurrent.FutureTask.run(Unknown Source)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at java.lang.Thread.run(Unknown Source)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;--- end of result ---&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This seems to me to show that I can pass the proxy in an ordinarily way but somehow not when calling map.getLayers&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;What am I missing?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for any help&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Ludger&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;//--- start code ---&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color:&amp;quot;#008000&amp;quot;;"&gt;import java.awt.EventQueue;&lt;BR /&gt;import javax.swing.JFrame;&lt;BR /&gt;&lt;BR /&gt;import java.awt.BorderLayout;&lt;BR /&gt;import java.awt.event.WindowAdapter;&lt;BR /&gt;import java.awt.event.WindowEvent;&lt;BR /&gt;import java.io.IOException;&lt;BR /&gt;import java.net.Authenticator;&lt;BR /&gt;import java.net.HttpURLConnection;&lt;BR /&gt;import java.net.PasswordAuthentication;&lt;BR /&gt;import java.net.URL;&lt;BR /&gt;&lt;BR /&gt;import com.esri.core.io.EsriSecurityException;&lt;BR /&gt;import com.esri.core.io.ProxySetup;&lt;BR /&gt;import com.esri.core.io.UserCredentials;&lt;BR /&gt;import com.esri.runtime.ArcGISRuntime;&lt;BR /&gt;import com.esri.map.ArcGISTiledMapServiceLayer;&lt;BR /&gt;import com.esri.map.JMap;&lt;BR /&gt;&lt;BR /&gt;public class MyMapClass {&lt;BR /&gt;&lt;BR /&gt; private JFrame window;&lt;BR /&gt; private JMap map;&lt;BR /&gt;&lt;BR /&gt; public MyMapClass() throws IOException, EsriSecurityException {&lt;BR /&gt; &lt;BR /&gt; // Proxy&lt;BR /&gt; final String authUser = "me";&lt;BR /&gt; final String authPassword = "mypwd";&lt;BR /&gt; final String proxyHost = "w3proxy";&lt;BR /&gt; final String proxyPort = "8080";&lt;BR /&gt; final int iproxyPort = 8080;&lt;BR /&gt;&lt;BR /&gt; window = new JFrame();&lt;BR /&gt; window.setSize(800, 600);&lt;BR /&gt; window.setLocationRelativeTo(null); // center on screen&lt;BR /&gt; window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);&lt;BR /&gt; window.getContentPane().setLayout(new BorderLayout(0, 0));&lt;BR /&gt;&lt;BR /&gt; System.setProperty("http.proxyHost", proxyHost);&lt;BR /&gt; System.setProperty("http.proxyPort", proxyPort);&lt;BR /&gt; System.setProperty("https.proxyHost", proxyHost);&lt;BR /&gt; System.setProperty("https.proxyPort", proxyPort);&lt;BR /&gt; System.setProperty("http.proxyType", "4");&lt;BR /&gt; &lt;BR /&gt; Authenticator.setDefault(new Authenticator() {&lt;BR /&gt; @Override&lt;BR /&gt; protected PasswordAuthentication getPasswordAuthentication() {&lt;BR /&gt; return new PasswordAuthentication(authUser, authPassword.toCharArray());&lt;BR /&gt; }&lt;BR /&gt; });&lt;BR /&gt; &lt;BR /&gt; // checks: both ok&lt;BR /&gt;&lt;SPAN&gt; URL url = new URL("&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://google.com" rel="nofollow" target="_blank"&gt;http://google.com&lt;/A&gt;&lt;SPAN&gt;");&lt;/SPAN&gt;&lt;BR /&gt; HttpURLConnection connection;&lt;BR /&gt; connection = (HttpURLConnection)url.openConnection();&lt;BR /&gt; connection.setRequestMethod("GET");&lt;BR /&gt; connection.connect();&lt;BR /&gt; &lt;BR /&gt; int code = connection.getResponseCode();&lt;BR /&gt;&lt;SPAN&gt; System.out.println("&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://google.com" rel="nofollow" target="_blank"&gt;http://google.com&lt;/A&gt;&lt;SPAN&gt;");&lt;/SPAN&gt;&lt;BR /&gt; System.out.println("Response code of the object is "+code);&lt;BR /&gt; if (code==200)&lt;BR /&gt; {&lt;BR /&gt; System.out.println("OK");&lt;BR /&gt; }&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; url = new URL("&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer" rel="nofollow" target="_blank"&gt;http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer&lt;/A&gt;&lt;SPAN&gt;");&lt;/SPAN&gt;&lt;BR /&gt; connection = (HttpURLConnection)url.openConnection();&lt;BR /&gt; connection.setRequestMethod("GET");&lt;BR /&gt; connection.connect();&lt;BR /&gt; &lt;BR /&gt; code = connection.getResponseCode();&lt;BR /&gt;&lt;SPAN&gt; System.out.println("&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer" rel="nofollow" target="_blank"&gt;http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer&lt;/A&gt;&lt;SPAN&gt;");&lt;/SPAN&gt;&lt;BR /&gt; System.out.println("Response code of the object is "+code);&lt;BR /&gt; if (code==200)&lt;BR /&gt; {&lt;BR /&gt; System.out.println("OK");&lt;BR /&gt; }&lt;BR /&gt; &lt;BR /&gt; // ProxySetup proxySetup = new ProxySetup(); taken from example, what for? Makes no difference&lt;BR /&gt; UserCredentials proxyCredentials = new UserCredentials();&lt;BR /&gt; proxyCredentials.setUserAccount(authUser, authPassword);&lt;BR /&gt;&lt;BR /&gt; try {&lt;BR /&gt; ProxySetup.setupProxy(proxyHost, iproxyPort, "http", proxyCredentials);&lt;BR /&gt; } &lt;BR /&gt; &lt;BR /&gt; catch (EsriSecurityException e) {&lt;BR /&gt; // TODO Auto-generated catch block&lt;BR /&gt; e.printStackTrace();&lt;BR /&gt; } &lt;BR /&gt; &lt;BR /&gt; /*&lt;BR /&gt; UserCredentials uc = new UserCredentials();&lt;BR /&gt; uc.setUserAccount(authUser, authPassword);&lt;BR /&gt; ProxySetup.setupProxy(proxyHost,8080,uc);&lt;BR /&gt; */&lt;BR /&gt;&lt;BR /&gt; // dispose map just before application window is closed.&lt;BR /&gt; window.addWindowListener(new WindowAdapter() {&lt;BR /&gt; @Override&lt;BR /&gt; public void windowClosing(WindowEvent windowEvent) {&lt;BR /&gt; super.windowClosing(windowEvent);&lt;BR /&gt; map.dispose();&lt;BR /&gt; }&lt;BR /&gt; });&lt;BR /&gt;&lt;BR /&gt; map = new JMap();&lt;BR /&gt; window.getContentPane().add(map);&lt;BR /&gt;&lt;BR /&gt; ArcGISTiledMapServiceLayer tiledLayer = new ArcGISTiledMapServiceLayer(&lt;BR /&gt;&lt;SPAN&gt; "&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer" rel="nofollow" target="_blank"&gt;http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer&lt;/A&gt;&lt;SPAN&gt;" );&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; //"&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://pc20784:6080/arcgis/rest/services/test/strbg/MapServer" rel="nofollow" target="_blank"&gt;http://pc20784:6080/arcgis/rest/services/test/strbg/MapServer&lt;/A&gt;&lt;SPAN&gt;"); // will do&lt;/SPAN&gt;&lt;BR /&gt; map.getLayers().add(tiledLayer);&lt;BR /&gt; }&lt;BR /&gt;&lt;BR /&gt; /**&lt;BR /&gt; * @param args&lt;BR /&gt; */&lt;BR /&gt; public static void main(String[] args) {&lt;BR /&gt; System.out.println("starting main");&lt;BR /&gt; EventQueue.invokeLater(new Runnable() {&lt;BR /&gt; &lt;BR /&gt; @Override&lt;BR /&gt; public void run() {&lt;BR /&gt; try {&lt;BR /&gt; MyMapClass application = new MyMapClass();&lt;BR /&gt; application.window.setVisible(true);&lt;BR /&gt; } catch (Exception e) {&lt;BR /&gt; e.printStackTrace();&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt; });&lt;BR /&gt; }&lt;BR /&gt;}&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 25 Apr 2014 07:10:07 GMT</pubDate>
    <dc:creator>LudgerHeck</dc:creator>
    <dc:date>2014-04-25T07:10:07Z</dc:date>
    <item>
      <title>Using Example from behind a proxy</title>
      <link>https://community.esri.com/t5/java-maps-sdk-questions/using-example-from-behind-a-proxy/m-p/683672#M2078</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am trying to get the example to run from behind a proxy, and somehow I seem to be missing something crucial.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Below is, what I've tried so far&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I get &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;--- result ---&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;starting main&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://google.com" rel="nofollow"&gt;http://google.com&lt;/A&gt;&lt;BR /&gt;&lt;SPAN&gt;Response code of the object is 200&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;OK&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer" rel="nofollow"&gt;http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer&lt;/A&gt;&lt;BR /&gt;&lt;SPAN&gt;Response code of the object is 200&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;OK&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Java version : 1.7.0_51 (Oracle Corporation) amd64&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Rendering engine : DirectX&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;com.esri.core.io.EsriServiceException: &lt;/SPAN&gt;&lt;SPAN style="color:&amp;quot;#FF0000&amp;quot;;"&gt;Proxy Authentication Required ( Forefront TMG requires authorization to fulfill the request. Access to the Web &lt;BR /&gt;Proxy filter is denied. )&lt;/SPAN&gt;&lt;SPAN&gt; at com.esri.core.internal.io.handler.c.a(Unknown Source)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at com.esri.core.internal.io.handler.n$1.handleResponse(Unknown Source)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at com.esri.core.internal.io.handler.n$1.handleResponse(Unknown Source)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:735)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:709)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:700)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at com.esri.core.internal.io.handler.n.a(Unknown Source)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at com.esri.core.internal.io.handler.n.a(Unknown Source)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at com.esri.core.internal.tasks.ags.n.a(Unknown Source)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at com.esri.core.internal.tasks.ags.n.execute(Unknown Source)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at com.esri.map.Layer.loadServiceInfo(Unknown Source)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at com.esri.map.Layer.getMapServerInfo(Unknown Source)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at com.esri.map.ArcGISTiledMapServiceLayer$1.run(Unknown Source)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at java.util.concurrent.FutureTask.run(Unknown Source)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at java.lang.Thread.run(Unknown Source)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;--- end of result ---&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This seems to me to show that I can pass the proxy in an ordinarily way but somehow not when calling map.getLayers&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;What am I missing?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for any help&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Ludger&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;//--- start code ---&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color:&amp;quot;#008000&amp;quot;;"&gt;import java.awt.EventQueue;&lt;BR /&gt;import javax.swing.JFrame;&lt;BR /&gt;&lt;BR /&gt;import java.awt.BorderLayout;&lt;BR /&gt;import java.awt.event.WindowAdapter;&lt;BR /&gt;import java.awt.event.WindowEvent;&lt;BR /&gt;import java.io.IOException;&lt;BR /&gt;import java.net.Authenticator;&lt;BR /&gt;import java.net.HttpURLConnection;&lt;BR /&gt;import java.net.PasswordAuthentication;&lt;BR /&gt;import java.net.URL;&lt;BR /&gt;&lt;BR /&gt;import com.esri.core.io.EsriSecurityException;&lt;BR /&gt;import com.esri.core.io.ProxySetup;&lt;BR /&gt;import com.esri.core.io.UserCredentials;&lt;BR /&gt;import com.esri.runtime.ArcGISRuntime;&lt;BR /&gt;import com.esri.map.ArcGISTiledMapServiceLayer;&lt;BR /&gt;import com.esri.map.JMap;&lt;BR /&gt;&lt;BR /&gt;public class MyMapClass {&lt;BR /&gt;&lt;BR /&gt; private JFrame window;&lt;BR /&gt; private JMap map;&lt;BR /&gt;&lt;BR /&gt; public MyMapClass() throws IOException, EsriSecurityException {&lt;BR /&gt; &lt;BR /&gt; // Proxy&lt;BR /&gt; final String authUser = "me";&lt;BR /&gt; final String authPassword = "mypwd";&lt;BR /&gt; final String proxyHost = "w3proxy";&lt;BR /&gt; final String proxyPort = "8080";&lt;BR /&gt; final int iproxyPort = 8080;&lt;BR /&gt;&lt;BR /&gt; window = new JFrame();&lt;BR /&gt; window.setSize(800, 600);&lt;BR /&gt; window.setLocationRelativeTo(null); // center on screen&lt;BR /&gt; window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);&lt;BR /&gt; window.getContentPane().setLayout(new BorderLayout(0, 0));&lt;BR /&gt;&lt;BR /&gt; System.setProperty("http.proxyHost", proxyHost);&lt;BR /&gt; System.setProperty("http.proxyPort", proxyPort);&lt;BR /&gt; System.setProperty("https.proxyHost", proxyHost);&lt;BR /&gt; System.setProperty("https.proxyPort", proxyPort);&lt;BR /&gt; System.setProperty("http.proxyType", "4");&lt;BR /&gt; &lt;BR /&gt; Authenticator.setDefault(new Authenticator() {&lt;BR /&gt; @Override&lt;BR /&gt; protected PasswordAuthentication getPasswordAuthentication() {&lt;BR /&gt; return new PasswordAuthentication(authUser, authPassword.toCharArray());&lt;BR /&gt; }&lt;BR /&gt; });&lt;BR /&gt; &lt;BR /&gt; // checks: both ok&lt;BR /&gt;&lt;SPAN&gt; URL url = new URL("&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://google.com" rel="nofollow" target="_blank"&gt;http://google.com&lt;/A&gt;&lt;SPAN&gt;");&lt;/SPAN&gt;&lt;BR /&gt; HttpURLConnection connection;&lt;BR /&gt; connection = (HttpURLConnection)url.openConnection();&lt;BR /&gt; connection.setRequestMethod("GET");&lt;BR /&gt; connection.connect();&lt;BR /&gt; &lt;BR /&gt; int code = connection.getResponseCode();&lt;BR /&gt;&lt;SPAN&gt; System.out.println("&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://google.com" rel="nofollow" target="_blank"&gt;http://google.com&lt;/A&gt;&lt;SPAN&gt;");&lt;/SPAN&gt;&lt;BR /&gt; System.out.println("Response code of the object is "+code);&lt;BR /&gt; if (code==200)&lt;BR /&gt; {&lt;BR /&gt; System.out.println("OK");&lt;BR /&gt; }&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; url = new URL("&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer" rel="nofollow" target="_blank"&gt;http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer&lt;/A&gt;&lt;SPAN&gt;");&lt;/SPAN&gt;&lt;BR /&gt; connection = (HttpURLConnection)url.openConnection();&lt;BR /&gt; connection.setRequestMethod("GET");&lt;BR /&gt; connection.connect();&lt;BR /&gt; &lt;BR /&gt; code = connection.getResponseCode();&lt;BR /&gt;&lt;SPAN&gt; System.out.println("&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer" rel="nofollow" target="_blank"&gt;http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer&lt;/A&gt;&lt;SPAN&gt;");&lt;/SPAN&gt;&lt;BR /&gt; System.out.println("Response code of the object is "+code);&lt;BR /&gt; if (code==200)&lt;BR /&gt; {&lt;BR /&gt; System.out.println("OK");&lt;BR /&gt; }&lt;BR /&gt; &lt;BR /&gt; // ProxySetup proxySetup = new ProxySetup(); taken from example, what for? Makes no difference&lt;BR /&gt; UserCredentials proxyCredentials = new UserCredentials();&lt;BR /&gt; proxyCredentials.setUserAccount(authUser, authPassword);&lt;BR /&gt;&lt;BR /&gt; try {&lt;BR /&gt; ProxySetup.setupProxy(proxyHost, iproxyPort, "http", proxyCredentials);&lt;BR /&gt; } &lt;BR /&gt; &lt;BR /&gt; catch (EsriSecurityException e) {&lt;BR /&gt; // TODO Auto-generated catch block&lt;BR /&gt; e.printStackTrace();&lt;BR /&gt; } &lt;BR /&gt; &lt;BR /&gt; /*&lt;BR /&gt; UserCredentials uc = new UserCredentials();&lt;BR /&gt; uc.setUserAccount(authUser, authPassword);&lt;BR /&gt; ProxySetup.setupProxy(proxyHost,8080,uc);&lt;BR /&gt; */&lt;BR /&gt;&lt;BR /&gt; // dispose map just before application window is closed.&lt;BR /&gt; window.addWindowListener(new WindowAdapter() {&lt;BR /&gt; @Override&lt;BR /&gt; public void windowClosing(WindowEvent windowEvent) {&lt;BR /&gt; super.windowClosing(windowEvent);&lt;BR /&gt; map.dispose();&lt;BR /&gt; }&lt;BR /&gt; });&lt;BR /&gt;&lt;BR /&gt; map = new JMap();&lt;BR /&gt; window.getContentPane().add(map);&lt;BR /&gt;&lt;BR /&gt; ArcGISTiledMapServiceLayer tiledLayer = new ArcGISTiledMapServiceLayer(&lt;BR /&gt;&lt;SPAN&gt; "&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer" rel="nofollow" target="_blank"&gt;http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer&lt;/A&gt;&lt;SPAN&gt;" );&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; //"&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://pc20784:6080/arcgis/rest/services/test/strbg/MapServer" rel="nofollow" target="_blank"&gt;http://pc20784:6080/arcgis/rest/services/test/strbg/MapServer&lt;/A&gt;&lt;SPAN&gt;"); // will do&lt;/SPAN&gt;&lt;BR /&gt; map.getLayers().add(tiledLayer);&lt;BR /&gt; }&lt;BR /&gt;&lt;BR /&gt; /**&lt;BR /&gt; * @param args&lt;BR /&gt; */&lt;BR /&gt; public static void main(String[] args) {&lt;BR /&gt; System.out.println("starting main");&lt;BR /&gt; EventQueue.invokeLater(new Runnable() {&lt;BR /&gt; &lt;BR /&gt; @Override&lt;BR /&gt; public void run() {&lt;BR /&gt; try {&lt;BR /&gt; MyMapClass application = new MyMapClass();&lt;BR /&gt; application.window.setVisible(true);&lt;BR /&gt; } catch (Exception e) {&lt;BR /&gt; e.printStackTrace();&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt; });&lt;BR /&gt; }&lt;BR /&gt;}&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Apr 2014 07:10:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/java-maps-sdk-questions/using-example-from-behind-a-proxy/m-p/683672#M2078</guid>
      <dc:creator>LudgerHeck</dc:creator>
      <dc:date>2014-04-25T07:10:07Z</dc:date>
    </item>
    <item>
      <title>Re: Using Example from behind a proxy</title>
      <link>https://community.esri.com/t5/java-maps-sdk-questions/using-example-from-behind-a-proxy/m-p/683673#M2079</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You may need to work with your network admin to work out why this is failing.&amp;nbsp; It should be a case of using the following code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;ProxySetup proxySetup = new ProxySetup();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; String proxyHost = "myproxy.domain.com";&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; int proxyPort = 8080 ;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; UserCredentials proxyCredentials = new UserCredentials();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; proxyCredentials.setUserAccount("userName", "password");&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; try {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; ProxySetup.setupProxy(proxyHost, proxyPort, proxyCredentials);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; } &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;catch (EsriSecurityException e) {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; // TODO Auto-generated catch block&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; e.printStackTrace();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; } &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This doesn't look too far from what you are already trying though.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 May 2014 14:58:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/java-maps-sdk-questions/using-example-from-behind-a-proxy/m-p/683673#M2079</guid>
      <dc:creator>MarkBaird</dc:creator>
      <dc:date>2014-05-06T14:58:01Z</dc:date>
    </item>
  </channel>
</rss>

