{"id":617,"date":"2010-11-22T12:02:10","date_gmt":"2010-11-22T11:02:10","guid":{"rendered":"http:\/\/www.spikesoft.ch\/?p=617"},"modified":"2010-11-22T12:09:09","modified_gmt":"2010-11-22T11:09:09","slug":"how-to-use-a-proxy-and-force-fetching-the-latest-data","status":"publish","type":"post","link":"https:\/\/www.spikesoft.ch\/?p=617","title":{"rendered":"How to use a proxy and force fetching the latest data"},"content":{"rendered":"<p>I just recently had a problem using a Java <a href=\"http:\/\/download.oracle.com\/javase\/6\/docs\/api\/\" target=\"_blank\">URLConnection<\/a> behind a proxy and forcing the connection to get the latest available data on the server and not the one cached by the proxy. The following code snippet demonstrate how to do that.<\/p>\n<pre lang=\"java\" line=\"10\"> \r\nURL metarUrl = new URL(\"ftp:\/\/tgftp.nws.noaa.gov:21\/data\/observations\/metar\/stations\/LSGG.TXT\");\r\nProxy myProxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(\"www.myproxy.ch\", 8080));\r\nURLConnection metarConnection = metarUrl.openConnection(myProxy);\r\nmetarConnection.setDefaultUseCaches(false);\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>I just recently had a problem using a Java URLConnection behind a proxy and forcing the connection to get the latest available data on the server and not the one cached by the proxy. The following code snippet demonstrate how &hellip; <a href=\"https:\/\/www.spikesoft.ch\/?p=617\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20,9],"tags":[],"class_list":["post-617","post","type-post","status-publish","format-standard","hentry","category-java","category-programmation"],"_links":{"self":[{"href":"https:\/\/www.spikesoft.ch\/index.php?rest_route=\/wp\/v2\/posts\/617","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.spikesoft.ch\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.spikesoft.ch\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.spikesoft.ch\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.spikesoft.ch\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=617"}],"version-history":[{"count":9,"href":"https:\/\/www.spikesoft.ch\/index.php?rest_route=\/wp\/v2\/posts\/617\/revisions"}],"predecessor-version":[{"id":627,"href":"https:\/\/www.spikesoft.ch\/index.php?rest_route=\/wp\/v2\/posts\/617\/revisions\/627"}],"wp:attachment":[{"href":"https:\/\/www.spikesoft.ch\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=617"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.spikesoft.ch\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=617"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.spikesoft.ch\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=617"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}