Class: Aspera::WebAuth::Servlet
- Inherits:
-
WEBrick::HTTPServlet::AbstractServlet
- Object
- WEBrick::HTTPServlet::AbstractServlet
- Aspera::WebAuth::Servlet
- Defined in:
- lib/aspera/web_auth/server.rb
Overview
servlet called on callback: it records the callback request
Instance Method Summary collapse
-
#initialize(server, web_auth) ⇒ Servlet
constructor
A new instance of Servlet.
-
#service(request, response) ⇒ Object
called on request.
Constructor Details
Instance Method Details
#service(request, response) ⇒ Object
called on request
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/aspera/web_auth/server.rb', line 21 def service(request, response) Log.log.debug { "received request from browser #{request.request_method} #{request.path}" } Aspera.assert_values(request.request_method, ['GET'], type: WEBrick::HTTPStatus::MethodNotAllowed) { "Unsupported method: #{req.request_method}" } Aspera.assert_values(request.path, ['/'], type: WEBrick::HTTPStatus::NotFound) { "Unsupported path: #{req.request_method}" } # response to browser response.status = 200 response.content_type = 'text/html' response.body = File.read("#{__dir__}/index.html").gsub('__ADD_INFO__', @web_auth.info_html) # continue internal processing @web_auth.signal_request(request) nil end |