2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $$Year-Rel$$ The Jalview Authors
5 * This file is part of Jalview.
7 * Jalview is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation, either version 3
10 * of the License, or (at your option) any later version.
12 * Jalview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19 * The Jalview Authors are detailed in the 'AUTHORS' file.
21 package jalview.javascript.web;
23 import jalview.javascript.json.JSON;
24 import jalview.util.Platform;
29 * minimal implementation of com.sun.jersey.api.client.ClientResponse
34 public class ClientResponse
37 private String response;
39 private boolean isJSON;
41 private Object jsonData;
43 int responseCode = -1;
45 public ClientResponse(URL url, String[] encoding)
47 // OK, so it turns out that ajax "json" format - or for that matter, any
48 // format for json is still just text. There is no point in getting this
49 // using special jQuery "json" formats. Duh. BH wasted a whole day try to
51 response = Platform.getFileAsString(url.toString());
52 responseCode = (response == null || response == "" ? 404 : 200);
53 isJSON = encoding[0].equals("application/json");
58 jsonData = JSON.parse(response);
70 public Object getEntity(Class<?> c)
73 if (c == java.util.Map.class)
80 // 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
87 // "q":"(text:q93xj9_soltu) AND molecule_sequence:['' TO *] AND status:REL",
88 // "fl":"pdb_id,title,experimental_method,resolution",
90 // "sort":"overall_quality desc",
93 // "response":{"numFound":1,"start":0,"docs":[
95 // "experimental_method":["X-ray diffraction"],
98 // "title":"The crystal structure of Potato ferredoxin I with 2Fe-2S
103 public int getStatus()
108 public Object getJSONData()