Warbler generated war for Sinatra App Sub-URI (URL-Routing) issues

Hi,

I implemented a small jruby sinatra app and if i run it directly on
WEBrick locally all the routings work perfectly. However when I deploy
the war file (i use warbler) to a server instance (like
http://www.example.com/myapp or localhost:8080/myapp) I have routing
issues, 404 errors and failures to find the application’s static assets
like CSS and Javascripts.

For example:

···

-------------------------------------------
get '/' do
   redirect '/login' if not_logged_in
   slim :home
end

get '/login' do
   slim :login
end

--------------------------------------------

When the user is not logged in, instead of redirecting to
example.com/myapp/login sinatra redirects him to example.com/login .

I tried using redirect to('/login') but it didn't work either.

What should i do so that redirections happen relatively?
For the URIs of images, css files what kind of link structure should i
use so that using war file doesn't cause any issues.

Thanks a lot!

Thanks a lot!!

--
Posted via http://www.ruby-forum.com/.