Skip to content

Commit

Permalink
get examples to run
Browse files Browse the repository at this point in the history
  • Loading branch information
purplefox committed Mar 14, 2013
1 parent d75112a commit 95f608e
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
7 changes: 5 additions & 2 deletions src/examples/java/simpleform/SimpleFormServer.java
Expand Up @@ -18,7 +18,7 @@
import org.vertx.java.core.Handler;
import org.vertx.java.core.SimpleHandler;
import org.vertx.java.core.http.HttpServerRequest;
import org.vertx.java.deploy.Verticle;
import org.vertx.java.platform.Verticle;
import org.vertx.mods.formupload.Attribute;
import org.vertx.mods.formupload.MultipartRequest;

Expand All @@ -27,6 +27,7 @@ public class SimpleFormServer extends Verticle {
public void start() {
vertx.createHttpServer().requestHandler(new Handler<HttpServerRequest>() {
public void handle(final HttpServerRequest req) {
System.out.println("uri is " + req.uri);
if (req.uri.equals("/")) {
// Serve the index page
req.response.sendFile("index.html");
Expand All @@ -36,15 +37,17 @@ public void handle(final HttpServerRequest req) {
mpReq.attributeHandler(new Handler<Attribute>() {
@Override
public void handle(Attribute attr) {
System.out.println("Got attr " + attr.name + " : " + attr.value + "\n");

req.response.write("Got attr " + attr.name + " : " + attr.value + "\n");
}
});
req.endHandler(new SimpleHandler() {
protected void handle() {
System.out.println("end of request");
req.response.end();
}
});

} else {
req.response.statusCode = 404;
req.response.end();
Expand Down
4 changes: 2 additions & 2 deletions src/examples/java/simpleform/run_example.sh 100644 → 100755
@@ -1,4 +1,4 @@
# We set VERTX_MODS to point to where we built the module
export VERTX_MODS=$(readlink -f '../../../../build/mod')
export VERTX_MODS=$(readlink -f '../../../../mods')
# And then we run the example
vertx run SimpleFormServer.java -includes vertx.formupload-v1.0
vertx run SimpleFormServer.java -includes io.vertx~mod-formupload~2.0.0-SNAPSHOT
2 changes: 1 addition & 1 deletion src/examples/java/simpleupload/SimpleUploadServer.java
Expand Up @@ -19,7 +19,7 @@
import org.vertx.java.core.AsyncResultHandler;
import org.vertx.java.core.Handler;
import org.vertx.java.core.http.HttpServerRequest;
import org.vertx.java.deploy.Verticle;
import org.vertx.java.platform.Verticle;
import org.vertx.mods.formupload.MultipartRequest;
import org.vertx.mods.formupload.Upload;

Expand Down
4 changes: 2 additions & 2 deletions src/examples/java/simpleupload/run_example.sh 100644 → 100755
@@ -1,4 +1,4 @@
# We set VERTX_MODS to point to where we built the module
export VERTX_MODS=$(readlink -f '../../../../build/mod')
export VERTX_MODS=$(readlink -f '../../../../mods')
# And then we run the example
vertx run SimpleUploadServer.java -includes vertx.formupload-v1.0
vertx run SimpleUploadServer.java -includes io.vertx~mod-formupload~2.0.0-SNAPSHOT
3 changes: 0 additions & 3 deletions src/main/java/org/vertx/mods/formupload/MultipartRequest.java
Expand Up @@ -36,9 +36,6 @@ public MultipartRequest(Vertx vertx, HttpServerRequest req) {
this.req = req;
// TODO - this is a bit of a hack
nettyReq = ((DefaultHttpServerRequest)req).getNettyRequest();
for (Map.Entry<String, String> header: req.headers().entrySet()) {
nettyReq.headers().add(header.getKey(), header.getValue());
}
try {
decoder = new HttpPostRequestDecoder(new DataFactory(), nettyReq);
} catch (Exception e) {
Expand Down
2 changes: 1 addition & 1 deletion vertx.properties
Expand Up @@ -2,7 +2,7 @@
modowner=io.vertx

# Your module name
modname=mod-form-upload
modname=mod-formupload

# Your module version
version=2.0.0-SNAPSHOT
Expand Down

0 comments on commit 95f608e

Please sign in to comment.