Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Early access to S.location breaks snippet resolution #1090

Merged
merged 1 commit into from

4 participants

@davewhittaker

S.location is stored in a RequestVar and will resolve to Empty if it is accessed before the lift request is initialized. The best solution seems to be to repeatedly attempt resolution when the RequestVar is Empty

https://groups.google.com/d/topic/liftweb/1mEpk4UtDZM/discussion

@indrajitr
Owner
@davewhittaker davewhittaker was assigned
@davewhittaker davewhittaker As discussed a while back, S.location is stored in a RequestVar and i…
…f the value was accessed before request state had been initialized it wasn't being retried. This will check repeatedly, but only if the RequestVar does not already hold a Full value.
598fb03
@dpp dpp merged commit c5a97b6 into master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 8, 2012
  1. @davewhittaker

    As discussed a while back, S.location is stored in a RequestVar and i…

    davewhittaker authored
    …f the value was accessed before request state had been initialized it wasn't being retried. This will check repeatedly, but only if the RequestVar does not already hold a Full value.
This page is out of date. Refresh to see the latest.
Showing with 4 additions and 1 deletion.
  1. +4 −1 web/webkit/src/main/scala/net/liftweb/http/S.scala
View
5 web/webkit/src/main/scala/net/liftweb/http/S.scala
@@ -386,7 +386,10 @@ trait S extends HasParams with Loggable {
private[http] object CurrentLocation extends RequestVar[Box[sitemap.Loc[_]]](request.flatMap(_.location))
- def location: Box[sitemap.Loc[_]] = CurrentLocation.is
+ def location: Box[sitemap.Loc[_]] = CurrentLocation.is or {
+ //try again in case CurrentLocation was accessed before the request was available
+ request flatMap { r => CurrentLocation(r.location) }
+ }
/**
Something went wrong with that request. Please try again.