Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Closes #954. Normalizes the Menu, PreParam and PreParams stuff

  • Loading branch information...
commit 28c85167cb0f0b62042db276e213367f552aa0d4 1 parent 0c4e4c3
@dpp dpp authored
View
13 web/webkit/src/main/scala/net/liftweb/http/LiftRules.scala
@@ -1096,7 +1096,10 @@ trait LiftRules extends Factory with FormVendor with LazyLoggable {
/**
* Holds the user's rewrite functions that can alter the URI parts and query parameters. This rewrite
* is performed very early in the HTTP request cycle and may not include any state. This rewrite is meant
- * to rewrite requests for statelessDispatch
+ * to rewrite requests for statelessDispatch. <br/>
+ * Note also that rewrites should not have side effects except
+ * to memoize database query results. No side effects means that you should not change SessionVars
+ * in a rewrite.
*/
val statelessRewrite = RulesSeq[RewritePF]
@@ -1109,7 +1112,13 @@ trait LiftRules extends Factory with FormVendor with LazyLoggable {
/**
* Holds the user's rewrite functions that can alter the URI parts and query parameters.
* This rewrite takes place within the scope of the S state so SessionVars and other session-related
- * information is available.
+ * information is available. <br/>
+ * Note also that rewrites should not have side effects except
+ * to memoize database query results. No side effects means that you should not change SessionVars
+ * in a rewrite. <br/>
+ * In general, rewrites should be considered low level access. Rather than using a rewrite to extract
+ * parameters out of a URL, you'll be much better off using SiteMap generally and Menu.param and Menu.params
+ * specifically for extracting parameters from URLs.
*/
val statefulRewrite = RulesSeq[RewritePF]
View
3  web/webkit/src/main/scala/net/liftweb/http/Req.scala
@@ -1176,6 +1176,9 @@ class Req(val path: ParsePath,
def updateWithContextPath(uri: String): String = if (uri.startsWith("/")) contextPath + uri else uri
}
+/**
+ * This case class is used for pattern matching. See LiftRules.statelessRewrite and LiftRules.statefulRewrite
+ */
final case class RewriteRequest(path: ParsePath, requestType: RequestType, httpRequest: HTTPRequest)
/**
View
4 web/webkit/src/main/scala/net/liftweb/sitemap/Menu.scala
@@ -225,7 +225,7 @@ object Menu extends MenuSingleton {
/**
* The method to add a path element to the URL representing this menu item
*/
- def /(pathElement: String): ParamsMenuable[T] with WithSlash =
+ def /(pathElement: LocPath): ParamsMenuable[T] with WithSlash =
new ParamsMenuable[T](name, linkText, parser, encoder,
pathElement :: Nil, false, Nil, Nil) with WithSlash
@@ -341,7 +341,7 @@ object Menu extends MenuSingleton {
/**
* The method to add a path element to the URL representing this menu item
*/
- def /(pathElement: String): Menuable with WithSlash =
+ def /(pathElement: LocPath): Menuable with WithSlash =
new Menuable(name, linkText, pathElement :: Nil, false, Nil, Nil) with WithSlash
def path(pathElement: String): Menuable with WithSlash =
Please sign in to comment.
Something went wrong with that request. Please try again.