On Mar 1, 3:53 pm, Jeppe Nejsum Madsen <[email protected]> wrote:
>
> I'm not sure if this can be handled with the standard ParsePath, but it
> is fairly easy to write your own extractor that can handle more complex
> scenarios. Here's an example:
>
> object ParamsExtractor {
>       def unapply(pp:ParsePath): Option[(Account, OrgUnit)] = {
>         val result:Box[(Account, OrgUnit)] = if 
> (pp.wholePath.startsWith(path) && pp.wholePath.length == (path.length + 2)) {
>           val res = Full((XX,YY))
>           debug("Decoded URL: %s=%s".format(pp,res))
>           res
>           }
>         else
>           None
>         result
>       }
>     }
> used like this:
>
> case RewriteRequest(ParamsExtractor(account,orgUnit) , _, _) =>
> (RewriteResponse(path), Full(account, orgUnit))

  I have some question about these code that i don't understand.

  The first one that contains the Map() in the RewriteResponse() .
   -->
   case RewriteRequest() => RewriteResponse()

  but the second one that doesn't contain the Map in the
RewriteResponse(),
  what's the mean of the Full(account, orgUnit) in the
( RewriteResponse(path), Full(account, orgUnit) )
   -->
   case RewriteRequest() => ( RewriteResponse(), Full() )

###

  case RewriteRequest(
      ParsePath(List("show", "img", version, id), _, _,_), _, _) =>
    RewriteResponse(List("show", "img"),
      Map("version" -> version, "id" -> id)
    )


  case RewriteRequest(
      ParamsExtractor(account,orgUnit) , _, _) =>
    ( RewriteResponse(path), Full(account, orgUnit) )
###

    Thank you very much.

Cheers,
  Neil

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

Reply via email to