"Neil.Lv" <anim...@gmail.com> writes:

> On Mar 1, 3:53 pm, Jeppe Nejsum Madsen <je...@ingolfs.dk> 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() )


Ahh yes, the example was from a Loc rewrite, The principle is the same I
guess, you should be able to do something like this:

case RewriteRequest(ParamsExtractor(account,orgUnit) , _, _) =>
  RewriteResponse(path, Map("account" -> account, "orgUnit" -> orgUnit))

The important part is the extractor which takes care of parsing the
request into meaningful values...

/Jeppe

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

Reply via email to