path based and hostname based UrlRewriting interacting badly

11 views
Skip to first unread message

harryh

unread,
Oct 28, 2009, 2:03:58 PM10/28/09
to Lift
First, I rewrite URLs like /user/harryh to /user?uid=harryh
Also, requests to http://m.harryh.org/foo/bar get rewritten to /
subdomain/mobile/foo/bar

Doing this with the following code:

val urlRewriter: LiftRules.RewritePF = NamedPF("URLRewrite") {
case RewriteRequest(ParsePath("user" :: uid :: Nil, _, true, _), _,
_) => {
RewriteResponse(ParsePath("user" :: Nil, "", true, false), Map
("uid" -> uid))
}

case RewriteRequest(path, _, req) if
(req.serverName.toLowerCase.startsWith("m.")) => {
RewriteResponse(ParsePath("subdomain" :: "mobile" ::
path.partPath, path.suffix, path.absolute, path.endSlash), emptyMap,
true)
}
}

LiftRules.rewrite.append(urlRewriter)

The problem is that emtyMap in the second RewriteResponse. The
uid=harryh parameter that gets created by the first rewrite rule is
being destroyed at which point bad things happen.

Is there a better way to do what I am trying to do here?

-harryh

David Pollak

unread,
Oct 28, 2009, 5:59:31 PM10/28/09
to lif...@googlegroups.com
It's a bug.  Please open a ticket for it.  I'll get it fixed tonight.
--
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
Reply all
Reply to author
Forward
0 new messages