Merge branch 'helma-🐜' into feature/goodbye-ajp

This commit is contained in:
Tobi Schäfer 2017-04-17 15:01:47 +02:00
commit 6860ea589e
11 changed files with 53 additions and 22 deletions

2
.gitignore vendored
View file

@ -10,4 +10,4 @@ lib/ext
log/* log/*
passwd passwd
server.properties server.properties
.gradle

View file

@ -2,11 +2,11 @@ _This is the README file for version 1.7.0 of the Helma Javascript Web Applicati
__TL;DR__ __TL;DR__
- make sure you have Java 1.4 or higher as well as Apache Ant installed - Make sure you have Java 1.4 or higher installed
- clone this repository - Clone this repository
- build Helma with `ant jar` - Build Helma with `./gradlew`
- invoke `start.sh`, resp. `start.bat`, depending on your platform - Invoke `start.sh`, resp. `start.bat`, depending on your platform
- direct your web browser to http://localhost:8080 - Direct your web browser to http://localhost:8080
# Helma # Helma

View file

@ -19,7 +19,7 @@ dependencies {
compile group: 'org.eclipse.jetty', name: 'jetty-servlet', version: '8.1.22.v20160922' compile group: 'org.eclipse.jetty', name: 'jetty-servlet', version: '8.1.22.v20160922'
compile group: 'org.eclipse.jetty', name: 'jetty-xml', version: '8.1.22.v20160922' compile group: 'org.eclipse.jetty', name: 'jetty-xml', version: '8.1.22.v20160922'
compile group: 'javax.mail', name: 'mail', version: '1.4.7' compile group: 'javax.mail', name: 'mail', version: '1.4.7'
compile group: 'org.mozilla', name: 'rhino', version: '1.7R5' compile group: 'org.mozilla', name: 'rhino', version: '1.7.7.1'
compile group: 'org.ccil.cowan.tagsoup', name: 'tagsoup', version: '1.2.1' compile group: 'org.ccil.cowan.tagsoup', name: 'tagsoup', version: '1.2.1'
compile group: 'xmlrpc', name: 'xmlrpc', version: '2.0.1' compile group: 'xmlrpc', name: 'xmlrpc', version: '2.0.1'
} }

BIN
lib/rhino-1.7.7.1.jar Normal file

Binary file not shown.

Binary file not shown.

View file

@ -203,8 +203,10 @@ public class ResponseBean implements Serializable {
* *
* @param str the string to write to the response buffer * @param str the string to write to the response buffer
*/ */
public void write(String str) { public void write(String... str) {
res.write(str); for (String s : str) {
res.write(s);
}
} }
/** /**
@ -212,8 +214,10 @@ public class ResponseBean implements Serializable {
* *
* @param str the string to write to the response buffer * @param str the string to write to the response buffer
*/ */
public void writeln(String str) { public void writeln(String... str) {
res.writeln(str); for (String s : str) {
res.writeln(s);
}
} }
/** /**
@ -237,9 +241,11 @@ public class ResponseBean implements Serializable {
* *
* @param message the message * @param message the message
*/ */
public void debug(String message) { public void debug(String... messages) {
for (String message : messages) {
res.debug(message); res.debug(message);
} }
}
/** /**
* Return a string representation for this object * Return a string representation for this object

View file

@ -377,8 +377,7 @@ public final class ResponseTrans extends Writer implements Serializable {
String str = (message == null) ? "null" : message.toString(); String str = (message == null) ? "null" : message.toString();
debugBuffer.append("<div class=\"helma-debug-line\" style=\"background: yellow; "); debugBuffer.append("<div class=\"helma-debug-line\">");
debugBuffer.append("color: black; border-top: 1px solid black;\">");
debugBuffer.append(str); debugBuffer.append(str);
debugBuffer.append("</div>"); debugBuffer.append("</div>");
} }

View file

@ -38,7 +38,7 @@ import helma.util.ResourceProperties;
*/ */
public class Server implements Runnable { public class Server implements Runnable {
// version string // version string
public static final String version = "1.7.3 (__builddate__)"; public static final String version = "🐜 (__builddate__)";
// static server instance // static server instance
private static Server server; private static Server server;

View file

@ -35,7 +35,7 @@ import java.util.ArrayList;
*/ */
public class Main { public class Main {
public static final String[] jars = { public static final String[] jars = {
"helma.jar", "rhino-1.7R5.jar", "helma.jar", "rhino-1.7.7.1.jar",
"commons-logging-1.2.jar", "commons-logging-1.2.jar",
"xmlrpc-2.0.1.jar", "mail-1.4.7.jar", "activation-1.1.jar", "xmlrpc-2.0.1.jar", "mail-1.4.7.jar", "activation-1.1.jar",
"commons-fileupload-1.3.2.jar", "commons-codec-1-10.jar", "commons-fileupload-1.3.2.jar", "commons-codec-1-10.jar",

View file

@ -35,7 +35,7 @@ public class PathWrapper extends ScriptableObject {
/** /**
* Zero arg constructor for creating the PathWrapper prototype. * Zero arg constructor for creating the PathWrapper prototype.
*/ */
public PathWrapper (RhinoCore core) throws PropertyException, NoSuchMethodException { public PathWrapper (RhinoCore core) throws RhinoException, NoSuchMethodException {
this.core = core; this.core = core;
// create a dummy path object // create a dummy path object
this.path = new RequestPath(core.app); this.path = new RequestPath(core.app);

View file

@ -25,6 +25,7 @@ import helma.objectmodel.db.DbMapping;
import helma.objectmodel.db.NodeHandle; import helma.objectmodel.db.NodeHandle;
import helma.scripting.*; import helma.scripting.*;
import helma.util.*; import helma.util.*;
import org.mozilla.javascript.Context; import org.mozilla.javascript.Context;
import org.mozilla.javascript.ContextAction; import org.mozilla.javascript.ContextAction;
import org.mozilla.javascript.ContextFactory; import org.mozilla.javascript.ContextFactory;
@ -42,9 +43,12 @@ import org.mozilla.javascript.ScriptRuntime;
import org.mozilla.javascript.Undefined; import org.mozilla.javascript.Undefined;
import org.mozilla.javascript.WrapFactory; import org.mozilla.javascript.WrapFactory;
import org.mozilla.javascript.Wrapper; import org.mozilla.javascript.Wrapper;
import org.mozilla.javascript.commonjs.module.RequireBuilder;
import org.mozilla.javascript.commonjs.module.provider.*;
import org.mozilla.javascript.tools.debugger.ScopeProvider; import org.mozilla.javascript.tools.debugger.ScopeProvider;
import java.io.*; import java.io.*;
import java.net.URI;
import java.text.*; import java.text.*;
import java.util.*; import java.util.*;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
@ -89,8 +93,8 @@ public final class RhinoCore implements ScopeProvider {
// optimization level for rhino engine, ranges from -1 to 9 // optimization level for rhino engine, ranges from -1 to 9
int optLevel = 0; int optLevel = 0;
// language version - default to JS 1.7 // language version - default to JS 1.8
int languageVersion = 170; int languageVersion = 180;
// debugger/tracer flags // debugger/tracer flags
boolean hasDebugger = false; boolean hasDebugger = false;
@ -157,6 +161,27 @@ public final class RhinoCore implements ScopeProvider {
global.initStandardObjects(context, false); global.initStandardObjects(context, false);
global.init(); global.init();
// Enable loading and exporting of CommonJS modules with require and module.exports, resp.
// Inspiration: http://stackoverflow.com/a/30355409/5281580
List<URI> commonJsPaths = new ArrayList<URI>();
commonJsPaths.add(app.getAppDir().toURI());
String commonJsAppPath = app.getProperty("commonjs.dir");
if (commonJsAppPath != null) {
File commonJsAppDir = new File(app.getAppDir(), commonJsAppPath);
if (commonJsAppDir.isDirectory()) {
commonJsPaths.add(commonJsAppDir.toURI());
}
}
new RequireBuilder()
.setModuleScriptProvider(new StrongCachingModuleScriptProvider(
new UrlModuleSourceProvider(commonJsPaths, null)))
.setSandboxed(true)
.createRequire(context, global)
.install(global);
pathProto = new PathWrapper(this); pathProto = new PathWrapper(this);
hopObjectProto = HopObject.init(this); hopObjectProto = HopObject.init(this);
@ -1207,6 +1232,7 @@ public final class RhinoCore implements ScopeProvider {
} else { } else {
app.logError("Unsupported rhino.languageVersion: " + languageVersion); app.logError("Unsupported rhino.languageVersion: " + languageVersion);
} }
// Set up visual debugger if rhino.debug = true // Set up visual debugger if rhino.debug = true
if (hasDebugger) if (hasDebugger)
initDebugger(cx); initDebugger(cx);