Skip to content
Browse files

Merge commit 'gmosx/master'

  • Loading branch information...
2 parents b91905c + e98dd77 commit 8fcad72135071744571ed031fdcdae6ade584255 Tom Robinson committed Aug 22, 2009
Showing with 6 additions and 4 deletions.
  1. +6 −4 src/org/jackjs/JackServlet.java
View
10 src/org/jackjs/JackServlet.java
@@ -20,13 +20,15 @@ public void init(ServletConfig config) throws ServletException {
final String moduleName = getInitParam(config, "module", "jackconfig.js");
final String appName = getInitParam(config, "app", "app");
final String environmentName = getInitParam(config, "environment", null);
+ final int optimizationLevel = Integer.parseInt(getInitParam(config, "optimizationLevel", "9"));
- final String narwhalHome = getServletContext().getRealPath("WEB-INF/narwhal");
+// final String narwhalHome = getServletContext().getRealPath("WEB-INF/narwhal");
+ final String narwhalHome = getServletContext().getRealPath("WEB-INF/packages/narwhal");
final String narwhalFilename = "platforms/rhino/bootstrap.js";
Context context = Context.enter();
try {
- //context.setOptimizationLevel(-1);
+ context.setOptimizationLevel(optimizationLevel);
scope = new ImporterTopLevel(context);
ScriptableObject.putProperty(scope, "NARWHAL_HOME", Context.javaToJS(narwhalHome, scope));
@@ -40,7 +42,7 @@ public void init(ServletConfig config) throws ServletException {
// load the app
Scriptable module = (Scriptable)context.evaluateString(scope, "require('"+modulesPath+"/"+moduleName+"');", null, 1, null);
-
+
app = (Function)module.get(appName, module);
if (environmentName != null) {
@@ -53,7 +55,7 @@ public void init(ServletConfig config) throws ServletException {
}
}
- } catch (IOException e) {
+ } catch (Exception e) {
e.printStackTrace();
} finally {
Context.exit();

0 comments on commit 8fcad72

Please sign in to comment.
Something went wrong with that request. Please try again.