Why #httpServletRequest/#httpSession and not #request/#session?

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Why #httpServletRequest/#httpSession and not #request/#session?

Emanuel
Administrator
This one's been bugging me for a while, but why do the request/session expression objects have such long names?  Does using #request/#session create some kind of problem, or are the request/session objects already available inside expressions as just request/session?

Would it be a lot of effort to rename them to #request/#session?
Reply | Threaded
Open this post in threaded view
|

Re: Why #httpServletRequest/#httpSession and not #request/#session?

danielfernandez
Administrator
This was made just in order to avoid collision with the "request", "param", "session" and "application" variables prefixes (without the '#'), which in contain, respectively, request attributes, request parameters, session attributes and servlet context attributes.

Reply | Threaded
Open this post in threaded view
|

Re: Why #httpServletRequest/#httpSession and not #request/#session?

Emanuel
Administrator
Oh, so do those objects already exist?  So I can do:  ${request.requestURL}  ?
Reply | Threaded
Open this post in threaded view
|

Re: Why #httpServletRequest/#httpSession and not #request/#session?

danielfernandez
Administrator
Nope. You can do ${request.something} to access a request attribute with name "something". This is, an object that you (or your frameworks) have previously added to the request like:

request.setAttribute("something",myObject);

Similarly for: ${session.something}...

session.setAttribute("something",myObject);

etc.

But that ${request} object is not the HttpServletRequest object, but merely a map to which the request.getAttributeMap() contents have been extracted.

Reply | Threaded
Open this post in threaded view
|

Re: Why #httpServletRequest/#httpSession and not #request/#session?

niels
Nice to know that #httpServletRequest and #httpSession are commonparameters. Why this not part of the documentation?

Niels

Reply | Threaded
Open this post in threaded view
|

Re: Why #httpServletRequest/#httpSession and not #request/#session?

Emanuel
Administrator
Reply | Threaded
Open this post in threaded view
|

Re: Why #httpServletRequest/#httpSession and not #request/#session?

niels
You are right I have searched in the wrong document.