On Mon, Feb 8, 2010 at 7:13 PM, Alex Black <a...@alexblack.ca> wrote:

> Has anyone found a good pattern/method of re-using Url Rewriting
> extractors?
>
> I've got a url like this:
>
> /products/manufacturer/productId
>
> And an extractor for that, that given a product gives you a URL
> (apply) and given a ParsePath gives you an Option[Product].
>
> I'd then like to support a sub url like this:
>
> /products/manufacturer/productId/view/viewName
>
> so I'd like to make a class to handle view and ViewName (or anything
> else that comes below productId), and re-use the functionality in
> ProductURL extractor.
>
> I can't seem to figure out a way to do it for unapply. thoughts?
>

def unapply(in: List[String]): Option[ProductInfo] = in match {
  case Product(product) :: Nil => Some(ProductInfo(product))
  case Product(product) :: "view" :: ViewName(viewName) :: Nil =>
Some(ProductInfo(product, viewName))
  case _ => None
}


>
> - Alex
>
> --
> 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<liftweb%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/liftweb?hl=en.
>
>


-- 
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

-- 
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