r9794 - helma-ng/trunk/modules/helma

[email protected] Sat, 16 May 2009 00:18:53 +0200 (CEST)
Newsgroups gmane.comp.java.helma.cvs
Message-ID <20090515221853.A77BA3D0D6@mia>
Author: hannes
Date: 2009-05-16 00:18:53 +0200 (Sat, 16 May 2009)
New Revision: 9794

Modified:
   helma-ng/trunk/modules/helma/logging.js
   helma-ng/trunk/modules/helma/webapp.js
Log:
Make sure middleware doesn't have to deal with converting Helma responses to Jack responses (and helma/webapp.handleRequest is slowly getting big).

Details at http://dev.helma.org/trac/helma/changeset/9794

Modified: helma-ng/trunk/modules/helma/logging.js
===================================================================
--- helma-ng/trunk/modules/helma/logging.js	2009-05-15 22:18:51 UTC (rev 9793)
+++ helma-ng/trunk/modules/helma/logging.js	2009-05-15 22:18:53 UTC (rev 9794)
@@ -66,10 +66,6 @@
         appender.callback = null;
     }
 
-    if (res && typeof res === 'object' && typeof res.close === 'function') {
-        res = res.close();
-    }
-
     var [status, headers, body] = res;
 
     // only do this for ordinary HTML responses

Modified: helma-ng/trunk/modules/helma/webapp.js
===================================================================
--- helma-ng/trunk/modules/helma/webapp.js	2009-05-15 22:18:51 UTC (rev 9793)
+++ helma-ng/trunk/modules/helma/webapp.js	2009-05-15 22:18:53 UTC (rev 9794)
@@ -113,7 +113,12 @@
                                     && middlewareIndex < middleware.length) {
                                 return invokeMiddleware(middleware[middlewareIndex++], [req]);
                             } else {
-                                return action.apply(module, args);
+                                var res = action.apply(module, args);
+                                if (res && typeof res === 'object'
+                                        && typeof res.close === 'function') {
+                                    return res.close();
+                                }
+                                return res;
                             }
                         }
                         return req.process();