diff --git a/build.xml b/build.xml
index 0394e5489a0..7c87d65381b 100644
--- a/build.xml
+++ b/build.xml
@@ -368,13 +368,9 @@
-
+
-
-
-
-
-
+
diff --git a/src/examples/vertx-dev b/src/examples/vertx-dev
index 1f160655ede..168a6e75e35 100755
--- a/src/examples/vertx-dev
+++ b/src/examples/vertx-dev
@@ -39,4 +39,4 @@ $DIRNAME/../../src/main/javascript
MODS_DIR=$SCRIPTDIR/../../target/dist-build/vert.x-1.0.beta6/mods
java -Djava.util.logging.config.file=$DIRNAME/../../conf/logging.properties -Djruby.home=$JRUBY_HOME \
--Dvertx.mods=$MODS_DIR -Dvertx.install=$SCRIPTDIR -cp $CLASSPATH org.vertx.java.deploy.impl.cli.VertxMgr "$@"
+-Dvertx.mods=$MODS_DIR -cp $CLASSPATH org.vertx.java.deploy.impl.cli.VertxMgr "$@"
diff --git a/src/main/java/org/vertx/java/core/file/impl/DefaultFileSystem.java b/src/main/java/org/vertx/java/core/file/impl/DefaultFileSystem.java
index b949512c793..2e85c47daf9 100644
--- a/src/main/java/org/vertx/java/core/file/impl/DefaultFileSystem.java
+++ b/src/main/java/org/vertx/java/core/file/impl/DefaultFileSystem.java
@@ -26,6 +26,8 @@
import org.vertx.java.core.impl.BlockingAction;
import org.vertx.java.core.impl.Context;
import org.vertx.java.core.impl.VertxInternal;
+import org.vertx.java.core.logging.Logger;
+import org.vertx.java.core.logging.impl.LoggerFactory;
import java.io.File;
import java.io.FileNotFoundException;
@@ -57,7 +59,9 @@
* @author Tim Fox
*/
public class DefaultFileSystem implements FileSystem {
-
+
+ private static final Logger log = LoggerFactory.getLogger(DefaultFileSystem.class);
+
private final VertxInternal vertx;
public DefaultFileSystem(VertxInternal vertx) {
@@ -318,9 +322,8 @@ private BlockingAction copyInternal(String from, String to, AsyncResultHan
}
private BlockingAction copyInternal(String from, String to, final boolean recursive, AsyncResultHandler handler) {
-
- final Path source = Paths.get(from);
- final Path target = Paths.get(to);
+ final Path source = PathAdjuster.adjust(Paths.get(from));
+ final Path target = PathAdjuster.adjust(Paths.get(to));
return new BlockingAction(vertx, handler) {
public Void action() throws Exception {
try {
@@ -359,10 +362,8 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs)
}
private BlockingAction moveInternal(String from, String to, AsyncResultHandler handler) {
-
- //TODO atomic moves - but they have different semantics, e.g. on Linux if target already exists it is overwritten
- final Path source = Paths.get(from);
- final Path target = Paths.get(to);
+ final Path source = PathAdjuster.adjust(Paths.get(from));
+ final Path target = PathAdjuster.adjust(Paths.get(to));
return new BlockingAction(vertx, handler) {
public Void action() throws Exception {
try {
@@ -377,8 +378,8 @@ public Void action() throws Exception {
};
}
- private BlockingAction truncateInternal(final String path, final long len, AsyncResultHandler handler) {
-
+ private BlockingAction truncateInternal(String p, final long len, AsyncResultHandler handler) {
+ final String path = PathAdjuster.adjust(p);
return new BlockingAction(vertx, handler) {
public Void action() throws Exception {
if (len < 0) {
@@ -407,8 +408,7 @@ private BlockingAction chmodInternal(String path, String perms, AsyncResul
}
private BlockingAction chmodInternal(String path, String perms, String dirPerms, AsyncResultHandler handler) {
-
- final Path target = Paths.get(path);
+ final Path target = PathAdjuster.adjust(Paths.get(path));
final Set permissions = PosixFilePermissions.fromString(perms);
final Set dirPermissions = dirPerms == null ? null : PosixFilePermissions.fromString(dirPerms);
return new BlockingAction(vertx, handler) {
@@ -448,8 +448,7 @@ private BlockingAction lpropsInternal(String path, AsyncResultHandler
}
private BlockingAction props(String path, final boolean followLinks, AsyncResultHandler handler) {
-
- final Path target = Paths.get(path);
+ final Path target = PathAdjuster.adjust(Paths.get(path));
return new BlockingAction(vertx, handler) {
public FileProps action() throws Exception {
try {
@@ -476,9 +475,8 @@ private BlockingAction symlinkInternal(String link, String existing, Async
}
private BlockingAction link(String link, String existing, final boolean symbolic, AsyncResultHandler handler) {
-
- final Path source = Paths.get(link);
- final Path target = Paths.get(existing);
+ final Path source = PathAdjuster.adjust(Paths.get(link));
+ final Path target = PathAdjuster.adjust(Paths.get(existing));
return new BlockingAction(vertx, handler) {
public Void action() throws Exception {
try {
@@ -500,8 +498,7 @@ private BlockingAction unlinkInternal(String link, AsyncResultHandler readSymlinkInternal(String link, AsyncResultHandler handler) {
-
- final Path source = Paths.get(link);
+ final Path source = PathAdjuster.adjust(Paths.get(link));
return new BlockingAction(vertx, handler) {
public String action() throws Exception {
try {
@@ -518,8 +515,7 @@ private BlockingAction deleteInternal(String path, AsyncResultHandler deleteInternal(String path, final boolean recursive, AsyncResultHandler handler) {
-
- final Path source = Paths.get(path);
+ final Path source = PathAdjuster.adjust(Paths.get(path));
return new BlockingAction(vertx, handler) {
public Void action() throws Exception {
if (recursive) {
@@ -564,8 +560,7 @@ private BlockingAction mkdirInternal(String path, String perms, AsyncResul
}
private BlockingAction mkdirInternal(String path, final String perms, final boolean createParents, AsyncResultHandler handler) {
-
- final Path source = Paths.get(path);
+ final Path source = PathAdjuster.adjust(Paths.get(path));
final FileAttribute> attrs = perms == null ? null : PosixFilePermissions.asFileAttribute(PosixFilePermissions.fromString(perms));
return new BlockingAction(vertx, handler) {
public Void action() throws Exception {
@@ -597,8 +592,8 @@ private BlockingAction readDirInternal(String path, AsyncResultHandler
return readDirInternal(path, null, handler);
}
- private BlockingAction readDirInternal(final String path, final String filter, AsyncResultHandler handler) {
-
+ private BlockingAction readDirInternal(String p, final String filter, AsyncResultHandler handler) {
+ final String path = PathAdjuster.adjust(p);
return new BlockingAction(vertx, handler) {
public String[] action() throws Exception {
File file = new File(path);
@@ -635,11 +630,10 @@ public boolean accept(File dir, String name) {
};
}
- private BlockingAction readFileInternal(final String path, AsyncResultHandler handler) {
-
+ private BlockingAction readFileInternal(String path, AsyncResultHandler handler) {
+ final Path target = PathAdjuster.adjust(Paths.get(path));
return new BlockingAction(vertx, handler) {
public Buffer action() throws Exception {
- Path target = Paths.get(path);
byte[] bytes = Files.readAllBytes(target);
Buffer buff = new Buffer(bytes);
return buff;
@@ -647,11 +641,10 @@ public Buffer action() throws Exception {
};
}
- private BlockingAction writeFileInternal(final String path, final Buffer data, AsyncResultHandler handler) {
-
+ private BlockingAction writeFileInternal(String path, final Buffer data, AsyncResultHandler handler) {
+ final Path target = PathAdjuster.adjust(Paths.get(path));
return new BlockingAction(vertx, handler) {
public Void action() throws Exception {
- Path target = Paths.get(path);
Files.write(target, data.getBytes());
return null;
}
@@ -674,8 +667,9 @@ private BlockingAction openInternal(String path, String perms, boolea
return openInternal(path, perms, read, write, createNew, false, handler);
}
- private BlockingAction openInternal(final String path, final String perms, final boolean read, final boolean write, final boolean createNew,
+ private BlockingAction openInternal(String p, final String perms, final boolean read, final boolean write, final boolean createNew,
final boolean flush, AsyncResultHandler handler) {
+ final String path = PathAdjuster.adjust(p);
return new BlockingAction(vertx, handler) {
public AsyncFile action() throws Exception {
return doOpen(path, perms, read, write, createNew, flush, context);
@@ -692,8 +686,8 @@ private BlockingAction createFileInternal(String path, AsyncResultHandler<
return createFileInternal(path, null, handler);
}
- private BlockingAction createFileInternal(final String path, final String perms, AsyncResultHandler handler) {
-
+ private BlockingAction createFileInternal(String p, final String perms, AsyncResultHandler handler) {
+ final String path = PathAdjuster.adjust(p);
final FileAttribute> attrs = perms == null ? null : PosixFilePermissions.asFileAttribute(PosixFilePermissions.fromString(perms));
return new BlockingAction(vertx, handler) {
public Void action() throws Exception {
@@ -712,21 +706,19 @@ public Void action() throws Exception {
};
}
- private BlockingAction existsInternal(final String path, AsyncResultHandler handler) {
-
+ private BlockingAction existsInternal(String path, AsyncResultHandler handler) {
+ final File file = new File(PathAdjuster.adjust(path));
return new BlockingAction(vertx, handler) {
public Boolean action() throws Exception {
- File file = new File(path);
return file.exists();
}
};
}
- private BlockingAction fsPropsInternal(final String path, AsyncResultHandler handler) {
-
+ private BlockingAction fsPropsInternal(String path, AsyncResultHandler handler) {
+ final Path target = PathAdjuster.adjust(Paths.get(path));
return new BlockingAction(vertx, handler) {
public FileSystemProps action() throws Exception {
- Path target = Paths.get(path);
FileStore fs = Files.getFileStore(target);
return new FileSystemProps(fs.getTotalSpace(), fs.getUnallocatedSpace(), fs.getUsableSpace());
}
diff --git a/src/main/java/org/vertx/java/core/file/impl/ModuleDir.java b/src/main/java/org/vertx/java/core/file/impl/ModuleDir.java
new file mode 100644
index 00000000000..f5bb3db1020
--- /dev/null
+++ b/src/main/java/org/vertx/java/core/file/impl/ModuleDir.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2011-2012 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.vertx.java.core.file.impl;
+
+/**
+ * @author Tim Fox
+ */
+public interface ModuleDir {
+ String get();
+}
diff --git a/src/main/java/org/vertx/java/core/file/impl/PathAdjuster.java b/src/main/java/org/vertx/java/core/file/impl/PathAdjuster.java
new file mode 100644
index 00000000000..5c1354dd621
--- /dev/null
+++ b/src/main/java/org/vertx/java/core/file/impl/PathAdjuster.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2011-2012 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.vertx.java.core.file.impl;
+
+import org.vertx.java.core.impl.Context;
+
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+/**
+ * @author Tim Fox
+ */
+public class PathAdjuster {
+
+ public static Path adjust(Path path) {
+ Path adjustment = Context.getContext().getPathAdjustment();
+ if (adjustment == null) {
+ return path;
+ } else {
+ return adjustment.resolve(path);
+ }
+ }
+
+ public static String adjust(String path) {
+ Path adjustment = adjust(Paths.get(path));
+ return adjustment.toString();
+ }
+}
diff --git a/src/main/java/org/vertx/java/core/http/impl/DefaultHttpServerResponse.java b/src/main/java/org/vertx/java/core/http/impl/DefaultHttpServerResponse.java
index 0447d6f0d10..34a9ea1ff06 100644
--- a/src/main/java/org/vertx/java/core/http/impl/DefaultHttpServerResponse.java
+++ b/src/main/java/org/vertx/java/core/http/impl/DefaultHttpServerResponse.java
@@ -30,6 +30,7 @@
import org.jboss.netty.handler.codec.http.HttpVersion;
import org.vertx.java.core.Handler;
import org.vertx.java.core.buffer.Buffer;
+import org.vertx.java.core.file.impl.PathAdjuster;
import org.vertx.java.core.http.HttpServerResponse;
import org.vertx.java.core.logging.Logger;
import org.vertx.java.core.logging.impl.LoggerFactory;
@@ -239,7 +240,7 @@ public DefaultHttpServerResponse sendFile(String filename) {
throw new IllegalStateException("Head already written");
}
checkWritten();
- File file = new File(filename);
+ File file = new File(PathAdjuster.adjust(filename));
if (!file.exists()) {
sendNotFound();
} else {
diff --git a/src/main/java/org/vertx/java/core/impl/Context.java b/src/main/java/org/vertx/java/core/impl/Context.java
index 46dd7591615..94df200063e 100644
--- a/src/main/java/org/vertx/java/core/impl/Context.java
+++ b/src/main/java/org/vertx/java/core/impl/Context.java
@@ -16,9 +16,11 @@
package org.vertx.java.core.impl;
+import org.vertx.java.core.file.impl.ModuleDir;
import org.vertx.java.core.logging.Logger;
import org.vertx.java.core.logging.impl.LoggerFactory;
+import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;
@@ -32,6 +34,7 @@ public abstract class Context {
private static final ThreadLocal contextTL = new ThreadLocal<>();
private DeploymentHandle deploymentContext;
+ private Path pathAdjustment;
private List closeHooks;
@@ -51,6 +54,15 @@ public DeploymentHandle getDeploymentHandle() {
return deploymentContext;
}
+ public Path getPathAdjustment() {
+ return pathAdjustment;
+ }
+
+ public void setPathAdjustment(Path pathAdjustment) {
+ this.pathAdjustment = pathAdjustment;
+ }
+
+
public void reportException(Throwable t) {
if (deploymentContext != null) {
deploymentContext.reportException(t);
diff --git a/src/main/java/org/vertx/java/core/net/impl/DefaultNetSocket.java b/src/main/java/org/vertx/java/core/net/impl/DefaultNetSocket.java
index aa74cd82931..bfca3213810 100644
--- a/src/main/java/org/vertx/java/core/net/impl/DefaultNetSocket.java
+++ b/src/main/java/org/vertx/java/core/net/impl/DefaultNetSocket.java
@@ -25,6 +25,7 @@
import org.vertx.java.core.SimpleHandler;
import org.vertx.java.core.buffer.Buffer;
import org.vertx.java.core.eventbus.Message;
+import org.vertx.java.core.file.impl.PathAdjuster;
import org.vertx.java.core.impl.Context;
import org.vertx.java.core.impl.VertxInternal;
import org.vertx.java.core.logging.Logger;
@@ -114,7 +115,7 @@ public void handle() {
}
public void sendFile(String filename) {
- File f = new File(filename);
+ File f = new File(PathAdjuster.adjust(filename));
super.sendFile(f);
}
diff --git a/src/main/java/org/vertx/java/deploy/Container.java b/src/main/java/org/vertx/java/deploy/Container.java
index 1d990196f72..2a295aa4df8 100644
--- a/src/main/java/org/vertx/java/deploy/Container.java
+++ b/src/main/java/org/vertx/java/deploy/Container.java
@@ -91,7 +91,7 @@ public String deployWorkerVerticle(String main, JsonObject config, int instances
*/
public String deployWorkerVerticle(String main, JsonObject config, int instances, Handler doneHandler) {
URL[] currURLs = mgr.getDeploymentURLs();
- return mgr.deploy(true, null, main, config, currURLs, instances, doneHandler);
+ return mgr.deploy(true, null, main, config, currURLs, instances, null, doneHandler);
}
/**
@@ -144,7 +144,7 @@ public String deployVerticle(String main, JsonObject config, int instances) {
*/
public String deployVerticle(String main, JsonObject config, int instances, Handler doneHandler) {
URL[] currURLs = mgr.getDeploymentURLs();
- return mgr.deploy(false, null, main, config, currURLs, instances, doneHandler);
+ return mgr.deploy(false, null, main, config, currURLs, instances, null, doneHandler);
}
/**
diff --git a/src/main/java/org/vertx/java/deploy/impl/ModuleManager.java b/src/main/java/org/vertx/java/deploy/impl/ModuleManager.java
index 1c2e7946222..33eea3410f5 100644
--- a/src/main/java/org/vertx/java/deploy/impl/ModuleManager.java
+++ b/src/main/java/org/vertx/java/deploy/impl/ModuleManager.java
@@ -42,14 +42,14 @@ public class ModuleManager {
public ModuleManager(VerticleManager verticleManager) {
String modDir = System.getProperty("vertx.mods");
- if (modDir != null) {
- modRoot = new File(modDir);
- } else {
+ if (modDir == null || modDir.trim().equals("")) {
String installDir = System.getProperty("vertx.install");
if (installDir == null) {
- throw new IllegalStateException("vertx.install system property must be specified");
+ throw new IllegalStateException("vertx.install system property must be specified if vert.mods not specified");
}
modRoot = new File(installDir, "mods");
+ } else {
+ modRoot = new File(modDir);
}
this.verticleManager = verticleManager;
}
@@ -98,9 +98,9 @@ public String deploy(String deployName, String modName, JsonObject config, int i
}
Boolean worker = json.getBoolean("worker");
if (worker == null) {
- throw new IllegalStateException("Module " + modName + " mod.json must contain a \"worker\" field");
+ worker = Boolean.FALSE;
}
- return verticleManager.deploy(worker, deployName, main, config, urls.toArray(new URL[urls.size()]), instances, doneHandler);
+ return verticleManager.deploy(worker, deployName, main, config, urls.toArray(new URL[urls.size()]), instances, modDir, doneHandler);
}
}
diff --git a/src/main/java/org/vertx/java/deploy/impl/VerticleManager.java b/src/main/java/org/vertx/java/deploy/impl/VerticleManager.java
index 8c10e36e5bb..d5ed32726bd 100644
--- a/src/main/java/org/vertx/java/deploy/impl/VerticleManager.java
+++ b/src/main/java/org/vertx/java/deploy/impl/VerticleManager.java
@@ -31,7 +31,11 @@
import org.vertx.java.deploy.impl.jruby.JRubyVerticleFactory;
import org.vertx.java.deploy.impl.rhino.RhinoVerticleFactory;
+import java.io.File;
+import java.io.IOException;
import java.net.URL;
+import java.nio.file.Path;
+import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -99,13 +103,14 @@ public Logger getLogger() {
public synchronized String deploy(boolean worker, String name, final String main,
final JsonObject config, final URL[] urls,
int instances,
+ final File modDir,
final Handler doneHandler)
{
if (deployments.containsKey(name)) {
throw new IllegalStateException("There is already a deployment with name: " + name);
}
- if (mm.exists(main)) {
+ if (modDir == null && mm.exists(main)) {
return mm.deploy(name, main, config, instances, doneHandler);
}
@@ -202,6 +207,9 @@ public void run() {
try {
addVerticle(deployment, verticle);
+ if (modDir != null) {
+ setPathAdjustment(modDir);
+ }
verticle.start();
} catch (Throwable t) {
vertx.reportException(t);
@@ -222,6 +230,18 @@ public void run() {
return deploymentName;
}
+ // We calculate a path adjustment that can be used by the fileSystem object
+ // so that the *effective* working directory can be the module directory
+ // this allows modules to read and write the file system as if they were
+ // in the module dir, even though the actual working directory will be
+ // wherever vertx run or vertx start was called from
+ private void setPathAdjustment(File modDir) {
+ Path cwd = Paths.get(".").toAbsolutePath().getParent();
+ Path pmodDir = Paths.get(modDir.getAbsolutePath());
+ Path relative = cwd.relativize(pmodDir);
+ Context.getContext().setPathAdjustment(relative);
+ }
+
public synchronized void undeployAll(final Handler doneHandler) {
final UndeployCount count = new UndeployCount();
if (!deployments.isEmpty()) {
diff --git a/src/main/java/org/vertx/java/deploy/impl/cli/DeployCommand.java b/src/main/java/org/vertx/java/deploy/impl/cli/DeployCommand.java
index 60d05ceef88..246d7db0054 100644
--- a/src/main/java/org/vertx/java/deploy/impl/cli/DeployCommand.java
+++ b/src/main/java/org/vertx/java/deploy/impl/cli/DeployCommand.java
@@ -52,7 +52,7 @@ public String execute(VerticleManager appMgr) throws Exception {
} else {
jsonConf = null;
}
- String appName = appMgr.deploy(worker, name, main, jsonConf, urls, instances, null);
+ String appName = appMgr.deploy(worker, name, main, jsonConf, urls, instances, null, null);
return "Deployment: " + appName;
}
}
diff --git a/src/main/java/org/vertx/java/deploy/impl/cli/VertxMgr.java b/src/main/java/org/vertx/java/deploy/impl/cli/VertxMgr.java
index f13b5cf1058..812871a785e 100644
--- a/src/main/java/org/vertx/java/deploy/impl/cli/VertxMgr.java
+++ b/src/main/java/org/vertx/java/deploy/impl/cli/VertxMgr.java
@@ -127,7 +127,7 @@ private void runApplication(String main, Args args) {
} else {
jsonConf = null;
}
- mgr.deploy(dc.worker, dc.name, dc.main, jsonConf, dc.urls, dc.instances, null);
+ mgr.deploy(dc.worker, dc.name, dc.main, jsonConf, dc.urls, dc.instances, null, null);
mgr.block();
}
}
diff --git a/src/mods/auth-mgr/mod.json b/src/mods/auth-mgr/mod.json
index 2a58df717ef..f580c8ba445 100644
--- a/src/mods/auth-mgr/mod.json
+++ b/src/mods/auth-mgr/mod.json
@@ -1,4 +1,3 @@
{
- "main": "org.vertx.mods.AuthManager",
- "worker": false
+ "main": "org.vertx.mods.AuthManager"
}
\ No newline at end of file
diff --git a/src/mods/file-stuff/file.js b/src/mods/file-stuff/file.js
new file mode 100644
index 00000000000..2b186345c29
--- /dev/null
+++ b/src/mods/file-stuff/file.js
@@ -0,0 +1,9 @@
+load('vertx.js')
+
+vertx.fileSystem.copy("from.txt", "to.txt", function(err, res) {
+ if (err) {
+ stdout.println("Failed to copy");
+ } else {
+ stdout.println("Copied ok");
+ }
+});
\ No newline at end of file
diff --git a/src/mods/file-stuff/from.txt b/src/mods/file-stuff/from.txt
new file mode 100644
index 00000000000..ff71fb6faa4
--- /dev/null
+++ b/src/mods/file-stuff/from.txt
@@ -0,0 +1 @@
+dqwdqwdqwdqwdqwdqwdqwd
\ No newline at end of file
diff --git a/src/mods/file-stuff/mod.json b/src/mods/file-stuff/mod.json
new file mode 100644
index 00000000000..fb603518159
--- /dev/null
+++ b/src/mods/file-stuff/mod.json
@@ -0,0 +1,3 @@
+{
+ "main": "file.js"
+}
\ No newline at end of file
diff --git a/src/mods/web-server/mod.json b/src/mods/web-server/mod.json
new file mode 100644
index 00000000000..66dfb8e1e77
--- /dev/null
+++ b/src/mods/web-server/mod.json
@@ -0,0 +1,3 @@
+{
+ "main": "server.js"
+}
\ No newline at end of file
diff --git a/src/mods/web-server/server.js b/src/mods/web-server/server.js
new file mode 100644
index 00000000000..7c828863d00
--- /dev/null
+++ b/src/mods/web-server/server.js
@@ -0,0 +1,22 @@
+/*
+ * Copyright 2011-2012 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+load('vertx.js')
+
+vertx.createHttpServer().requestHandler(function(req) {
+ var filename = "webroot/" + (req.uri == "/" ? "index.html" : "." + req.uri);
+ req.response.sendFile(filename)
+}).listen(8080)
\ No newline at end of file
diff --git a/src/mods/web-server/webroot/index.html b/src/mods/web-server/webroot/index.html
new file mode 100644
index 00000000000..c7fb429f0f2
--- /dev/null
+++ b/src/mods/web-server/webroot/index.html
@@ -0,0 +1,30 @@
+
+
+
+
+ vert.x static web server
+
+
+This is the vert.x static web server. Click on some links below
+
+
+
+Page 1
+Page 2
+
+
+
\ No newline at end of file
diff --git a/src/mods/web-server/webroot/page1.html b/src/mods/web-server/webroot/page1.html
new file mode 100644
index 00000000000..844b9dbf718
--- /dev/null
+++ b/src/mods/web-server/webroot/page1.html
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+Welcome to page1!
+
+
\ No newline at end of file
diff --git a/src/mods/web-server/webroot/page2.html b/src/mods/web-server/webroot/page2.html
new file mode 100644
index 00000000000..19470fadf9f
--- /dev/null
+++ b/src/mods/web-server/webroot/page2.html
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+Welcome to page2!
+
+
\ No newline at end of file
diff --git a/src/mods/work-queue/mod.json b/src/mods/work-queue/mod.json
index 762c48eb657..79f0254413a 100644
--- a/src/mods/work-queue/mod.json
+++ b/src/mods/work-queue/mod.json
@@ -1,4 +1,3 @@
{
- "main": "org.vertx.mods.WorkQueue",
- "worker": false
+ "main": "org.vertx.mods.WorkQueue"
}
\ No newline at end of file
diff --git a/src/scripts/vertx b/src/scripts/vertx
index 2ae32f59148..2aeed92baaf 100755
--- a/src/scripts/vertx
+++ b/src/scripts/vertx
@@ -13,8 +13,14 @@ while [ -h "$PRG" ] ; do
fi
done
+# The path to this script from the place it was called
DIRNAME=`dirname "$PRG"`
+# The absolute path of this script
+CURRDIR=`pwd`
+SCRIPTDIR=`cd $DIRNAME;pwd`
+cd $CURRDIR
+
CLASSPATH=\
$DIRNAME/../conf:\
$DIRNAME/../lib/jars/vert.x-core.jar:\
@@ -25,10 +31,8 @@ $DIRNAME/../lib/jars/hazelcast.jar:\
$DIRNAME/../lib/jars/jruby.jar:\
$DIRNAME/../lib/jars/groovy.jar:\
$DIRNAME/../lib/jars/js.jar:\
-$DIRNAME/../lib/jars/mail.jar:\
-$DIRNAME/../lib/jars/mongo.jar:\
$DIRNAME/../lib/ruby:\
$DIRNAME/../lib/javascript
-java -Djava.util.logging.config.file=$DIRNAME/../conf/logging.properties -Djruby.home=$JRUBY_HOME\
- -cp $CLASSPATH org.vertx.java.deploy.impl.cli.VertxMgr "$@"
+java -Djava.util.logging.config.file=$DIRNAME/../conf/logging.properties -Djruby.home=$JRUBY_HOME \
+-Dvertx.mods=$VERTX_MODS -Dvertx.install=$SCRIPTDIR/.. -cp $CLASSPATH org.vertx.java.deploy.impl.cli.VertxMgr "$@"
diff --git a/src/tests/framework/java/org/vertx/java/framework/TestBase.java b/src/tests/framework/java/org/vertx/java/framework/TestBase.java
index 24856796be7..745845db892 100644
--- a/src/tests/framework/java/org/vertx/java/framework/TestBase.java
+++ b/src/tests/framework/java/org/vertx/java/framework/TestBase.java
@@ -196,7 +196,7 @@ public void handle() {
}
};
- String deploymentName = verticleManager.deploy(worker, null, main, config, new URL[] {url}, instances, doneHandler);
+ String deploymentName = verticleManager.deploy(worker, null, main, config, new URL[] {url}, instances, null, doneHandler);
startedApps.add(deploymentName);