Class: Serve::RedirectHandler

Inherits:
FileTypeHandler show all
Defined in:
lib/serve/handlers/redirect_handler.rb

Overview

:nodoc:

Instance Method Summary collapse

Methods inherited from FileTypeHandler

#content_type, extension, find, handlers, #initialize, #parse

Constructor Details

This class inherits a constructor from Serve::FileTypeHandler

Instance Method Details

#process(request, response) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/serve/handlers/redirect_handler.rb', line 5

def process(request, response)
  url = super.strip
  unless url =~ %r{^\w[\w\d+.-]*:.*}
    url = request.protocol + request.host_with_port + url
  end
  response.redirect(url, '302')
end