Re: [Lift] Newbie Q: can I manually create a LiftSession?

2010-03-06 Thread dave dearing
I opened a ticket (#406) in response to this and attached a modified version
of the hello world archetype.

https://liftweb.assembla.com/spaces/liftweb/tickets/406-create-init-a-liftsession-from-outside-a-lift-handled-request

Just let me know if anything is unclear!
dave

On Thu, Mar 4, 2010 at 10:30 AM, David Pollak  wrote:

> Do you want to create/access a LiftSession from outside a Lift-handed
> request, but make sure the same LiftSession is available when you access the
> Lift parts of your app? (sorry, I want to make sure I understand the
> problem)
>
> Right now, there's no good way to do that... sorry :-(
>
> Feel encouraged to open a ticket on it at
> https://liftweb.assembla.com/spaces/liftweb/tickets  It'd be ideal if you
> could include a test application so we could verify it was doing the right
> thing.
>
> On Wed, Mar 3, 2010 at 6:04 PM, David Dearing  wrote:
>
>> I'm new to Lift and am trying to use Lift within a subpath of my web
>> application.  For example, http://domain.com is an existing webapp,
>> but my LiftFilter handles the "user_mgt" subpath (http://domain.com/
>> user_mgt/* ).  My existing webapp
>> already handles user authentication,
>> but I want to use the lost/change password functionality of Lift's
>> MegaProtoUser.
>>
>> How do I create a LiftSession from my existing webapp so that I can
>> call User.logUserIn(my_user)?
>>
>> I am embedding my User.logUserIn call within S.initIfUninitted like
>> this:
>>   S.initIfUninitted(my_lift_session.openOr(** SOMETHING? **))
>>   {
>>  User.logUserIn(user)
>>   }
>>
>> If a LiftSession exists, I can retrieve it and it works fine:
>>   val my_lift_session = SessionMaster.getSession(current_session_id,
>> Empty)
>>
>> However, when my_lift_session is Empty, I have tried:
>>   LiftRules.sessionCreator(new
>> provider.servlet.HTTPServletSession(current_session), ""))
>>
>> which appears to create a new LiftSession, but when I actually
>> navigate to a page in the subpath
>> http://domain.com/user_mgt/change_password
>> it doesn't recognize that I've logged in.  Perhaps when I load the
>> page http://domain.com/user_mgt/change_password it is creating a new
>> LiftSession even though one already exists?
>>
>> I've been banging my head on this for a while.
>> Any help would be greatly appreciated!
>> dave
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Lift" group.
>> To post to this group, send email to lift...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> liftweb+unsubscr...@googlegroups.com
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/liftweb?hl=en.
>>
>>
>
>
> --
> Lift, the simply functional web framework http://liftweb.net
> Beginning Scala http://www.apress.com/book/view/1430219890
> Follow me: http://twitter.com/dpp
> Surf the harmonics
>
> --
> You received this message because you are subscribed to the Google Groups
> "Lift" group.
> To post to this group, send email to lift...@googlegroups.com.
> To unsubscribe from this group, send email to
> liftweb+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/liftweb?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@googlegroups.com.
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en.



Re: [Lift] Newbie Q: can I manually create a LiftSession?

2010-03-04 Thread dave dearing
I think you're understanding (and I've accurately described) the problem...

I have servlets that are accessed outside of Lift and essentially I'd like
to have something like this work:

  S.session.map(s => {
 val my_lift_session = SessionMaster.getSession(s.uniqueId, Empty)
 log("[S.inStatefulScope?] " + S.inStatefulScope_?) // true?
 // do stuff with User.logUserIn, etc.
  }))

Just to make sure I'm not missing something, I've got my web.xml LiftFilter
set to /* and bypassing the subpaths that I don't want Lift to catch with:

  LiftRules.liftRequest.append {
case Req("myapp" :: "user_mgt" :: _, _, _) => true
case _ => false
  }

and I am NOT setting *passNotFoundToChain *to true because that gives
me "Client
did
not send n bytes as expected" errors

So, not currently possible?
dave


On Thu, Mar 4, 2010 at 10:30 AM, David Pollak  wrote:

> Do you want to create/access a LiftSession from outside a Lift-handed
> request, but make sure the same LiftSession is available when you access the
> Lift parts of your app? (sorry, I want to make sure I understand the
> problem)
>
> Right now, there's no good way to do that... sorry :-(
>
> Feel encouraged to open a ticket on it at
> https://liftweb.assembla.com/spaces/liftweb/tickets  It'd be ideal if you
> could include a test application so we could verify it was doing the right
> thing.
>
> On Wed, Mar 3, 2010 at 6:04 PM, David Dearing  wrote:
>
>> I'm new to Lift and am trying to use Lift within a subpath of my web
>> application.  For example, http://domain.com is an existing webapp,
>> but my LiftFilter handles the "user_mgt" subpath (http://domain.com/
>> user_mgt/* ).  My existing webapp
>> already handles user authentication,
>> but I want to use the lost/change password functionality of Lift's
>> MegaProtoUser.
>>
>> How do I create a LiftSession from my existing webapp so that I can
>> call User.logUserIn(my_user)?
>>
>> I am embedding my User.logUserIn call within S.initIfUninitted like
>> this:
>>   S.initIfUninitted(my_lift_session.openOr(** SOMETHING? **))
>>   {
>>  User.logUserIn(user)
>>   }
>>
>> If a LiftSession exists, I can retrieve it and it works fine:
>>   val my_lift_session = SessionMaster.getSession(current_session_id,
>> Empty)
>>
>> However, when my_lift_session is Empty, I have tried:
>>   LiftRules.sessionCreator(new
>> provider.servlet.HTTPServletSession(current_session), ""))
>>
>> which appears to create a new LiftSession, but when I actually
>> navigate to a page in the subpath
>> http://domain.com/user_mgt/change_password
>> it doesn't recognize that I've logged in.  Perhaps when I load the
>> page http://domain.com/user_mgt/change_password it is creating a new
>> LiftSession even though one already exists?
>>
>> I've been banging my head on this for a while.
>> Any help would be greatly appreciated!
>> dave
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Lift" group.
>> To post to this group, send email to lift...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> liftweb+unsubscr...@googlegroups.com
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/liftweb?hl=en.
>>
>>
>
>
> --
> Lift, the simply functional web framework http://liftweb.net
> Beginning Scala http://www.apress.com/book/view/1430219890
> Follow me: http://twitter.com/dpp
> Surf the harmonics
>
> --
> You received this message because you are subscribed to the Google Groups
> "Lift" group.
> To post to this group, send email to lift...@googlegroups.com.
> To unsubscribe from this group, send email to
> liftweb+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/liftweb?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@googlegroups.com.
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en.



Re: [Lift] Newbie Q: can I manually create a LiftSession?

2010-03-04 Thread David Pollak
Do you want to create/access a LiftSession from outside a Lift-handed
request, but make sure the same LiftSession is available when you access the
Lift parts of your app? (sorry, I want to make sure I understand the
problem)

Right now, there's no good way to do that... sorry :-(

Feel encouraged to open a ticket on it at
https://liftweb.assembla.com/spaces/liftweb/tickets  It'd be ideal if you
could include a test application so we could verify it was doing the right
thing.

On Wed, Mar 3, 2010 at 6:04 PM, David Dearing  wrote:

> I'm new to Lift and am trying to use Lift within a subpath of my web
> application.  For example, http://domain.com is an existing webapp,
> but my LiftFilter handles the "user_mgt" subpath (http://domain.com/
> user_mgt/* ).  My existing webapp already
> handles user authentication,
> but I want to use the lost/change password functionality of Lift's
> MegaProtoUser.
>
> How do I create a LiftSession from my existing webapp so that I can
> call User.logUserIn(my_user)?
>
> I am embedding my User.logUserIn call within S.initIfUninitted like
> this:
>   S.initIfUninitted(my_lift_session.openOr(** SOMETHING? **))
>   {
>  User.logUserIn(user)
>   }
>
> If a LiftSession exists, I can retrieve it and it works fine:
>   val my_lift_session = SessionMaster.getSession(current_session_id,
> Empty)
>
> However, when my_lift_session is Empty, I have tried:
>   LiftRules.sessionCreator(new
> provider.servlet.HTTPServletSession(current_session), ""))
>
> which appears to create a new LiftSession, but when I actually
> navigate to a page in the subpath
> http://domain.com/user_mgt/change_password
> it doesn't recognize that I've logged in.  Perhaps when I load the
> page http://domain.com/user_mgt/change_password it is creating a new
> LiftSession even though one already exists?
>
> I've been banging my head on this for a while.
> Any help would be greatly appreciated!
> dave
>
> --
> You received this message because you are subscribed to the Google Groups
> "Lift" group.
> To post to this group, send email to lift...@googlegroups.com.
> To unsubscribe from this group, send email to
> liftweb+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/liftweb?hl=en.
>
>


-- 
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Surf the harmonics

-- 
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@googlegroups.com.
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en.



[Lift] Newbie Q: can I manually create a LiftSession?

2010-03-03 Thread David Dearing
I'm new to Lift and am trying to use Lift within a subpath of my web
application.  For example, http://domain.com is an existing webapp,
but my LiftFilter handles the "user_mgt" subpath (http://domain.com/
user_mgt/*).  My existing webapp already handles user authentication,
but I want to use the lost/change password functionality of Lift's
MegaProtoUser.

How do I create a LiftSession from my existing webapp so that I can
call User.logUserIn(my_user)?

I am embedding my User.logUserIn call within S.initIfUninitted like
this:
   S.initIfUninitted(my_lift_session.openOr(** SOMETHING? **))
   {
  User.logUserIn(user)
   }

If a LiftSession exists, I can retrieve it and it works fine:
   val my_lift_session = SessionMaster.getSession(current_session_id,
Empty)

However, when my_lift_session is Empty, I have tried:
   LiftRules.sessionCreator(new
provider.servlet.HTTPServletSession(current_session), ""))

which appears to create a new LiftSession, but when I actually
navigate to a page in the subpath http://domain.com/user_mgt/change_password
it doesn't recognize that I've logged in.  Perhaps when I load the
page http://domain.com/user_mgt/change_password it is creating a new
LiftSession even though one already exists?

I've been banging my head on this for a while.
Any help would be greatly appreciated!
dave

-- 
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@googlegroups.com.
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en.