1 package jalview.javascript.web;
3 import jalview.javascript.json.JSON;
4 import jalview.util.Platform;
9 * minimal implementation of com.sun.jersey.api.client.ClientResponse
14 public class ClientResponse
17 private String response;
19 private boolean isJSON;
21 private Object jsonData;
23 int responseCode = -1;
25 public ClientResponse(URL url, String[] encoding)
27 // OK, so it turns out that ajax "json" format - or for that matter, any
28 // format for json is still just text. There is no point in getting this
29 // using special jQuery "json" formats. Duh. BH wasted a whole day try to
31 response = Platform.getFileAsString(url.toString());
32 responseCode = (response == null || response == "" ? 404 : 200);
33 isJSON = encoding[0].equals("application/json");
38 jsonData = JSON.parse(response);
50 public Object getEntity(Class<?> c)
53 if (c == java.util.Map.class)
60 // https://www.ebi.ac.uk/pdbe/search/pdb/select?wt=json&fl=pdb_id,title,experimental_method,resolution&rows=500&start=0&q=(text:q93xj9_soltu)+AND+molecule_sequence:%5B%27%27+TO+*%5D+AND+status:REL&sort=overall_quality+desc
67 // "q":"(text:q93xj9_soltu) AND molecule_sequence:['' TO *] AND status:REL",
68 // "fl":"pdb_id,title,experimental_method,resolution",
70 // "sort":"overall_quality desc",
73 //"response":{"numFound":1,"start":0,"docs":[
75 // "experimental_method":["X-ray diffraction"],
78 // "title":"The crystal structure of Potato ferredoxin I with 2Fe-2S cluster"}]
82 public int getStatus()
87 public Object getJSONData()