Package org.torquebox.web.rack

Examples of org.torquebox.web.rack.RackEnvironment


    }
   
    @Test
    public void testCall() throws Exception {
        RackApplicationComponent component = new RackApplicationComponent( this.rackApp );
        RackEnvironment env = mock( RackEnvironment.class );
        RubyHash envHash = RubyHash.newHash( this.ruby );
        when(env.getEnv()).thenReturn( envHash );
       
        Object response = component.call( env );
       
        assertNotNull( response );
       
View Full Code Here


            chain.doFilter( request, response );
        }
    }

    protected void doRack(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
        RackEnvironment rackEnv = null;

        Ruby runtime = null;
        RackApplicationComponent rackApp;
        try {
            runtime = this.runtimePool.borrowRuntime( "rack" );
            rackApp = (RackApplicationComponent) this.componentResolver.resolve( runtime );
            rackEnv = new RackEnvironment( runtime, request );
            rackApp.call( rackEnv ).respond( response );
        } catch (RaiseException e) {
            log.error( "Error invoking Rack filter", e );
            log.error( "Underlying Ruby exception", e.getCause() );
            throw new ServletException( e );
        } catch (Exception e) {
            log.error( "Error invoking Rack filter", e );
            throw new ServletException( e );
        } finally {
            if (rackEnv != null) {
                rackEnv.close();
            }

            if (runtime != null) {
                this.runtimePool.returnRuntime( runtime );
            }
View Full Code Here

TOP

Related Classes of org.torquebox.web.rack.RackEnvironment

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.