lib/fishwife/rack_servlet.rb
# Takes an incoming request (as a Java Servlet) and dispatches it
# to the rack application setup via [rackup].  All this really
# involves is translating the various bits of the Servlet API into
# the Rack API on the way in, and translating the response back on
# the way out.
Takes an incoming request (as a Java Servlet) and dispatches it
to the rack application setup via [rackup].  All this really
involves is translating the various bits of the Servlet API into
the Rack API on the way in, and translating the response back on
the way out.
Takes an incoming request ( as a Java Servlet ) and dispatches it to the rack application setup via [ rackup ] . All this really involves is translating the various bits of the Servlet API into the Rack API on the way in and translating the response back on the way out .
def service(request, response)
      env = servlet_to_rack(request)
      env['rack.java.servlet'] = true
      env['rack.java.servlet.request'] = request
      env['rack.java.servlet.response'] = response
      rack_response = @app.call(env)
      rack_to_servlet(rack_response, request, response)
      nil
    rescue RequestBodyTooLarge => e
      @log.warn( "On service: #{e.class.name}: #{e.message}" )
      response.sendError( 413 )
    rescue NativeException => n
      @log.warn( "On service (native): #{n.cause.to_string}" )
      raise n.cause
    rescue Exception => e
      @log.error( "On service: #{e}" )
      raise e
    ensure
      fin = env && env['fishwife.input']
      fin.close if fin
    end
def service ( request , response ) env = servlet_to_rack ( request ) env [ 'rack.java.servlet' ] = true env [ 'rack.java.servlet.request' ] = request env [ 'rack.java.servlet.response' ] = response rack_response = @app . call ( env ) rack_to_servlet ( rack_response , request , response ) nil rescue RequestBodyTooLarge => e @log . warn ( "On service: #{e.class.name}: #{e.message}" ) response . sendError ( 413 ) rescue NativeException => n @log . warn ( "On service (native): #{n.cause.to_string}" ) raise n . cause rescue Exception => e @log . error ( "On service: #{e}" ) raise e ensure fin = env && env [ 'fishwife.input' ] fin . close if fin end
Takes an incoming request (as a Java Servlet) and dispatches it
to the rack application setup via [rackup].
Takes an incoming request ( as a Java Servlet ) and dispatches it to the rack application setup via [ rackup ] .
# Turn the ServletRequest into a Rack env hash # Add our own special bits to the rack environment so that Rack # middleware can have access to the Java internals.
request
<not_specific>
response
<not_specific>