JAL-3851 changed error response status codes to 201 for jetty reasons. Some example...
authorBen Soares <b.soares@dundee.ac.uk>
Fri, 10 Sep 2021 13:55:29 +0000 (14:55 +0100)
committerBen Soares <b.soares@dundee.ac.uk>
Fri, 10 Sep 2021 13:55:29 +0000 (14:55 +0100)
src/jalview/rest/AbstractEndpoint.java
src/jalview/rest/AbstractEndpointAsync.java
src/jalview/rest/FetchSequencesEndpoint.java
wget_commands.sh [new file with mode: 0644]

index 4add269..2d366ea 100644 (file)
@@ -79,8 +79,16 @@ public abstract class AbstractEndpoint implements EndpointI
   {
     String okString = request.getParameter("ok");
     boolean ok = (okString != null && okString.equalsIgnoreCase("true"));
-    response.setStatus(ok ? HttpServletResponse.SC_OK
-            : HttpServletResponse.SC_BAD_REQUEST);
+    /*
+     * Annoyingly jetty is not adding content to anything other than a few
+     * 20x status codes. Possibly it is closing the PrintWriter.
+     * Find a fix for this!
+     ****************************************************/
+    response.setStatus(ok ? HttpServletResponse.SC_OK : //
+    // HttpServletResponse.SC_BAD_REQUEST //
+            HttpServletResponse.SC_PARTIAL_CONTENT //
+    );
+
     String endpointName = getPath();
     Cache.error(getAPI().getName() + " error: endpoint " + endpointName
             + " failed: '" + message + "'");
@@ -203,4 +211,9 @@ public abstract class AbstractEndpoint implements EndpointI
             : afs[0];
   }
 
+  protected boolean deleteFromCache()
+  {
+    return false;
+  }
+
 }
\ No newline at end of file
index 8abb1e9..923b068 100644 (file)
@@ -202,7 +202,7 @@ public abstract class AbstractEndpointAsync extends AbstractEndpoint
           response.setStatus(HttpServletResponse.SC_ACCEPTED);
           break;
         case IN_PROGRESS:
-          response.setStatus(HttpServletResponse.SC_NO_CONTENT);
+          response.setStatus(HttpServletResponse.SC_ACCEPTED);
           break;
         case FINISHED:
           response.setStatus(HttpServletResponse.SC_CREATED);
@@ -274,4 +274,10 @@ public abstract class AbstractEndpointAsync extends AbstractEndpoint
     changeStatus(Status.NOT_RUN);
     super.returnError(request, response, message);
   }
+
+  @Override
+  protected boolean deleteFromCache()
+  {
+    return false;
+  }
 }
index 56c67c6..e547534 100644 (file)
@@ -81,6 +81,8 @@ public class FetchSequencesEndpoint extends AbstractEndpointAsync
     for (AlignmentViewPanel ap : aps)
     {
       AlignmentI al = ap.getAlignment();
+      if (al == null)
+        continue;
       List<SequenceI> seqs = (List<SequenceI>) al.getSequences();
       for (SequenceI seq : seqs)
       {
diff --git a/wget_commands.sh b/wget_commands.sh
new file mode 100644 (file)
index 0000000..58fd7c0
--- /dev/null
@@ -0,0 +1,10 @@
+wget -q -S -O - 'http://localhost:2021/jalview/api/fetchsequences/ensembl/ENSG00000139618?id=myBRCA2'
+wget -q -S -O - 'http://localhost:2021/jalview/api/getcrossreferences/UNIPROT?fromId=myBRCA2'
+wget -q -S -O - "http://localhost:2021/jalview/api/highlightsequence/ENST00000544455/30000?fromId=myBRCA2"
+N=22946; while [ $N -lt 23002 ]; do wget -q -S -O - "http://localhost:2021/jalview/api/highlightsequence/ENST00000544455/${N}?fromId=myBRCA2"; N=$((N+1)); sleep 0.2; done
+wget -q -S -O - 'http://localhost:2021/jalview/api/selectsequences/*/*?fromId=myBRCA2'
+wget -q -S -O - 'http://localhost:2021/jalview/api/selectsequences/*/22946-23001?fromId=myBRCA2'
+wget -q -S -O - 'http://localhost:2021/jalview/api/selectsequences/ENSG00000139618,ENST00000544455,ENST00000530893,ENST00000380152,ENST00000680887,ENST00000614259,ENST00000665585,ENST00000528762/22946-23001?fromId=myBRCA2'
+wget -q -S -O - 'http://localhost:2021/jalview/api/selectsequences/ENSG00000139618,ENST00000544455,ENST00000380152,ENST00000680887,ENST00000614259,ENST00000528762/22946-23001?fromId=myBRCA2'
+### open 3D structure 6hqu and repeat highlight
+