X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fjavascript%2Fweb%2FClientResponse.java;fp=src%2Fjalview%2Fjavascript%2Fweb%2FClientResponse.java;h=e33dd984c3e0a6651de5950a9f9f6391c5b37d82;hb=5a256ef0ca648a8f4722da20475cbd01655d9de4;hp=0000000000000000000000000000000000000000;hpb=2feb01ad1b8b7122f6f965301c670c75e891bc03;p=jalview.git diff --git a/src/jalview/javascript/web/ClientResponse.java b/src/jalview/javascript/web/ClientResponse.java new file mode 100644 index 0000000..e33dd98 --- /dev/null +++ b/src/jalview/javascript/web/ClientResponse.java @@ -0,0 +1,54 @@ +package jalview.javascript.web; + +import java.net.URI; + +public class ClientResponse +{ + + private String response; + private String encoding; + + public ClientResponse(String response, String encoding) + { + this.response = response; + this.encoding = encoding; + } + + public String getEntity(Class c) + { + + // c will be String.class + + return response; + } + + // 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 + +//{ +//"responseHeader":{ +// "status":0, +// "QTime":0, +// "params":{ +// "q":"(text:q93xj9_soltu) AND molecule_sequence:['' TO *] AND status:REL", +// "fl":"pdb_id,title,experimental_method,resolution", +// "start":"0", +// "sort":"overall_quality desc", +// "rows":"500", +// "wt":"json"}}, +//"response":{"numFound":1,"start":0,"docs":[ +// { +// "experimental_method":["X-ray diffraction"], +// "pdb_id":"4zhp", +// "resolution":2.46, +// "title":"The crystal structure of Potato ferredoxin I with 2Fe-2S cluster"}] +//}} +// + + public int getStatus() + { + // note, we could get the actual response. I am just assuming it is 200 or 400 + return (response != null && (response.startsWith("{") == encoding.equals("application/json")) + ? 200 : 400); + } + +}