try
{
URL url = new URL(urlSb.toString());
- HttpURLConnection httpURLConnection = HttpUtils.openConnection(url);
+ HttpURLConnection httpURLConnection = (HttpURLConnection) HttpUtils
+ .openConnection(url);
httpURLConnection.setRequestMethod("POST");
httpURLConnection.setDoOutput(true);
try
{
URL url = new URL(CONFIG_API_BASE_URL);
- HttpURLConnection httpURLConnection = HttpUtils.openConnection(url);
+ HttpURLConnection httpURLConnection = (HttpURLConnection) HttpUtils
+ .openConnection(url);
httpURLConnection.setRequestMethod("GET");
httpURLConnection.setRequestProperty("User-Agent", USER_AGENT);
httpURLConnection.setConnectTimeout(5000);
{
// jalview.bin.Console.outPrintln(System.currentTimeMillis() + " " + url);
- HttpURLConnection connection = HttpUtils.openConnection(url);
+ HttpURLConnection connection = (HttpURLConnection) HttpUtils
+ .openConnection(url);
/*
* POST method allows multiple queries in one request; it is supported for
try
{
URL realUrl = new URL(rpcUrl);
- HttpURLConnection conn = HttpUtils.openConnection(realUrl);
+ HttpURLConnection conn = (HttpURLConnection) HttpUtils
+ .openConnection(realUrl);
conn.setRequestProperty("accept", "*/*");
conn.setRequestProperty("content-type", "text/xml");
conn.setDoOutput(true);
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
+import java.net.URLConnection;
public class HttpUtils
{
* url
* @return HttpUrlConnection conn
*/
- public static HttpURLConnection openConnection(URL url) throws IOException
+ public static URLConnection openConnection(URL url) throws IOException
{
if (url == null)
{
return null;
}
- HttpURLConnection conn = null;
+ URLConnection conn = null;
String protocol = url.getProtocol();
if ("http".equals(protocol) || "https".equals(protocol))
{
conn = conn0;
}
}
+ else
+ {
+ conn = url.openConnection();
+ }
return conn;
}
+ ".xml";
URL url = new URL(downloadstring);
- HttpURLConnection urlconn = HttpUtils.openConnection(url);
+ HttpURLConnection urlconn = (HttpURLConnection) HttpUtils
+ .openConnection(url);
// anything other than 200 means we don't have data
// TODO: JAL-3882 reuse the EnsemblRestClient's fair
// use/backoff logic to retry when the server tells us to go away
try
{
URL rcall = new URL(url);
- HttpURLConnection conn = HttpUtils.openConnection(rcall);
+ HttpURLConnection conn = (HttpURLConnection) HttpUtils
+ .openConnection(rcall);
int responseCode = conn.getResponseCode();
if (responseCode == 200)
{
{
URL tUrl = new URL(targetUrl);
URL fUrl = new URL(finalUrl);
- HttpURLConnection conn1 = HttpUtils.openConnection(tUrl);
+ HttpURLConnection conn1 = (HttpURLConnection) HttpUtils
+ .openConnection(tUrl);
URL url1 = conn1.getURL();
Assert.assertEquals(url1, fUrl, "Final URL is not the same.");
}