Class: Pangrid::Servlet
- Inherits:
-
WEBrick::HTTPServlet::AbstractServlet
- Object
- WEBrick::HTTPServlet::AbstractServlet
- Pangrid::Servlet
- Defined in:
- lib/pangrid/frontend/webrick.rb
Instance Method Summary collapse
Instance Method Details
#do_GET(request, response) ⇒ Object
9 10 11 12 13 14 |
# File 'lib/pangrid/frontend/webrick.rb', line 9 def do_GET (request, response) template = IO.read(TEMPLATE) response.status = 200 response.content_type = "text/html" response.body = template % "" end |
#do_POST(request, response) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/pangrid/frontend/webrick.rb', line 16 def do_POST(request, response) input = request.query["filedata"] from = Plugin.get(request.query["from"]) to = Plugin.get(request.query["to"]) reader = from.new writer = to.new out = nil begin out = writer.write(reader.read(input)) rescue Exception => e out = e.inspect end template = IO.read(TEMPLATE) response.status = 200 response.content_type = "text/html" response.body = template % out end |