Merge branch 'helma-🐜' into feature/goodbye-ajp
This commit is contained in:
commit
6860ea589e
11 changed files with 53 additions and 22 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -10,4 +10,4 @@ lib/ext
|
||||||
log/*
|
log/*
|
||||||
passwd
|
passwd
|
||||||
server.properties
|
server.properties
|
||||||
|
.gradle
|
||||||
|
|
10
README.md
10
README.md
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -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
BIN
lib/rhino-1.7.7.1.jar
Normal file
Binary file not shown.
Binary file not shown.
|
@ -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,8 +241,10 @@ public class ResponseBean implements Serializable {
|
||||||
*
|
*
|
||||||
* @param message the message
|
* @param message the message
|
||||||
*/
|
*/
|
||||||
public void debug(String message) {
|
public void debug(String... messages) {
|
||||||
res.debug(message);
|
for (String message : messages) {
|
||||||
|
res.debug(message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -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>");
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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",
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -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,9 +93,9 @@ 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;
|
||||||
boolean hasTracer = false;
|
boolean hasTracer = 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);
|
||||||
|
@ -816,7 +841,7 @@ public final class RhinoCore implements ScopeProvider {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return props;
|
return props;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the RhinoCore instance associated with the current thread, or null
|
* Get the RhinoCore instance associated with the current thread, or null
|
||||||
|
@ -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);
|
||||||
|
|
Loading…
Add table
Reference in a new issue