Reload Rack::URLMap at runtime

64 views
Skip to first unread message

michele

unread,
Nov 7, 2011, 8:31:56 AM11/7/11
to thin-ruby
Hi guys,

I'm recently rewriting a project using Thin + Rack instead of Webrick
+ custom implementations of AbstractServlet.
So far so good, I'm really happy with it, especially for performance.
90% of the code is ported successfully.

Anyway, I'm wondering if it's possible to reload URLs seen by Thin/
Rack after it's started.
I mean, adding new items to the Hash passed to Rack::URLMap after you
start Thin.

I need this because some modules of the application may need to bind
to /whatever.class for example Java applets, that will be served with
Rack::File.

I was playing a bit with Rack::URLMap.remap and Rack::Reloader with no
success.
Can you point me to the right direction?
I was also Googling a lot and reading the ruby docs, but I wasn't able
to find what I need.

Thanks for you help
Michele

michele

unread,
Nov 14, 2011, 4:53:04 AM11/14/11
to thin-ruby
At the end Rack::URLMap.remap did the trick,
so every time you add a URL/handler to the Rack mount map
you just shoot remap and Thin will be aware of that.

Thanks Marc for the suggestion offline ;)

Cheers
Michele

phorn...@athenacr.com

unread,
Jul 8, 2016, 10:58:31 AM7/8/16
to thin-ruby
michele, could you post the code that allowed you to add new mappings on the fly?

thanks!
Reply all
Reply to author
Forward
0 new messages