Class: ProxyServer
- Inherits:
-
Object
- Object
- ProxyServer
- Defined in:
- lib/proxy_server.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize(site, options) ⇒ ProxyServer
constructor
A new instance of ProxyServer.
- #run ⇒ Object
- #set_mime_types ⇒ Object
Constructor Details
#initialize(site, options) ⇒ ProxyServer
Returns a new instance of ProxyServer.
2 3 4 5 6 7 |
# File 'lib/proxy_server.rb', line 2 def initialize(site, ) @site = site @options = set_mime_types end |
Instance Method Details
#run ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/proxy_server.rb', line 9 def run site = @site site.login_to_server server = Mongrel::Configurator.new host: "0.0.0.0", port: @options[:port] do listener do uri "/", handler: VaeSiteServlet.new(site) end trap("INT") { raise Mongrel::StopServer } run end puts "Vae is in action at http://localhost:#{@options[:port]}/" puts " (hit Control+C to exit)" begin server.join rescue Mongrel::StopServer end end |
#set_mime_types ⇒ Object
29 30 31 32 |
# File 'lib/proxy_server.rb', line 29 def set_mime_types WEBrick::HTTPUtils::DefaultMimeTypes.store 'js', 'application/javascript' WEBrick::HTTPUtils::DefaultMimeTypes.store 'svg', 'image/svg+xml' end |