JAL-2253 pull up constant, additional unit test
[jalview.git] / src / jalview / ext / ensembl / EnsemblRestClient.java
index 17f9986..6384120 100644 (file)
@@ -74,6 +74,8 @@ abstract class EnsemblRestClient extends EnsemblSequenceFetcher
 
   private final static long VERSION_RETEST_INTERVAL = 1000L * 3600; // 1 hr
 
+  protected static final String CONTENT_TYPE_JSON = "?content-type=application/json";
+
   static
   {
     domainData = new HashMap<String, EnsemblInfo>();
@@ -164,8 +166,7 @@ abstract class EnsemblRestClient extends EnsemblSequenceFetcher
     {
       // note this format works for both ensembl and ensemblgenomes
       // info/ping.json works for ensembl only (March 2016)
-      URL ping = new URL(
-              getDomain() + "/info/ping?content-type=application/json");
+      URL ping = new URL(getDomain() + "/info/ping" + CONTENT_TYPE_JSON);
 
       /*
        * expect {"ping":1} if ok
@@ -455,8 +456,7 @@ abstract class EnsemblRestClient extends EnsemblSequenceFetcher
     URL url = null;
     try
     {
-      url = new URL(
-              getDomain() + "/info/rest?content-type=application/json");
+      url = new URL(getDomain() + "/info/rest" + CONTENT_TYPE_JSON);
       BufferedReader br = getHttpResponse(url, null);
       if (br == null)
       {
@@ -522,8 +522,7 @@ abstract class EnsemblRestClient extends EnsemblSequenceFetcher
     URL url = null;
     try
     {
-      url = new URL(
-              getDomain() + "/info/data?content-type=application/json");
+      url = new URL(getDomain() + "/info/data" + CONTENT_TYPE_JSON);
       BufferedReader br = getHttpResponse(url, null);
       if (br != null)
       {