Package org.jruby.rack

Examples of org.jruby.rack.RackApplication


                    "seems this listener is executing before the " +
                    "RackServletContextListener / RailsSevletContextListener !";
            log("[" + getClass().getName() + "] " + message);
            throw new IllegalStateException(message);
        }
        final RackApplication app;
        try {
            app = appFactory.getApplication();
        }
        catch (RackException e) {
            throw new UnsupportedOperationException(e); // rack/rails initialization failure
        }
        if ( app == null ) {
            throw new IllegalStateException("factory returned null app");
        }
        if ( app.getClass().getName().indexOf("ErrorApplication") != -1 ) {
            throw new UnsupportedOperationException("won't use error application runtime");
        }
        return app.getRuntime();
    }
View Full Code Here


    }
   
    @Test
    public void usesRuntimeFromRackApplication() {
        final Ruby runtime = Ruby.newInstance();
        RackApplication application = newMockRackApplication( runtime );
        RackApplicationFactory applicationFactory = newMockRackApplicationFactory( application );
        when( servletContext.getAttribute( "rack.factory" ) ).thenReturn( applicationFactory );
        //when( mockServletContext().getInitParameter( "jruby.worker.script" ) ).thenReturn( "nil" );

        assertSame(runtime, subject.getRuntime());
View Full Code Here

            this.queueName = name;
            this.rackFactory = context.getRackFactory();
        }

        public void onMessage(Message message) {
            RackApplication app = null;
            try {
                app = rackFactory.getApplication();
                Ruby runtime = app.getRuntime();
                RubyModule mod = runtime.getClassFromPath("JRuby::Rack::Queues");
                IRubyObject obj = mod.getConstant("Registry");
                rubyObjectAdapter.callMethod(obj, "receive_message", new IRubyObject[] {
                    JavaEmbedUtils.javaToRuby(runtime, queueName),
                    JavaEmbedUtils.javaToRuby(runtime, message)});
View Full Code Here

TOP

Related Classes of org.jruby.rack.RackApplication

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.