[Lift] Re: How to create an rss?

2009-10-23 Thread wibblecp

Hi Glenn
thanks for your reply. It seems to work for me :-) I was confused
between AtomResponse, Box[NodeSeq] and LiftResponse. I am at beginning
of this journey.

regards,
wibblecp.

On 23 Ott, 18:49, glenn  wrote:
> I don't know if this will help, but I use a simple createTag to just
> enclose the full xml so it has a root element:
>
>    def createTag(in: NodeSeq) = {
>        {in}
>
>   }
>
> and then showArticles would call into a feed wrapper, passing in the
> result of yield,  like this for an Atom feed:
>
> //Reacts to Get all reguest
>    def showArticles():AtomResponse = {
>      val eList = for(e <- Content.findAll) yield {
>             e.toAtom
>           }
>
>          AtomResponse(feedWrapper(eList))
>
>    }
>
> Glenn
>
> On Oct 23, 6:24 am, wibblecp  wrote:
>
> > hi guys,
> > I'm looking for a way to generate an rss feed with lift, I'm working
> > on something like this (from lift-book):
>
> > object OwnRssFeed extends XMLApiHelper {
> >   def dispatch: LiftRules.DispatchPF = {
> >     case Req("rss" ::   Nil, "", GetRequest) => () => showArticles()
> >     case Req("rss" :: _ :: Nil, "",  _) => failure _
> >   }
>
> >     def failure() : LiftResponse = {
> >       val ret: Box[NodeSeq] = Full()
> >       NotFoundResponse()
> >     }
>
> >     def createTag(in: NodeSeq) = {
> >       println("[CreateTag] " + in)
> >       
> >           
> >               title
> >               http://example.org
> >               Example.org
> >               en-us
>
> >               Lift WebFramework
> >                   {in}
> >           
> >       
> >     }
>
> >     def showArticles(): LiftResponse = {
> >       val a: Box[NodeSeq] = for(a <- Article.find(By
> > (Article.published, true))) yield {
> >          a.toXML
> >       }
> >       a
> >     }
>
> > }
>
> > obviously the yield into the definition of showArticles method break
> > the cycle to the first one.
>
> > Could you suggest me what I can do? I am evaluating lift and scala
> > just in a while.
> > Thanks for your attention.
> > w.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@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
-~--~~~~--~~--~--~---



[Lift] Re: How to create an rss?

2009-10-23 Thread glenn

I don't know if this will help, but I use a simple createTag to just
enclose the full xml so it has a root element:

   def createTag(in: NodeSeq) = {
   {in}

  }

and then showArticles would call into a feed wrapper, passing in the
result of yield,  like this for an Atom feed:

//Reacts to Get all reguest
   def showArticles():AtomResponse = {
 val eList = for(e <- Content.findAll) yield {
e.toAtom
  }

 AtomResponse(feedWrapper(eList))

   }

Glenn


On Oct 23, 6:24 am, wibblecp  wrote:
> hi guys,
> I'm looking for a way to generate an rss feed with lift, I'm working
> on something like this (from lift-book):
>
> object OwnRssFeed extends XMLApiHelper {
>   def dispatch: LiftRules.DispatchPF = {
>     case Req("rss" ::   Nil, "", GetRequest) => () => showArticles()
>     case Req("rss" :: _ :: Nil, "",  _) => failure _
>   }
>
>     def failure() : LiftResponse = {
>       val ret: Box[NodeSeq] = Full()
>       NotFoundResponse()
>     }
>
>     def createTag(in: NodeSeq) = {
>       println("[CreateTag] " + in)
>       
>           
>               title
>               http://example.org
>               Example.org
>               en-us
>
>               Lift WebFramework
>                   {in}
>           
>       
>     }
>
>     def showArticles(): LiftResponse = {
>       val a: Box[NodeSeq] = for(a <- Article.find(By
> (Article.published, true))) yield {
>          a.toXML
>       }
>       a
>     }
>
> }
>
> obviously the yield into the definition of showArticles method break
> the cycle to the first one.
>
> Could you suggest me what I can do? I am evaluating lift and scala
> just in a while.
> Thanks for your attention.
> w.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@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
-~--~~~~--~~--~--~---