jubilee 1.0.2 → 1.1.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/CHANGELOG +17 -0
- data/Gemfile +19 -1
- data/Gemfile.lock +189 -31
- data/LICENSE.txt +20 -0
- data/README.md +44 -5
- data/ROADMAP +5 -0
- data/Rakefile +6 -5
- data/examples/chatapp/Gemfile +2 -1
- data/examples/chatapp/Gemfile.lock +8 -6
- data/examples/chatapp/README.md +5 -2
- data/examples/chatapp/app.rb +24 -0
- data/examples/chatapp/public/assets/javascripts/application.js +59 -6
- data/examples/chatapp/public/assets/stylesheets/application.css +25 -0
- data/examples/jubilee.conf.rb +0 -3
- data/jars/{hazelcast-2.6.jar → hazelcast-2.6.3.jar} +0 -0
- data/jars/{netty-all-4.0.4.Final.jar → netty-all-4.0.13.Final.jar} +0 -0
- data/jars/vertx-core-2.1M3-SNAPSHOT.jar +0 -0
- data/jars/vertx-hazelcast-2.1M3-SNAPSHOT.jar +0 -0
- data/java/src/jubilee/JubileeService.java +7 -7
- data/java/src/org/jruby/jubilee/Const.java +10 -35
- data/java/src/org/jruby/jubilee/RackApplication.java +77 -46
- data/java/src/org/jruby/jubilee/RackResponse.java +1 -3
- data/java/src/org/jruby/jubilee/RubyHttpServerResponse.java +88 -0
- data/java/src/org/jruby/jubilee/{Server.java → RubyServer.java} +17 -14
- data/java/src/org/jruby/jubilee/impl/RackEnvironment.java +157 -0
- data/java/src/org/jruby/jubilee/impl/RackEnvironmentHash.java +449 -0
- data/java/src/org/jruby/jubilee/impl/RubyIORackInput.java +5 -5
- data/java/src/org/jruby/jubilee/impl/{NullIO.java → RubyNullIO.java} +5 -9
- data/java/src/org/jruby/jubilee/utils/RubyHelper.java +37 -0
- data/jubilee.gemspec +101 -14
- data/lib/jubilee.rb +4 -3
- data/lib/jubilee/cli.rb +2 -1
- data/lib/jubilee/configuration.rb +4 -9
- data/lib/jubilee/const.rb +2 -2
- data/lib/jubilee/jubilee.jar +0 -0
- data/lib/jubilee/response.rb +9 -8
- data/lib/jubilee/server.rb +1 -1
- data/lib/jubilee/version.rb +8 -1
- data/lib/rack/chunked.rb +38 -0
- data/spec/apps/rack/basic/config.ru +50 -0
- data/spec/apps/rails4/basic/.gitignore +16 -0
- data/spec/apps/rails4/basic/Gemfile +41 -0
- data/spec/apps/rails4/basic/Gemfile.lock +127 -0
- data/spec/apps/rails4/basic/README.rdoc +28 -0
- data/spec/apps/rails4/basic/Rakefile +6 -0
- data/spec/apps/rails4/basic/app/assets/images/.keep +0 -0
- data/spec/apps/rails4/basic/app/assets/images/rails.png +0 -0
- data/spec/apps/rails4/basic/app/assets/javascripts/application.js +16 -0
- data/spec/apps/rails4/basic/app/assets/stylesheets/application.css +13 -0
- data/spec/apps/rails4/basic/app/controllers/application_controller.rb +5 -0
- data/spec/apps/rails4/basic/app/controllers/concerns/.keep +0 -0
- data/spec/apps/rails4/basic/app/controllers/reloader_controller.rb +11 -0
- data/spec/apps/rails4/basic/app/controllers/reloader_controller.rb.erb +11 -0
- data/spec/apps/rails4/basic/app/controllers/root_controller.rb +14 -0
- data/spec/apps/rails4/basic/app/helpers/application_helper.rb +2 -0
- data/spec/apps/rails4/basic/app/mailers/.keep +0 -0
- data/spec/apps/rails4/basic/app/models/.keep +0 -0
- data/spec/apps/rails4/basic/app/models/concerns/.keep +0 -0
- data/spec/apps/rails4/basic/app/views/layouts/application.html.erb +14 -0
- data/spec/apps/rails4/basic/app/views/reloader/index.html.erb +1 -0
- data/spec/apps/rails4/basic/app/views/root/index.html.erb +8 -0
- data/spec/apps/rails4/basic/app/views/root/streaming.html.erb +6 -0
- data/spec/apps/rails4/basic/bin/bundle +3 -0
- data/spec/apps/rails4/basic/bin/rails +4 -0
- data/spec/apps/rails4/basic/bin/rake +4 -0
- data/spec/apps/rails4/basic/config.ru +4 -0
- data/spec/apps/rails4/basic/config/application.rb +23 -0
- data/spec/apps/rails4/basic/config/boot.rb +4 -0
- data/spec/apps/rails4/basic/config/database.yml +20 -0
- data/spec/apps/rails4/basic/config/environment.rb +5 -0
- data/spec/apps/rails4/basic/config/environments/development.rb +29 -0
- data/spec/apps/rails4/basic/config/environments/production.rb +80 -0
- data/spec/apps/rails4/basic/config/environments/test.rb +36 -0
- data/spec/apps/rails4/basic/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/apps/rails4/basic/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/apps/rails4/basic/config/initializers/inflections.rb +16 -0
- data/spec/apps/rails4/basic/config/initializers/mime_types.rb +5 -0
- data/spec/apps/rails4/basic/config/initializers/secret_token.rb +12 -0
- data/spec/apps/rails4/basic/config/initializers/session_store.rb +2 -0
- data/spec/apps/rails4/basic/config/initializers/wrap_parameters.rb +14 -0
- data/spec/apps/rails4/basic/config/locales/en.yml +23 -0
- data/spec/apps/rails4/basic/config/routes.rb +5 -0
- data/spec/apps/rails4/basic/db/seeds.rb +7 -0
- data/spec/apps/rails4/basic/lib/assets/.keep +0 -0
- data/spec/apps/rails4/basic/lib/tasks/.keep +0 -0
- data/spec/apps/rails4/basic/public/404.html +58 -0
- data/spec/apps/rails4/basic/public/422.html +58 -0
- data/spec/apps/rails4/basic/public/500.html +57 -0
- data/spec/apps/rails4/basic/public/favicon.ico +0 -0
- data/spec/apps/rails4/basic/public/robots.txt +5 -0
- data/spec/apps/rails4/basic/public/some_page.html +7 -0
- data/spec/apps/rails4/basic/test/controllers/.keep +0 -0
- data/spec/apps/rails4/basic/test/fixtures/.keep +0 -0
- data/spec/apps/rails4/basic/test/helpers/.keep +0 -0
- data/spec/apps/rails4/basic/test/integration/.keep +0 -0
- data/spec/apps/rails4/basic/test/mailers/.keep +0 -0
- data/spec/apps/rails4/basic/test/models/.keep +0 -0
- data/spec/apps/rails4/basic/test/test_helper.rb +15 -0
- data/spec/apps/rails4/basic/vendor/assets/javascripts/.keep +0 -0
- data/spec/apps/rails4/basic/vendor/assets/stylesheets/.keep +0 -0
- data/spec/apps/sinatra/basic/Gemfile +4 -0
- data/spec/apps/sinatra/basic/Gemfile.lock +20 -0
- data/spec/apps/sinatra/basic/basic.rb +27 -0
- data/spec/apps/sinatra/basic/config.ru +7 -0
- data/spec/apps/sinatra/basic/public/some_page.html +7 -0
- data/spec/apps/sinatra/basic/views/index.erb +4 -0
- data/spec/apps/sinatra/basic/views/posted.haml +2 -0
- data/spec/apps/sinatra/basic/views/poster.haml +4 -0
- data/spec/apps/sinatra/basic/views/request_mapping.haml +4 -0
- data/spec/integration/basic_rack_spec.rb +89 -0
- data/spec/integration/basic_rails4_spec.rb +64 -0
- data/spec/integration/basic_sinatra_spec.rb +80 -0
- data/spec/spec_helper.rb +13 -0
- data/test/jubilee/test_cli.rb +1 -1
- data/test/jubilee/test_configuration.rb +18 -1
- data/test/jubilee/test_rack_server.rb +7 -7
- data/test/jubilee/test_response.rb +35 -36
- data/test/jubilee/test_server.rb +1 -1
- data/test/jubilee/test_upload.rb +14 -11
- data/test/test_helper.rb +1 -0
- metadata +97 -18
- data/VERSION +0 -1
- data/jars/vertx-core-2.1.0-SNAPSHOT.jar +0 -0
- data/java/src/org/jruby/jubilee/RackErrors.java +0 -44
- data/java/src/org/jruby/jubilee/impl/DefaultRackEnvironment.java +0 -99
- data/java/src/org/jruby/jubilee/impl/RubyIORackErrors.java +0 -68
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
1.0.2
|
Binary file
|
@@ -1,44 +0,0 @@
|
|
1
|
-
package org.jruby.jubilee;
|
2
|
-
|
3
|
-
/**
|
4
|
-
* Created with IntelliJ IDEA.
|
5
|
-
* User: isaiah
|
6
|
-
* Date: 11/26/12
|
7
|
-
* Time: 12:01 PM
|
8
|
-
*/
|
9
|
-
import org.jruby.runtime.ThreadContext;
|
10
|
-
import org.jruby.runtime.builtin.IRubyObject;
|
11
|
-
|
12
|
-
public interface RackErrors {
|
13
|
-
/**
|
14
|
-
* puts must be called with a single argument that responds to to_s.
|
15
|
-
*
|
16
|
-
* @param context ruby context
|
17
|
-
* @param arg must respond to to_s
|
18
|
-
* @return nil
|
19
|
-
*/
|
20
|
-
IRubyObject puts( ThreadContext context, IRubyObject arg );
|
21
|
-
|
22
|
-
/**
|
23
|
-
* write must be called with a single argument that is a String.
|
24
|
-
*
|
25
|
-
* @param context ruby context
|
26
|
-
* @param string a Ruby String
|
27
|
-
* @return nil
|
28
|
-
*/
|
29
|
-
IRubyObject write( ThreadContext context, IRubyObject string );
|
30
|
-
|
31
|
-
/**
|
32
|
-
* flush must be called without arguments and must be called in order to make the error appear for sure.
|
33
|
-
*
|
34
|
-
* @return nil
|
35
|
-
*/
|
36
|
-
IRubyObject flush();
|
37
|
-
|
38
|
-
/**
|
39
|
-
* close must never be called on the error stream.
|
40
|
-
*
|
41
|
-
* @return nil
|
42
|
-
*/
|
43
|
-
IRubyObject close();
|
44
|
-
}
|
@@ -1,99 +0,0 @@
|
|
1
|
-
package org.jruby.jubilee.impl;
|
2
|
-
|
3
|
-
import org.jruby.Ruby;
|
4
|
-
import org.jruby.RubyHash;
|
5
|
-
import org.jruby.RubyString;
|
6
|
-
import org.jruby.jubilee.Const;
|
7
|
-
import org.jruby.jubilee.RackEnvironment;
|
8
|
-
import org.jruby.jubilee.RackInput;
|
9
|
-
import org.vertx.java.core.MultiMap;
|
10
|
-
import org.vertx.java.core.http.HttpServerRequest;
|
11
|
-
|
12
|
-
import java.util.Map;
|
13
|
-
|
14
|
-
/**
|
15
|
-
* Created with IntelliJ IDEA.
|
16
|
-
* User: isaiah
|
17
|
-
* Date: 11/26/12
|
18
|
-
* Time: 11:40 AM
|
19
|
-
*/
|
20
|
-
public class DefaultRackEnvironment implements RackEnvironment {
|
21
|
-
private RubyHash env;
|
22
|
-
private MultiMap headers;
|
23
|
-
private Ruby runtime;
|
24
|
-
|
25
|
-
public DefaultRackEnvironment(final Ruby runtime, final HttpServerRequest request, RackInput input, boolean isSSL) {
|
26
|
-
|
27
|
-
this.runtime = runtime;
|
28
|
-
// DEFAULT
|
29
|
-
env = RubyHash.newHash(runtime);
|
30
|
-
env.put(Const.RACK_VERSION, Const.RackVersion(runtime));
|
31
|
-
env.put(Const.RACK_ERRORS, new RubyIORackErrors(runtime));
|
32
|
-
env.put(Const.RACK_MULTITHREAD, true);
|
33
|
-
env.put(Const.RACK_MULTIPROCESS, false);
|
34
|
-
env.put(Const.RACK_RUNONCE, true);
|
35
|
-
if (isSSL)
|
36
|
-
env.put(Const.URL_SCHEME, Const.HTTPS);
|
37
|
-
else
|
38
|
-
env.put(Const.URL_SCHEME, Const.HTTP);
|
39
|
-
env.put(Const.SCRIPT_NAME, "");
|
40
|
-
|
41
|
-
env.put(Const.SERVER_PROTOCOL, Const.HTTP_11);
|
42
|
-
env.put(Const.SERVER_SOFTWARE, Const.JUBILEE_VERSION);
|
43
|
-
env.put(Const.GATEWAY_INTERFACE, Const.CGI_VER);
|
44
|
-
|
45
|
-
// Parse request headers
|
46
|
-
headers = request.headers();
|
47
|
-
String host;
|
48
|
-
if ((host = headers.get(Const.Vertx.HOST)) != null) {
|
49
|
-
int colon = host.indexOf(":");
|
50
|
-
if (colon > 0) {
|
51
|
-
env.put(Const.SERVER_NAME, host.substring(0, colon));
|
52
|
-
env.put(Const.SERVER_PORT, host.substring(colon + 1));
|
53
|
-
} else {
|
54
|
-
env.put(Const.SERVER_NAME, host);
|
55
|
-
env.put(Const.SERVER_PORT, Const.PORT_80);
|
56
|
-
}
|
57
|
-
|
58
|
-
} else {
|
59
|
-
env.put(Const.SERVER_NAME, Const.LOCALHOST);
|
60
|
-
env.put(Const.SERVER_PORT, Const.PORT_80);
|
61
|
-
}
|
62
|
-
|
63
|
-
env.put(Const.RACK_INPUT, input);
|
64
|
-
env.put(Const.REQUEST_METHOD, request.method());
|
65
|
-
env.put(Const.REQUEST_PATH, request.path());
|
66
|
-
env.put(Const.REQUEST_URI, request.uri());
|
67
|
-
env.put(Const.QUERY_STRING, orEmpty(request.query()));
|
68
|
-
env.put(Const.REMOTE_ADDR, request.remoteAddress().getHostString());
|
69
|
-
env.put(Const.HTTP_HOST, host);
|
70
|
-
env.put(Const.HTTP_COOKIE, orEmpty(headers.get(Const.Vertx.COOKIE)));
|
71
|
-
env.put(Const.HTTP_USER_AGENT, headers.get(Const.Vertx.USER_AGENT));
|
72
|
-
env.put(Const.HTTP_ACCEPT, headers.get(Const.Vertx.ACCEPT));
|
73
|
-
env.put(Const.HTTP_ACCEPT_LANGUAGE, orEmpty(headers.get(Const.Vertx.ACCEPT_LANGUAGE)));
|
74
|
-
env.put(Const.HTTP_ACCEPT_ENCODING, orEmpty(headers.get(Const.Vertx.ACCEPT_ENCODING)));
|
75
|
-
env.put(Const.HTTP_CONNECTION, orEmpty(headers.get(Const.Vertx.CONNECTION)));
|
76
|
-
env.put(Const.HTTP_CONTENT_TYPE, orEmpty(headers.get(Const.Vertx.CONTENT_TYPE)));
|
77
|
-
|
78
|
-
String contentLength;
|
79
|
-
if ((contentLength = headers.get(Const.Vertx.CONTENT_LENGTH)) != null)
|
80
|
-
env.put(Const.HTTP_CONTENT_LENGTH, contentLength);
|
81
|
-
env.put(Const.PATH_INFO, request.path());
|
82
|
-
|
83
|
-
// Additional headers
|
84
|
-
for (Map.Entry<String, String> var : Const.ADDITIONAL_HEADERS.entrySet())
|
85
|
-
setRackHeader(var.getKey(), var.getValue());
|
86
|
-
}
|
87
|
-
|
88
|
-
public RubyHash getEnv() {
|
89
|
-
return env;
|
90
|
-
}
|
91
|
-
|
92
|
-
private RubyString orEmpty(String jString) {
|
93
|
-
return jString == null ? RubyString.newEmptyString(runtime) : RubyString.newString(runtime, jString);
|
94
|
-
}
|
95
|
-
|
96
|
-
private void setRackHeader(String vertxHeader, String rackHeader) {
|
97
|
-
if (headers.contains(vertxHeader)) env.put(rackHeader, headers.get(vertxHeader));
|
98
|
-
}
|
99
|
-
}
|
@@ -1,68 +0,0 @@
|
|
1
|
-
package org.jruby.jubilee.impl;
|
2
|
-
|
3
|
-
import org.jruby.Ruby;
|
4
|
-
import org.jruby.RubyClass;
|
5
|
-
import org.jruby.RubyModule;
|
6
|
-
import org.jruby.RubyObject;
|
7
|
-
import org.jruby.anno.JRubyMethod;
|
8
|
-
import org.jruby.jubilee.RackErrors;
|
9
|
-
import org.jruby.runtime.ObjectAllocator;
|
10
|
-
import org.jruby.runtime.ThreadContext;
|
11
|
-
import org.jruby.runtime.builtin.IRubyObject;
|
12
|
-
|
13
|
-
/**
|
14
|
-
* Created with IntelliJ IDEA.
|
15
|
-
* User: isaiah
|
16
|
-
* Date: 11/26/12
|
17
|
-
* Time: 12:03 PM
|
18
|
-
*/
|
19
|
-
public class RubyIORackErrors extends RubyObject implements RackErrors {
|
20
|
-
|
21
|
-
public static RubyClass createRubyIORackErrorsClass(Ruby runtime) {
|
22
|
-
RubyModule jModule = runtime.defineModule("Jubilee");
|
23
|
-
RubyClass rackErrorsClass = jModule.defineClassUnder("RubyIORackErrors", runtime.getObject(), ALLOCATOR);
|
24
|
-
rackErrorsClass.defineAnnotatedMethods(RubyIORackErrors.class);
|
25
|
-
return rackErrorsClass;
|
26
|
-
}
|
27
|
-
|
28
|
-
public static final ObjectAllocator ALLOCATOR = new ObjectAllocator() {
|
29
|
-
@Override
|
30
|
-
public IRubyObject allocate(Ruby ruby, RubyClass rubyClass) {
|
31
|
-
return new RubyIORackErrors(ruby, rubyClass);
|
32
|
-
}
|
33
|
-
};
|
34
|
-
|
35
|
-
public RubyIORackErrors(Ruby runtime, RubyClass metaClass) {
|
36
|
-
super(runtime, metaClass);
|
37
|
-
}
|
38
|
-
|
39
|
-
public RubyIORackErrors(Ruby runtime) {
|
40
|
-
super(runtime, createRubyIORackErrorsClass(runtime));
|
41
|
-
}
|
42
|
-
|
43
|
-
@Override
|
44
|
-
@JRubyMethod(name = "puts")
|
45
|
-
public IRubyObject puts(ThreadContext context, IRubyObject arg) {
|
46
|
-
//getRuntime().getOutputStream().println(arg.toString());
|
47
|
-
return null; //To change body of implemented methods use File | Settings | File Templates.
|
48
|
-
}
|
49
|
-
|
50
|
-
@Override
|
51
|
-
@JRubyMethod
|
52
|
-
public IRubyObject write(ThreadContext context, IRubyObject string) {
|
53
|
-
//getRuntime().getOutputStream().println(string.toString());
|
54
|
-
return null; //To change body of implemented methods use File | Settings | File Templates.
|
55
|
-
}
|
56
|
-
|
57
|
-
@Override
|
58
|
-
@JRubyMethod
|
59
|
-
public IRubyObject flush() {
|
60
|
-
return null; //To change body of implemented methods use File | Settings | File Templates.
|
61
|
-
}
|
62
|
-
|
63
|
-
@Override
|
64
|
-
@JRubyMethod
|
65
|
-
public IRubyObject close() {
|
66
|
-
return null; //To change body of implemented methods use File | Settings | File Templates.
|
67
|
-
}
|
68
|
-
}
|