weavejester / hiccup

Fast library for rendering HTML in Clojure
http://weavejester.github.io/hiccup
Eclipse Public License 1.0
2.68k stars 174 forks source link

base-url #107

Closed yogthos closed 9 years ago

yogthos commented 9 years ago

The base-url in the middleware is using :context, should it be changed to :servlet-context since it was changed in Ring recently?

weavejester commented 9 years ago

Ring hasn't changed. The :servlet-context and :context keys are two different things.

The :servlet-context key is used for compatibility with legacy servlet systems, and contains a ServletContext object. The :context key is used in conjunction with the :path-info key, and is used to divide the :uri key into a prefix and suffix.

yogthos commented 9 years ago

Ah ok makes sense, I wasn't sure which context this was referring to, as originally Ring used :context for both the context macro and the servlet context.

weavejester commented 9 years ago

Actually, it didn't, but I don't blame you for thinking that. It's actually Lein-Ring that sneakily sets the :context and :path-info keys when you compile a war or uberwar (see the generate-handler function).

yogthos commented 9 years ago

That explains the why the :context has the servlet context by default then. If I recall correctly, that behavior interfered with the context macro though did it not?

weavejester commented 9 years ago

Nope. The context macro can deal with a pre-existing :context key, otherwise you wouldn't be able to nest it.

yogthos commented 9 years ago

So the servlet context is treated as the initial context then if present.

weavejester commented 9 years ago

Right.

yogthos commented 9 years ago

Great thanks for walking me through it. :)