Problem mapping a request for a REST Api
The group you are posting to is a
Usenet group . Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
From:
andythedestroyer <andythedestro... @gmail.com>
Date: Thu, 29 Oct 2009 14:27:10 -0700 (PDT)
Local: Thurs, Oct 29 2009 5:27 pm
Subject: Problem mapping a request for a REST Api
Hello,
I am creating a rest api for an app and am having trouble extracting a
var from the matched request.
Object MyApi extends XMLHelperApi {
def dispatch : LiftRules.DispatchPF = {
case Req(List("api","package", packageName), _, GetRequest)
=>
() => myMethodThatDoesSomething(packageName)
}
}
The packageName variable is in the form similar but not exactly like
java package names ( my.company.package:key=value )
so the rest url would be
http://domain.com/api/package/my.company.package%3Akey%3Dvalue
This should work and the package var in my case expression should be
"my.company.package:key=value" but it is just "my".
I have gone through "The Definitive Guide to Lift" and the group
postings but have had no luck so far. I know this should be easy and I
am just missing something.
Thanks
Andy
You must
Sign in before you can post messages.
You do not have the permission required to post.
From:
Naftoli Gugenheim <naftoli... @gmail.com>
Date: Thu, 29 Oct 2009 14:32:02 -0700 (PDT)
Local: Thurs, Oct 29 2009 5:32 pm
Subject: Re: [Lift] Problem mapping a request for a REST Api
List("api", "package", packageName : _* )
-------------------------------------
andythedestroyer<andythedestro
... @gmail.com> wrote:
Hello,
I am creating a rest api for an app and am having trouble extracting a
var from the matched request.
Object MyApi extends XMLHelperApi {
def dispatch : LiftRules.DispatchPF = {
case Req(List("api","package", packageName), _, GetRequest)
=>
() => myMethodThatDoesSomething(packageName)
}
}
The packageName variable is in the form similar but not exactly like
java package names ( my.company.package:key=value )
so the rest url would be
http://domain.com/api/package/my.company.package%3Akey%3Dvalue
This should work and the package var in my case expression should be
"my.company.package:key=value" but it is just "my".
I have gone through "The Definitive Guide to Lift" and the group
postings but have had no luck so far. I know this should be easy and I
am just missing something.
Thanks
Andy
You must
Sign in before you can post messages.
You do not have the permission required to post.
From:
David Pollak <feeder.of.the.be... @gmail.com>
Date: Thu, 29 Oct 2009 15:12:11 -0700
Local: Thurs, Oct 29 2009 6:12 pm
Subject: Re: [Lift] Problem mapping a request for a REST Api
When Lift parses a path, the last element of the path is split at the first
'.'. This allows you to match of "foo" :: "bar", "jpg" vs. "foo" :: "bar",
"png"
However, this is biting you right now... and I've got a solution.
Please open a ticket at http://github.com/dpp/liftweb/issues and I'll get it
fixed.
On Thu, Oct 29, 2009 at 2:27 PM, andythedestroyer <
andythedestro
... @gmail.com> wrote:
> Hello,
> I am creating a rest api for an app and am having trouble extracting a
> var from the matched request.
> Object MyApi extends XMLHelperApi {
> def dispatch : LiftRules.DispatchPF = {
> case Req(List("api","package", packageName), _, GetRequest)
> =>
> () => myMethodThatDoesSomething(packageName)
> }
> }
> The packageName variable is in the form similar but not exactly like
> java package names ( my.company.package:key=value )
> so the rest url would be
> http://domain.com/api/package/my.company.package%3Akey%3Dvalue
> This should work and the package var in my case expression should be
> "my.company.package:key=value" but it is just "my".
> I have gone through "The Definitive Guide to Lift" and the group
> postings but have had no luck so far. I know this should be easy and I
> am just missing something.
> Thanks
> Andy
-- 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 must
Sign in before you can post messages.
You do not have the permission required to post.
From:
andythedestroyer <andythedestro... @gmail.com>
Date: Thu, 29 Oct 2009 15:39:53 -0700 (PDT)
Local: Thurs, Oct 29 2009 6:39 pm
Subject: Re: Problem mapping a request for a REST Api
Thanks for the response but that doesn't work. I get the following
error.
[WARNING] API.scala:51: error: ')' expected but identifier found.
[WARNING] case Req(List("api" , "package" , packageName : _*), "",
GetRequest) =>
-Andy
On Oct 29, 2:32 pm, Naftoli Gugenheim <naftoli... @gmail.com> wrote:
> List("api", "package", packageName : _* )
> -------------------------------------
> andythedestroyer<andythedestro... @gmail.com> wrote:
> Hello,
> I am creating a rest api for an app and am having trouble extracting a
> var from the matched request.
> Object MyApi extends XMLHelperApi {
> def dispatch : LiftRules.DispatchPF = {
> case Req(List("api","package", packageName), _, GetRequest)
> =>
> () => myMethodThatDoesSomething(packageName)
> }
> }
> The packageName variable is in the form similar but not exactly like
> java package names ( my.company.package:key=value )
> so the rest url would be
> http://domain.com/api/package/my.company.package%3Akey%3Dvalue
> This should work and the package var in my case expression should be
> "my.company.package:key=value" but it is just "my".
> I have gone through "The Definitive Guide to Lift" and the group
> postings but have had no luck so far. I know this should be easy and I
> am just missing something.
> Thanks
> Andy
You must
Sign in before you can post messages.
You do not have the permission required to post.
From:
andythedestroyer <andythedestro... @gmail.com>
Date: Thu, 29 Oct 2009 15:41:32 -0700 (PDT)
Local: Thurs, Oct 29 2009 6:41 pm
Subject: Re: Problem mapping a request for a REST Api
Thanks for the response. The ticket number is 144 and here is the link
http://github.com/dpp/liftweb/issues/#issue/144
-Andy
On Oct 29, 3:12 pm, David Pollak <feeder.of.the.be... @gmail.com>
wrote:
> When Lift parses a path, the last element of the path is split at the first
> '.'. This allows you to match of "foo" :: "bar", "jpg" vs. "foo" :: "bar",
> "png"
> However, this is biting you right now... and I've got a solution.
> Please open a ticket athttp://github.com/dpp/liftweb/issuesand I'll get it
> fixed.
> On Thu, Oct 29, 2009 at 2:27 PM, andythedestroyer <
> andythedestro... @gmail.com> wrote:
> > Hello,
> > I am creating a rest api for an app and am having trouble extracting a
> > var from the matched request.
> > Object MyApi extends XMLHelperApi {
> > def dispatch : LiftRules.DispatchPF = {
> > case Req(List("api","package", packageName), _, GetRequest)
> > =>
> > () => myMethodThatDoesSomething(packageName)
> > }
> > }
> > The packageName variable is in the form similar but not exactly like
> > java package names ( my.company.package:key=value )
> > so the rest url would be
> >http://domain.com/api/package/my.company.package%3Akey%3Dvalue
> > This should work and the package var in my case expression should be
> > "my.company.package:key=value" but it is just "my".
> > I have gone through "The Definitive Guide to Lift" and the group
> > postings but have had no luck so far. I know this should be easy and I
> > am just missing something.
> > Thanks
> > Andy
> --
> Lift, the simply functional web frameworkhttp://liftweb.net
> Beginning Scalahttp://www.apress.com/book/view/1430219890
> Follow me:http://twitter.com/dpp
> Surf the harmonics
You must
Sign in before you can post messages.
You do not have the permission required to post.
From:
David Pollak <feeder.of.the.be... @gmail.com>
Date: Thu, 29 Oct 2009 16:23:11 -0700
Local: Thurs, Oct 29 2009 7:23 pm
Subject: Re: [Lift] Re: Problem mapping a request for a REST Api
On Thu, Oct 29, 2009 at 3:41 PM, andythedestroyer <
I've got a fix that I'm testing. I hope to get it into the code before the
code slush today.
> -Andy
> On Oct 29, 3:12 pm, David Pollak <feeder.of.the.be... @gmail.com>
> wrote:
> > When Lift parses a path, the last element of the path is split at the
> first
> > '.'. This allows you to match of "foo" :: "bar", "jpg" vs. "foo" ::
> "bar",
> > "png"
> > However, this is biting you right now... and I've got a solution.
> > Please open a ticket athttp://github.com/dpp/liftweb/issuesand I'll get
> it
> > fixed.
> > On Thu, Oct 29, 2009 at 2:27 PM, andythedestroyer <
> > andythedestro... @gmail.com> wrote:
> > > Hello,
> > > I am creating a rest api for an app and am having trouble extracting a
> > > var from the matched request.
> > > Object MyApi extends XMLHelperApi {
> > > def dispatch : LiftRules.DispatchPF = {
> > > case Req(List("api","package", packageName), _, GetRequest)
> > > =>
> > > () => myMethodThatDoesSomething(packageName)
> > > }
> > > }
> > > The packageName variable is in the form similar but not exactly like
> > > java package names ( my.company.package:key=value )
> > > so the rest url would be
> > >http://domain.com/api/package/my.company.package%3Akey%3Dvalue
> > > This should work and the package var in my case expression should be
> > > "my.company.package:key=value" but it is just "my".
> > > I have gone through "The Definitive Guide to Lift" and the group
> > > postings but have had no luck so far. I know this should be easy and I
> > > am just missing something.
> > > Thanks
> > > Andy
> > --
> > Lift, the simply functional web frameworkhttp://liftweb.net
> > Beginning Scalahttp://www.apress.com/book/view/1430219890
> > Follow me:http://twitter.com/dpp
> > Surf the harmonics
-- 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 must
Sign in before you can post messages.
You do not have the permission required to post.
From:
andythedestroyer <andythedestro... @gmail.com>
Date: Thu, 29 Oct 2009 16:54:43 -0700 (PDT)
Local: Thurs, Oct 29 2009 7:54 pm
Subject: Re: Problem mapping a request for a REST Api
You rule!
On Oct 29, 4:23 pm, David Pollak <feeder.of.the.be... @gmail.com>
wrote:
> On Thu, Oct 29, 2009 at 3:41 PM, andythedestroyer <
> andythedestro... @gmail.com> wrote:
> > Thanks for the response. The ticket number is 144 and here is the link
> >http://github.com/dpp/liftweb/issues/#issue/144
> I've got a fix that I'm testing. I hope to get it into the code before the
> code slush today.
> > -Andy
> > On Oct 29, 3:12 pm, David Pollak <feeder.of.the.be... @gmail.com>
> > wrote:
> > > When Lift parses a path, the last element of the path is split at the
> > first
> > > '.'. This allows you to match of "foo" :: "bar", "jpg" vs. "foo" ::
> > "bar",
> > > "png"
> > > However, this is biting you right now... and I've got a solution.
> > > Please open a ticket athttp://github.com/dpp/liftweb/issuesandI'll get
> > it
> > > fixed.
> > > On Thu, Oct 29, 2009 at 2:27 PM, andythedestroyer <
> > > andythedestro... @gmail.com> wrote:
> > > > Hello,
> > > > I am creating a rest api for an app and am having trouble extracting a
> > > > var from the matched request.
> > > > Object MyApi extends XMLHelperApi {
> > > > def dispatch : LiftRules.DispatchPF = {
> > > > case Req(List("api","package", packageName), _, GetRequest)
> > > > =>
> > > > () => myMethodThatDoesSomething(packageName)
> > > > }
> > > > }
> > > > The packageName variable is in the form similar but not exactly like
> > > > java package names ( my.company.package:key=value )
> > > > so the rest url would be
> > > >http://domain.com/api/package/my.company.package%3Akey%3Dvalue
> > > > This should work and the package var in my case expression should be
> > > > "my.company.package:key=value" but it is just "my".
> > > > I have gone through "The Definitive Guide to Lift" and the group
> > > > postings but have had no luck so far. I know this should be easy and I
> > > > am just missing something.
> > > > Thanks
> > > > Andy
> > > --
> > > Lift, the simply functional web frameworkhttp://liftweb.net
> > > Beginning Scalahttp://www.apress.com/book/view/1430219890
> > > Follow me:http://twitter.com/dpp
> > > Surf the harmonics
> --
> Lift, the simply functional web frameworkhttp://liftweb.net
> Beginning Scalahttp://www.apress.com/book/view/1430219890
> Follow me:http://twitter.com/dpp
> Surf the harmonics
You must
Sign in before you can post messages.
You do not have the permission required to post.
From:
David Pollak <feeder.of.the.be... @gmail.com>
Date: Thu, 29 Oct 2009 16:57:51 -0700
Local: Thurs, Oct 29 2009 7:57 pm
Subject: Re: [Lift] Re: Problem mapping a request for a REST Api
http://reviewboard.liftweb.net/r/77/
On Thu, Oct 29, 2009 at 4:54 PM, andythedestroyer <
andythedestro
... @gmail.com> wrote:
> You rule!
> On Oct 29, 4:23 pm, David Pollak <feeder.of.the.be... @gmail.com>
> wrote:
> > On Thu, Oct 29, 2009 at 3:41 PM, andythedestroyer <
> > andythedestro... @gmail.com> wrote:
> > > Thanks for the response. The ticket number is 144 and here is the link
> > >http://github.com/dpp/liftweb/issues/#issue/144
> > I've got a fix that I'm testing. I hope to get it into the code before
> the
> > code slush today.
> > > -Andy
> > > On Oct 29, 3:12 pm, David Pollak <feeder.of.the.be... @gmail.com>
> > > wrote:
> > > > When Lift parses a path, the last element of the path is split at the
> > > first
> > > > '.'. This allows you to match of "foo" :: "bar", "jpg" vs. "foo" ::
> > > "bar",
> > > > "png"
> > > > However, this is biting you right now... and I've got a solution.
> > > > Please open a ticket athttp://github.com/dpp/liftweb/issuesandI'll <http://github.com/dpp/liftweb/issuesandI%27ll >get
> > > it
> > > > fixed.
> > > > On Thu, Oct 29, 2009 at 2:27 PM, andythedestroyer <
> > > > andythedestro... @gmail.com> wrote:
> > > > > Hello,
> > > > > I am creating a rest api for an app and am having trouble
> extracting a
> > > > > var from the matched request.
> > > > > Object MyApi extends XMLHelperApi {
> > > > > def dispatch : LiftRules.DispatchPF = {
> > > > > case Req(List("api","package", packageName), _,
> GetRequest)
> > > > > =>
> > > > > () => myMethodThatDoesSomething(packageName)
> > > > > }
> > > > > }
> > > > > The packageName variable is in the form similar but not exactly
> like
> > > > > java package names ( my.company.package:key=value )
> > > > > so the rest url would be
> > > > >http://domain.com/api/package/my.company.package%3Akey%3Dvalue
> > > > > This should work and the package var in my case expression should
> be
> > > > > "my.company.package:key=value" but it is just "my".
> > > > > I have gone through "The Definitive Guide to Lift" and the group
> > > > > postings but have had no luck so far. I know this should be easy
> and I
> > > > > am just missing something.
> > > > > Thanks
> > > > > Andy
> > > > --
> > > > Lift, the simply functional web frameworkhttp://liftweb.net
> > > > Beginning Scalahttp://www.apress.com/book/view/1430219890
> > > > Follow me:http://twitter.com/dpp
> > > > Surf the harmonics
> > --
> > Lift, the simply functional web frameworkhttp://liftweb.net
> > Beginning Scalahttp://www.apress.com/book/view/1430219890
> > Follow me:http://twitter.com/dpp
> > Surf the harmonics
-- 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 must
Sign in before you can post messages.
You do not have the permission required to post.
From:
Naftoli Gugenheim <naftoli... @gmail.com>
Date: Thu, 29 Oct 2009 21:17:41 -0700 (PDT)
Local: Fri, Oct 30 2009 12:17 am
Subject: Re: [Lift] Re: Problem mapping a request for a REST Api
Sorry--it was a bad guess. I should have written "try" etc...
-------------------------------------
andythedestroyer<andythedestro
... @gmail.com> wrote:
Thanks for the response but that doesn't work. I get the following
error.
[WARNING] API.scala:51: error: ')' expected but identifier found.
[WARNING] case Req(List("api" , "package" , packageName : _*), "",
GetRequest) =>
-Andy
On Oct 29, 2:32 pm, Naftoli Gugenheim <naftoli... @gmail.com> wrote:
> List("api", "package", packageName : _* )
> -------------------------------------
> andythedestroyer<andythedestro... @gmail.com> wrote:
> Hello,
> I am creating a rest api for an app and am having trouble extracting a
> var from the matched request.
> Object MyApi extends XMLHelperApi {
> def dispatch : LiftRules.DispatchPF = {
> case Req(List("api","package", packageName), _, GetRequest)
> =>
> () => myMethodThatDoesSomething(packageName)
> }
> }
> The packageName variable is in the form similar but not exactly like
> java package names ( my.company.package:key=value )
> so the rest url would be
> http://domain.com/api/package/my.company.package%3Akey%3Dvalue
> This should work and the package var in my case expression should be
> "my.company.package:key=value" but it is just "my".
> I have gone through "The Definitive Guide to Lift" and the group
> postings but have had no luck so far. I know this should be easy and I
> am just missing something.
> Thanks
> Andy
You must
Sign in before you can post messages.
You do not have the permission required to post.
From:
andythedestroyer <andythedestro... @gmail.com>
Date: Fri, 30 Oct 2009 16:28:02 -0700 (PDT)
Local: Fri, Oct 30 2009 7:28 pm
Subject: Re: Problem mapping a request for a REST Api
No problem. I sincerely appreciate all suggestions.
It looks like dpp is already working on a fix for this. I came up with
the really ugly ( but temporary solution until the fix in commited )
of appending meaningless info to the url.
so
http://domain.com/api/package/my.company.package%3Akey%3Dvalue
becomes
http://domain.com/api/package/my.company.package%3Akey%3Dvalue/foobar
and it works.
Thanks again,
A
On Oct 29, 9:17 pm, Naftoli Gugenheim <naftoli... @gmail.com> wrote:
> Sorry--it was a bad guess. I should have written "try" etc...
> -------------------------------------
> andythedestroyer<andythedestro... @gmail.com> wrote:
> Thanks for the response but that doesn't work. I get the following
> error.
> [WARNING] API.scala:51: error: ')' expected but identifier found.
> [WARNING] case Req(List("api" , "package" , packageName : _*), "",
> GetRequest) =>
> -Andy
> On Oct 29, 2:32 pm, Naftoli Gugenheim <naftoli... @gmail.com> wrote:
> > List("api", "package", packageName : _* )
> > -------------------------------------
> > andythedestroyer<andythedestro... @gmail.com> wrote:
> > Hello,
> > I am creating a rest api for an app and am having trouble extracting a
> > var from the matched request.
> > Object MyApi extends XMLHelperApi {
> > def dispatch : LiftRules.DispatchPF = {
> > case Req(List("api","package", packageName), _, GetRequest)
> > =>
> > () => myMethodThatDoesSomething(packageName)
> > }
> > }
> > The packageName variable is in the form similar but not exactly like
> > java package names ( my.company.package:key=value )
> > so the rest url would be
> >http://domain.com/api/package/my.company.package%3Akey%3Dvalue
> > This should work and the package var in my case expression should be
> > "my.company.package:key=value" but it is just "my".
> > I have gone through "The Definitive Guide to Lift" and the group
> > postings but have had no luck so far. I know this should be easy and I
> > am just missing something.
> > Thanks
> > Andy
You must
Sign in before you can post messages.
You do not have the permission required to post.