noir-clojure / lib-noir

A set of libraries for ring apps, including stateful sessions.
Eclipse Public License 1.0
481 stars 47 forks source link

Update src/noir/response.clj #3

Closed yogthos closed 11 years ago

yogthos commented 11 years ago

When a Noir application is deployed on an application server, such as Tomcat, and given a context root then it is ignored by the redirect function.

Since a user might legitimately want to redirect to a different context, redirect can't infer the context implicitly. I added a new helper called local-redirect, which will prepend the servlet context when it's available in the ring-request.

This allows local redirects to work correctly for both standalone and application server deployments.

Raynes commented 11 years ago

Why does this need to be a macro?

yogthos commented 11 years ago

on a second thought I think you're right, there isn't any reason for it to be a macro. It could just be a function which appends the context. Also, the distinction might not be useful in most cases, so it might be better for redirect to check the context, and if somebody does need to access the root container url they could specify it explicitly with an absolute url.

Raynes commented 11 years ago

This is no longer relevant (since we're merging lib-luminus).