Ugh. I like your current fall-through :) Derek
On Mon, May 18, 2009 at 5:44 PM, glenn <[email protected]> wrote: > > I'm just doing a minimal REST server implementation, and only allowing > xml through. I suppose I could expand on this and add processing for > req.body. > That's a byte stream, though, I believe. But that brings up a whole > lot of other > issues, with handling different mime types. Yechhh!!!! > > On May 18, 3:31 pm, Derek Chen-Becker <[email protected]> wrote: > > Fabulous > > > > On Mon, May 18, 2009 at 4:27 PM, Timothy Perrett <[email protected] > >wrote: > > > > > > > > > It just falls through to the default request handling which reads the > > > whole stream in and should be accessible via req.body (where req is > > > the instance val) - see it here:http://is.gd/B6VT > > > > > Cheers, Tim > > > > > On May 18, 11:00 pm, Derek Chen-Becker <[email protected]> wrote: > > > > BTW, what happens if the mime type is incorrect? Does the Req.xml > method > > > > fail in a graceful way, or do you get exceptions? > > > > > > On Mon, May 18, 2009 at 2:51 PM, glenn <[email protected]> wrote: > > > > > > > Deriek, > > > > > > > Appreciate your response. What I did was change the case to just > > > > > > > case Req("api" :: "company" :: Nil, "", PutRequest)=> () => > > > > > saveCompany > > > > > > > and in saveCompany I just extracted the Req object from S.request > > > > > open_!. > > > > > > > As long as the body of my request is of the right mime type ("text/ > > > > > xml") > > > > > everything works great. > > > > > > > Glenn... > > > > > > > On May 18, 1:36 pm, Derek Chen-Becker <[email protected]> > wrote: > > > > > > The URL is defined by the match list in the Req object. In your > case, > > > > > you're > > > > > > defining your match as : > > > > > > > > case r @ Req("api" :: "company" :: Nil, "", PutRequest)=> () => > > > > > > addCompany(r) > > > > > > > > Your List is ("api" :: "company" :: Nil), So your URL would need > to > > > look > > > > > > like > > > > > > > >http://.../api/company > > > > > > > > Derek > > > > > > > > On Sun, May 17, 2009 at 4:02 PM, glenn <[email protected]> wrote: > > > > > > > > > Tim, > > > > > > > > > If I have a PUT dispatch case like so: > > > > > > > > > case r @ Req("api" :: "company" :: Nil, "", PutRequest)=> () => > > > > > > > addCompany(r) > > > > > > > > > and the handler is looking for something in r.xml like this: > > > > > > > > > req.xml match { > > > > > > > case Full(<company>{parameters @ _*}</company>) => { > > > > > > > for(parameter <- parameters){parameter match{ > > > > > > > case <companyName>{name}</companyName> => > > > > > company.name > > > > > > > (name.text) > > > > > > > case <line1>{line1}</line1> => > > > > > company.line1(line1.text) > > > > > > > case <line2>{line2}</line2> => > > > > > company.line1(line2.text) > > > > > > > case <city>{city}</city> => > > > company.city(city.text) > > > > > > > case <state>{state}</state> => > > > > > company.state(state.text) > > > > > > > case <postalCode>{postalCode}</postalCode> > => > > > > > > > company.postalCode(postalCode.text) > > > > > > > case _ => > > > > > > > } > > > > > > > } > > > > > > > > > what would my PUT URL actually look like? The lift book shows > > > > > > > > >http://www.pocketchangeapp.com/api/expense-PUT-addEntry(request) > > > + > > > > > > > XML Body as an example, but I don't really understand that in > the > > > > > > > context of third-party > > > > > > > app sending the request. > > > > > > > > > On May 17, 2:16 pm, Timothy Perrett <[email protected]> > > > wrote: > > > > > > > > > but I haven't figured out how to PUT documents from > > > > > > > > > a non-lift resource into my lift app, since that > > > > > > > > > requires that you can somehow access lift's Req object via > a > > > URL > > > > > > > > > > Hmm - im afraid your just plain wrong here... it needs > nothing of > > > the > > > > > > > > sort. I have lift applications that are 100% back-end > process, > > > and > > > > > > > > have no UI, or rather, the UI is an objective-c cocoa desktop > > > > > > > > application. No magic included. Lift is extreamly good at > > > building > > > > > > > > REST services as it has a very flexible HTTP handling > mechanism. > > > I do > > > > > > > > wonder though, if you already have a GET dispatch, what you > > > cannot > > > > > > > > figure out how to do PUT? (look at > net.liftweb.http.PutRequest > > > and > > > > > how > > > > > > > > its used in Req pattern match) > > > > > > > > > > @barry: You can do what you want without any issues. Lift is > > > > > > > > implemented as a filter so can co-habbit with other servlets > etc. > > > > > Lets > > > > > > > > assume that you implement the lift element under /badger - > > > configure > > > > > > > > your web.xml correctly then only /badger/* requests get > passed to > > > > > > > > lift. Technically speaking there is no difference in serving > > > XHTML > > > > > and > > > > > > > > XML... its all XML at the end of the day; its just that your > > > browser > > > > > > > > can make sense of the micro-format ;-) > > > > > > > > > > Whatever you have your persistance teir configured with, you > can > > > just > > > > > > > > layer lift on top for a REST service - it really is that > easy. > > > > > > > > > > Cheers, Tim > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
