I ran into the same issue a while back and dpp stated it was, if not
entirely by design, then due to the way stateless/stateful handling
turned out.
I also think this is less than optimal for the same reasons you state
and I was planning to look into this at some point but haven't had the
time.
/Jeppe
--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code
I think the ideal solution is for LoanWrappers to have a single
invocation per request and be able to check for S.statefulRequest_? to
determine if state is available. But I guess this was difficult with
the current setup (I haven't looked at the code yet :-)
How would LoanWrappers that depend on state behave in a stateless
request? Perhaps we should have both addAroundStateful &
addAroundStateless....
/Jeppe
/Jeppe
--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code
Ok, we can't get much earlier in the request than the Servlet Filter so that makes sense to me. If we wanted to go the add/deprecate route maybe an S.addAroundStateless (S.addAroundEarly?) that happens at that point and then an S.addAroundStateful that occurs when the stateful session is initialized? If something along those lines gets implemented I wonder if it might makes sense to re-think the name LoanWrapper as well. It may just be me, but on first look I had no idea what that meant. I think that something like RequestWrapper would be easier for newbies to grasp and similar enough to not throw experienced Lifters off too much.
On Fri, Dec 23, 2011 at 2:29 PM, David Whittaker <da...@iradix.com> wrote:
Ok, we can't get much earlier in the request than the Servlet Filter so that makes sense to me. If we wanted to go the add/deprecate route maybe an S.addAroundStateless (S.addAroundEarly?) that happens at that point and then an S.addAroundStateful that occurs when the stateful session is initialized? If something along those lines gets implemented I wonder if it might makes sense to re-think the name LoanWrapper as well. It may just be me, but on first look I had no idea what that meant. I think that something like RequestWrapper would be easier for newbies to grasp and similar enough to not throw experienced Lifters off too much.The "Loan" pattern was an early Scala pattern: https://wiki.scala-lang.org/display/SYGN/Loan I'd prefer to keep the name, if for no other reason than to pay homage to Scala's roots.
I also think the addAllAround should be on LiftRules, not S, because it's no longer got anything to do with S.
On Fri, Dec 23, 2011 at 2:29 PM, David Whittaker <da...@iradix.com> wrote:
Ok, we can't get much earlier in the request than the Servlet Filter so that makes sense to me. If we wanted to go the add/deprecate route maybe an S.addAroundStateless (S.addAroundEarly?) that happens at that point and then an S.addAroundStateful that occurs when the stateful session is initialized? If something along those lines gets implemented I wonder if it might makes sense to re-think the name LoanWrapper as well. It may just be me, but on first look I had no idea what that meant. I think that something like RequestWrapper would be easier for newbies to grasp and similar enough to not throw experienced Lifters off too much.The "Loan" pattern was an early Scala pattern: https://wiki.scala-lang.org/display/SYGN/Loan I'd prefer to keep the name, if for no other reason than to pay homage to Scala's roots.Ah, I'd never seen that before. Ok, I've got no argument there.I also think the addAllAround should be on LiftRules, not S, because it's no longer got anything to do with S.Good point. Does addAllAround sound right to you though?
It feels to me like a method with that name should accept a list.
How about () => LoanWrapperOrListOfLoanWrapper
That way you can have some nice implicits to do either a single loan wrapper or a list of loan wrappers?
How about () => LoanWrapperOrListOfLoanWrapper
That way you can have some nice implicits to do either a single loan wrapper or a list of loan wrappers?I know the ability to pass a List exists in the current implementation, but is it commonly used?
Ok, should I create a ticket?
Ok, http://www.assembla.com/spaces/liftweb/tickets/1177-single-loanwrapper-invocation-per-request created. David, I took the liberty of assigning it to you since you mentioned earlier that you would be willing to implement. Hopefully that's ok.
Good point. Does addAllAround sound right to you though? It feels to me like a method with that name should accept a list. Maybe S.aroundService / LiftRules.aroundService? I think aroundRequest would be the most self explanatory but the request & response are wrapped I suppose it could be confusing.
--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code