SlideShare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our User Agreement and Privacy Policy.
SlideShare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our Privacy Policy and User Agreement for details.
Successfully reported this slideshow.
Activate your 30 day free trial to unlock unlimited reading.
4.
Front Controller
ActionServlet RequestProcessor Action
processActionPerform
process
execute
5.
Front Controller
ActionServlet RequestProcessor Action
processActionPerform
process
execute
6.
JRubyRequestController
Struts RequestProcessor
Ruby
class RubyActionRequestProcessor
def process_action_form req, res, mapping
# do something
end
def process_action_perform req, res, action, form, mapping
# do something
end
end
7.
JRubyRequestController.java
public class JRubyRequestProcessor
extends RequestProcessor {
...
@Override
public void init(ActionServlet servlet,
ModuleConfig moduleConfig)
throws ServletException {
super.init(servlet, moduleConfig);
...
16.
SinatraRequestProcessor
class SinatraRequestProcessor
def initialize
@app = SinatraHelloAction.new
end
def process req, res
servlet_env = ServletRackEnvironment.new req
env = Rack::Handler::LazyEnv.new servlet_env
status, header, body = @app.call env.to_hash
res.setStatus(status)
header.each do |k, v|
res.setHeader(k, v)
end
out = res.getOutputStream
out.print(body.join)
end
end