Displaying differences for changeset
 
display as  

src/csip/Config.java

@@ -140,7 +140,7 @@
         /* 
          The CSIP version
          */
-        put(CSIP_VERSION, "$version: 2.1.172 e313202911e5 2017-04-02 od, built at 2017-04-03 15:16 by od$");
+        put(CSIP_VERSION, "$version: 2.1.174 b42b75a3a53b 2017-04-04 Shaun Case, built at 2017-04-05 14:43 by od$");
 
         /*
          * The runtime architecture. 

src/csip/ModelDataService.java

@@ -161,7 +161,11 @@
 
     private String[] inputs = ModelSession.NO_ATTACHMENTS;  // no attachments
 
-    private HttpServletRequest httpReq;
+    private String req_host;
+    private String req_url = "";
+    private String req_remoteIp = "";
+    private String req_context;
+    private String req_scheme;
 
     private JSONArray res;
     private JSONArray rep;
@@ -179,7 +183,7 @@
     // options Default comes from @Options
     private boolean unpack;
     // Timeout of execution in seconds. Default comes from @Options
-    long timeout;
+    private long timeout;
 
     protected SessionLogger LOG = new SessionLogger(getResultsDir(), getServicePath(), getSUID());
 
@@ -345,10 +349,6 @@
      * @return the request ip
      */
     protected final String getRemoteAddr() {
-        String req_remoteIp = httpReq.getHeader("X-Forwarded-For");
-        if (req_remoteIp == null) {
-            req_remoteIp = httpReq.getRemoteAddr();
-        }
         return req_remoteIp;
     }
 
@@ -381,8 +381,8 @@
      * Get the complete request URL
      * @return the full request URL
      */
-    protected final String getRequestURL() {
-        return httpReq.getRequestURL().toString();
+    protected synchronized final String getRequestURL() {
+        return req_url;
     }
 
 
@@ -391,7 +391,7 @@
      * @return the full request URL
      */
     protected final String getRequestHost() {
-        return httpReq.getRemoteHost();
+        return req_host;
     }
 
 
@@ -400,7 +400,7 @@
      * @return the context name
      */
     protected final String getRequestContext() {
-        return httpReq.getContextPath();
+        return req_context;
     }
 
 
@@ -409,7 +409,7 @@
      * @return the context name
      */
     protected final String getRequestScheme() {
-        return httpReq.getScheme();
+        return req_scheme;
     }
 
 
@@ -2248,12 +2248,21 @@
     @Consumes(MediaType.APPLICATION_JSON)
     public final String execute(@Context UriInfo uriInfo, @Context HttpServletRequest httpReq, String requestStr) {
         LOG.log(Level.INFO, "HTTP/POST {0}", uriInfo.getRequestUri().toString());
+
+        req_remoteIp = httpReq.getHeader("X-Forwarded-For");
+        if (req_remoteIp == null) {
+            req_remoteIp = httpReq.getRemoteAddr();
+        }
+        req_host = httpReq.getRemoteHost();
+        req_url = httpReq.getRequestURL().toString();
+        req_context = httpReq.getContextPath();
+        req_scheme = httpReq.getScheme();
+
         if (requestStr == null) {
             return JSONUtils.error("Null JSON Request.").toString();
         }
 
         if (start == null) {
-            this.httpReq = httpReq;
             start = new Date();
             processOptions();
         }
@@ -2432,7 +2441,6 @@
     @Consumes(MediaType.MULTIPART_FORM_DATA)
     public final String execute(@Context UriInfo uriInfo, @Context HttpServletRequest httpReq, FormDataMultiPart multipart) {
         LOG.log(Level.INFO, "HTTP/POST {0}", uriInfo.getRequestUri().toString());
-        this.httpReq = httpReq;
         processOptions();
         start = new Date();
         String response = null;
@@ -2617,14 +2625,14 @@
                     setFailedStatus(serviceError);
                 }
             } catch (TimeoutException E) {
+                LOG.log(Level.INFO, "service: " + getServicePath() + "  timed out after " + timeout + " seconds. service cancelled.");
                 setCancelledStatus();
-                LOG.log(Level.INFO, "service: " + getServicePath() + "  timed out after " + timeout + " seconds. service cancelled.");
             } catch (CancellationException E) {
+                LOG.log(Level.INFO, "cancelled.");
                 setCancelledStatus();
-                LOG.log(Level.INFO, "cancelled.");
             } catch (Exception e) {
+                LOG.log(Level.SEVERE, null, e);
                 setFailedStatus(e);
-                LOG.log(Level.SEVERE, null, e);
             } finally {
                 // manage exporation action
                 try {