RequestVar context not restored when LiftRules.handleUnmappedParameter is executed?

23 views
Skip to first unread message

Andreas Joseph Krogh

unread,
Mar 12, 2015, 6:29:37 AM3/12/15
to lif...@googlegroups.com
Hi all.
 
I'm observing that in my LiftRules.handleUnmappedParameter handler requestvars seem to not be restored and their default-value is returned. Can somebody confirm this?
 
Thanks.
 
--
Andreas Joseph Krogh
CTO / Partner - Visena AS
Mobile: +47 909 56 963

Antonio Salazar Cardozo

unread,
Mar 12, 2015, 10:05:36 AM3/12/15
to lif...@googlegroups.com
Hmm… I don't think I've ever set it per-request, only the default. Any chance you can get
it boiled down to a minimal case?
Thanks,
Antonio

Andreas Joseph Krogh

unread,
Mar 12, 2015, 5:46:12 PM3/12/15
to lif...@googlegroups.com
På torsdag 12. mars 2015 kl. 15:05:36, skrev Antonio Salazar Cardozo <savedf...@gmail.com>:
Hmm… I don't think I've ever set it per-request, only the default. Any chance you can get
it boiled down to a minimal case?
Thanks,
Antonio
 
Now that I think of it, the expected request-var will never be set in situations where "handleUnmappedParameter" is used, righ? That is the whole purpose of "handleUnmappedParameter" is used is it not, because the mapping is GC'ed from the map and hence the request-var context for that page is in effect gone?
 
Or am I not making any sense?

Diego Medina

unread,
Mar 12, 2015, 5:48:52 PM3/12/15
to Lift

That's what I thought too, once lost, you would have to write some logic to get it back

Diego
Sent from my cell

--
--
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

---
You received this message because you are subscribed to the Google Groups "Lift" group.
To unsubscribe from this group and stop receiving emails from it, send an email to liftweb+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Diego Medina

unread,
Mar 12, 2015, 5:48:52 PM3/12/15
to Lift

That's what I thought too, once lost, you would have to write some logic to get it back

Diego
Sent from my cell

On Mar 12, 2015 5:46 PM, "Andreas Joseph Krogh" <and...@visena.com> wrote:
--

Antonio Salazar Cardozo

unread,
Mar 13, 2015, 4:29:52 PM3/13/15
to lif...@googlegroups.com
It depends on what situation you're trying to handle… But yeah, you're probably right, in most situations
you'd have lost your page state.
Thanks,
Antonio

Andreas Joseph Krogh

unread,
Mar 14, 2015, 6:29:19 AM3/14/15
to lif...@googlegroups.com
På fredag 13. mars 2015 kl. 21:29:52, skrev Antonio Salazar Cardozo <savedf...@gmail.com>:
It depends on what situation you're trying to handle… But yeah, you're probably right, in most situations
you'd have lost your page state.
Thanks,
Antonio
 
Yes, when the page-state is gone we hit handleUnmappedParameter. I store the current Locale in a request-var (which is initially retrieved from the URI) and was trying to give an i18n-message to the user that the page has timed out, but I have to re-think how to i18n that message now... Maybe I can use "Referer"-header in the reuquest to look for which URI made the unmapped AJAX-request.

Diego Medina

unread,
Mar 14, 2015, 7:51:14 AM3/14/15
to Lift
do you users change locale per request?

--
--
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

---
You received this message because you are subscribed to the Google Groups "Lift" group.
To unsubscribe from this group and stop receiving emails from it, send an email to liftweb+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Diego Medina
Lift/Scala consultant
di...@fmpwizard.com
http://fmpwizard.telegr.am

Andreas Joseph Krogh

unread,
Mar 14, 2015, 11:01:15 AM3/14/15
to lif...@googlegroups.com
På lørdag 14. mars 2015 kl. 12:51:11, skrev Diego Medina <di...@fmpwizard.com>:
do you users change locale per request?
 
Yes, they might. The application's URIs are constructed like this
 
/<locale>/stuff
 
So the locale is extracted from the URI for each request.

Antonio Salazar Cardozo

unread,
Mar 14, 2015, 12:29:37 PM3/14/15
to lif...@googlegroups.com
If LiftRules.localeCalculator is set to extract it from the URI, I believe S.locale should be
set at that point.
Thanks,
Antonio

Andreas Joseph Krogh

unread,
Mar 14, 2015, 1:13:16 PM3/14/15
to lif...@googlegroups.com
På lørdag 14. mars 2015 kl. 17:29:37, skrev Antonio Salazar Cardozo <savedf...@gmail.com>:
If LiftRules.localeCalculator is set to extract it from the URI, I believe S.locale should be
set at that point.
Thanks,
Antonio
 
The problem I'm facing is that AJAX-mappings which have timed out, have the URI=/ajax_request and hence rely on being set as request-var, which are gone because of the nature of this problem (ie. laptop has been at sleep for 15 mins and funcs are GC'ed after 10).

Antonio Salazar Cardozo

unread,
Mar 14, 2015, 4:40:43 PM3/14/15
to lif...@googlegroups.com
Ah. Gotcha. Hmmmm…

One possibility is using the client-side lost-session callback to deal with this, possibly by requesting the
appropriate locale's error message and then displaying it?
Thanks,
Antonio
Reply all
Reply to author
Forward
0 new messages