You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@wink.apache.org by "Libak, Jaroslav" <ja...@hp.com> on 2009/10/09 13:49:13 UTC

non functional PathSegment + PathParam

Hello

I need to use PathSegments for multiple PathParams in my resource method. My method looks like:

@GET
@Path("/testRuns{testRunsParams:.*}/testSuites{testSuitesParams:.*}")
@Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_ATOM_XML})
    public TestRunsAsset findTestRuns(@PathParam("testRunsParams") final PathSegment testRunsParams,
                                                                             @PathParam("testSuitesParams") final PathSegment testSuitesParams) {
      // some code
    }

What I want to achieve is that if someone accesses my resource using:

http://localhost:8080/testqueryapi/rest/testRuns/;name=jaro/testSuites/;eyes=blue - resource method gets executed but content of testRunsParams and testSuitesParams is wrong. testRunsParams seems to contain partially what testSuitesParams should, with matrix parameters "name" or "eyes" not present. In Idea debugger I see testRunsParams = {org.apache.wink.common.internal.PathSegmentImpl@751}"testSuites"

http://localhost:8080/testqueryapi/rest/testRuns /testSuites/<http://localhost:8080/testqueryapi/rest/testRuns%20/testSuites/> - results in IndexOutOfBoundsException at UriTemplateMatcher:423
http://localhost:8080/testqueryapi/rest/testRuns;name=jaro/testSuites/;eyes=blue - results in IndexOutOfBoundsException at UriTemplateMatcher:423
http://localhost:8080/testqueryapi/rest/testRuns;name=jaro/testSuites;eyes=blue - results in IndexOutOfBoundsException at UriTemplateMatcher:423

then my method gets executed and matrix parameters are available in testRunsParams for parameters in "testRuns" segment and in testSuitesParams for "testSuites" segment. All matrix parameters are optional.

I saw on http://jboss.org/file-access/default/members/resteasy/freezone/docs/1.1.GA/userguide/html_single/index.html#_PathParam_and_PathSegment in section 4.2 that when you use @Path("/book/{id}") on method, then
GET http://host.com/library/book;name=EJB 3.0;author=Bill Burke
Will result in method being called and name, author being available in PathSegment.getMatrixParameters

When I tried something similar on my method:
@Path("/testRuns/{testRunsParams}/testSuites/{testSuitesParams}")

Then accessing the following URLs does not result in method execution:
http://localhost:8080/testqueryapi/rest/testRuns/testSuites
http://localhost:8080/testqueryapi/rest/testRuns/;name=jaro/testSuites
http://localhost:8080/testqueryapi/rest/testRuns/;name=jaro/testSuites/;eyes=blue
http://localhost:8080/testqueryapi/rest/testRuns/;name=jaro/testSuites;eyes=blue
http://localhost:8080/testqueryapi/rest/testRuns;name=jaro/testSuites;eyes=blue

http://localhost:8080/testqueryapi/rest/testRuns/testRunsParams=1;name=jaro/testSuites/testSuitesParams=2;eyes=blue - results in IndexOutOfBoundsException at UriTemplateMatcher.java:436

Is this URL matching correct or is it a bug? To me it appears there are two problems - first with URL matching and second with PathSegment.

>From http://jackson.codehaus.org/javadoc/jax-rs/1.0/javax/ws/rs/core/PathSegment.html we can read that value of PathParam annotation determines which path segment is selected for PathSegment.

I tried Wink 0.1 and 0.2 snapshot and they both suffer from problem with PathSegment not being functional. I would appreciate having some patch for 0.2 snapshot soon.

Jaroslav Libak


Re: non functional PathSegment + PathParam

Posted by Mike Rheinheimer <ro...@apache.org>.
Jaroslav,

Please see https://issues.apache.org/jira/browse/WINK-217.  You had indeed
found a bug, or at least something that should have been supported.  It is
fixed and tested in WINK-217, but I don't know yet if it will go into the
1.0 release.  Keep an eye on that Jira for updates.

Thanks!
mike


On Mon, Oct 12, 2009 at 9:21 AM, Nicholas L Gallardo <nl...@us.ibm.com>wrote:

> > This may need to be fixed before 1.0 is released.
>
> We're not cutting the release today to wait for additional doc changes. If
> you can get this in today and do not feel like it will cause a regression,
> then let's fix it.
>
> If you're unsure of the fix, then it should probably be bumped to a service
> release of 1.0.
>
> -Nick
>
> Nicholas Gallardo
> WebSphere - REST & WebServices Development
> nlgallar@us.ibm.com
> Phone: 512-286-6258
> Building: 903 / 5G-016
>
> [image: Inactive hide details for Mike Rheinheimer ---10/12/2009 09:11:04
> AM---Ahhh, now I see. :) I've reproduced that problem, so I'l]Mike
> Rheinheimer ---10/12/2009 09:11:04 AM---Ahhh, now I see. :) I've reproduced
> that problem, so I'll take a
>
>
>     *Mike Rheinheimer <ro...@apache.org>*
>
>             10/12/2009 09:03 AM
>             Please respond to
>             wink-dev@incubator.apache.org
>
>
> To
>
> wink-user@incubator.apache.org, wink-dev@incubator.apache.org
> cc
>
>
> Subject
>
> Re: non functional PathSegment + PathParam
>
> Ahhh, now I see.  :)  I've reproduced that problem, so I'll take a
> look at a fix.  The JAX-RS spec, in section 3.4, says "A URI path
> template is a string with zero or more embedded parameters...".  So at
> first glance, it appears you have found a bug.  Since 1.0 is in the
> works to be released, I'm copying the dev list too.  This may need to
> be fixed before 1.0 is released.
>
> mike
>
> 2009/10/12 Libak, Jaroslav <ja...@hp.com>:
> > Thanks. But I'm still getting IndexOutOfBoundsException even after your
> patch when I use correct URL for accessing the resource. I used wink trunk
> from today.
> >
> > I have only one resource class:
> >
> > @Path("/")
> > public class TestResultsResource {
> >
> > ...
> >
> > }
> >
> > I don't need to use more than one resource class (it's a very simple
> application) so that's why I use @Path("/"). If I use @Path("/root") then I
> don't get the IndexOutOfBoundsException anymore. @Path("") also causes
> IndexOutOfBoundsException. Without the @Path annotation at class resources
> will not be found.
> >
> > Jaroslav Libak
> >
> > -----Original Message-----
> > From: Mike Rheinheimer [mailto:rott@apache.org <ro...@apache.org>]
> > Sent: Friday, October 09, 2009 6:58 PM
> > To: wink-user@incubator.apache.org
> > Subject: Re: non functional PathSegment + PathParam
> >
> > Hi Jaroslav,
> >
> > I took your test and ran it through the latest WINK runtime.  The
> > behavior you described for your first test is also what I saw.  I did
> > not get the IndexOutOfBoundsException, but I also did not get the
> > expected PathParams in my resource method.
> >
> > Given the @Path you declared, the first query you tested would be
> > invalid.  The forward slashes are the delimiters.  Your @Path has only
> > two slashes (beginning with the one prior to "testRuns", where your
> > query had four (also beginning with the one prior to "testRuns").  So,
> > the results of the first test were not surprising.
> >
> > The fourth test you performed was the interesting one to me.  I would
> > have expected that to work.  It did not, of course, so I've submitted
> > a Jira and a patch:
> >
> > https://issues.apache.org/jira/browse/WINK-214
> >
> > The release manager for WINK 1.0 will accept this patch, so it will be
> > fixed in the next release (which is being renamed from 0.2 to 1.0).
> >
> > Thanks for catching this!
> >
> > Side note:  a workaround could have been to instead declare the @Path
> > as such:
> @Path("/{testRunsParams:testRuns}/{testSuitesParams:testSuites}")
> >
> > Side note #2:  also, declaring
> > @Path("/testRuns/{testRunsParams}/testSuites/{testSuitesParams}") and
> > sending only matrix params, like so:
> >
> http://localhost:8080/testqueryapi/rest/testRuns/;name=jaro/testSuites/;eyes=blue
> >  requires a little more effort to support in the WINK runtime.  If
> > this is an item WINK supports, it likely won't go into 1.0.  I've
> > opened a Jira for this as well:
> >
> > https://issues.apache.org/jira/browse/WINK-216
> >
> > mike
> >
> >
> > On Fri, Oct 9, 2009 at 6:49 AM, Libak, Jaroslav <ja...@hp.com>
> wrote:
> >> Hello
> >>
> >>
> >>
> >> I need to use PathSegments for multiple PathParams in my resource
> method. My
> >> method looks like:
> >>
> >>
> >>
> >> @GET
> >>
> >> @Path("/testRuns{testRunsParams:.*}/testSuites{testSuitesParams:.*}")
> >>
> >> @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON,
> >> MediaType.APPLICATION_ATOM_XML})
> >>
> >>     public TestRunsAsset findTestRuns(@PathParam("testRunsParams") final
> >> PathSegment testRunsParams,
> >>
> >>
> >>
>                                            @PathParam("testSuitesParams")
> >> final PathSegment testSuitesParams) {
> >>
> >>       // some code
> >>
> >>     }
> >>
> >>
> >>
> >> What I want to achieve is that if someone accesses my resource using:
> >>
> >>
> >>
> >>
> http://localhost:8080/testqueryapi/rest/testRuns/;name=jaro/testSuites/;eyes=blue
> >> - resource method gets executed but content of testRunsParams and
> >> testSuitesParams is wrong. testRunsParams seems to contain partially
> what
> >> testSuitesParams should, with matrix parameters "name" or "eyes" not
> >> present. In Idea debugger I see testRunsParams =
> >> {org.apache.wink.common.internal.PathSegmentImpl@751}"testSuites"
> >>
> >>
> >>
> >> http://localhost:8080/testqueryapi/rest/testRuns /testSuites/ - results
> in
> >> IndexOutOfBoundsException at UriTemplateMatcher:423
> >>
> >>
> http://localhost:8080/testqueryapi/rest/testRuns;name=jaro/testSuites/;eyes=blue
> >> - results in IndexOutOfBoundsException at UriTemplateMatcher:423
> >>
> >>
> http://localhost:8080/testqueryapi/rest/testRuns;name=jaro/testSuites;eyes=blue
> >> - results in IndexOutOfBoundsException at UriTemplateMatcher:423
> >>
> >>
> >>
> >> then my method gets executed and matrix parameters are available in
> >> testRunsParams for parameters in "testRuns" segment and in
> testSuitesParams
> >> for "testSuites" segment. All matrix parameters are optional.
> >>
> >>
> >>
> >> I saw on
> >>
> http://jboss.org/file-access/default/members/resteasy/freezone/docs/1.1.GA/userguide/html_single/index.html#_PathParam_and_PathSegment
> >> in section 4.2 that when you use @Path("/book/{id}") on method, then
> >>
> >> GET http://host.com/library/book;name=EJB 3.0;author=Bill Burke
> >>
> >> Will result in method being called and name, author being available in
> >> PathSegment.getMatrixParameters
> >>
> >>
> >>
> >> When I tried something similar on my method:
> >>
> >> @Path("/testRuns/{testRunsParams}/testSuites/{testSuitesParams}")
> >>
> >>
> >>
> >> Then accessing the following URLs does not result in method execution:
> >>
> >> http://localhost:8080/testqueryapi/rest/testRuns/testSuites
> >>
> >> http://localhost:8080/testqueryapi/rest/testRuns/;name=jaro/testSuites
> >>
> >>
> http://localhost:8080/testqueryapi/rest/testRuns/;name=jaro/testSuites/;eyes=blue
> >>
> >>
> http://localhost:8080/testqueryapi/rest/testRuns/;name=jaro/testSuites;eyes=blue
> >>
> >>
> http://localhost:8080/testqueryapi/rest/testRuns;name=jaro/testSuites;eyes=blue
> >>
> >>
> >>
> >>
> http://localhost:8080/testqueryapi/rest/testRuns/testRunsParams=1;name=jaro/testSuites/testSuitesParams=2;eyes=blue
> >> - results in IndexOutOfBoundsException at UriTemplateMatcher.java:436
> >>
> >>
> >>
> >> Is this URL matching correct or is it a bug? To me it appears there are
> two
> >> problems - first with URL matching and second with PathSegment.
> >>
> >>
> >>
> >> From
> >>
> http://jackson.codehaus.org/javadoc/jax-rs/1.0/javax/ws/rs/core/PathSegment.html
> >> we can read that value of PathParam annotation determines which path
> segment
> >> is selected for PathSegment.
> >>
> >>
> >>
> >> I tried Wink 0.1 and 0.2 snapshot and they both suffer from problem with
> >> PathSegment not being functional. I would appreciate having some patch
> for
> >> 0.2 snapshot soon.
> >>
> >>
> >>
> >> Jaroslav Libak
> >>
> >>
> >
>
>

Re: non functional PathSegment + PathParam

Posted by Mike Rheinheimer <ro...@apache.org>.
Jaroslav,

Please see https://issues.apache.org/jira/browse/WINK-217.  You had indeed
found a bug, or at least something that should have been supported.  It is
fixed and tested in WINK-217, but I don't know yet if it will go into the
1.0 release.  Keep an eye on that Jira for updates.

Thanks!
mike


On Mon, Oct 12, 2009 at 9:21 AM, Nicholas L Gallardo <nl...@us.ibm.com>wrote:

> > This may need to be fixed before 1.0 is released.
>
> We're not cutting the release today to wait for additional doc changes. If
> you can get this in today and do not feel like it will cause a regression,
> then let's fix it.
>
> If you're unsure of the fix, then it should probably be bumped to a service
> release of 1.0.
>
> -Nick
>
> Nicholas Gallardo
> WebSphere - REST & WebServices Development
> nlgallar@us.ibm.com
> Phone: 512-286-6258
> Building: 903 / 5G-016
>
> [image: Inactive hide details for Mike Rheinheimer ---10/12/2009 09:11:04
> AM---Ahhh, now I see. :) I've reproduced that problem, so I'l]Mike
> Rheinheimer ---10/12/2009 09:11:04 AM---Ahhh, now I see. :) I've reproduced
> that problem, so I'll take a
>
>
>     *Mike Rheinheimer <ro...@apache.org>*
>
>             10/12/2009 09:03 AM
>             Please respond to
>             wink-dev@incubator.apache.org
>
>
> To
>
> wink-user@incubator.apache.org, wink-dev@incubator.apache.org
> cc
>
>
> Subject
>
> Re: non functional PathSegment + PathParam
>
> Ahhh, now I see.  :)  I've reproduced that problem, so I'll take a
> look at a fix.  The JAX-RS spec, in section 3.4, says "A URI path
> template is a string with zero or more embedded parameters...".  So at
> first glance, it appears you have found a bug.  Since 1.0 is in the
> works to be released, I'm copying the dev list too.  This may need to
> be fixed before 1.0 is released.
>
> mike
>
> 2009/10/12 Libak, Jaroslav <ja...@hp.com>:
> > Thanks. But I'm still getting IndexOutOfBoundsException even after your
> patch when I use correct URL for accessing the resource. I used wink trunk
> from today.
> >
> > I have only one resource class:
> >
> > @Path("/")
> > public class TestResultsResource {
> >
> > ...
> >
> > }
> >
> > I don't need to use more than one resource class (it's a very simple
> application) so that's why I use @Path("/"). If I use @Path("/root") then I
> don't get the IndexOutOfBoundsException anymore. @Path("") also causes
> IndexOutOfBoundsException. Without the @Path annotation at class resources
> will not be found.
> >
> > Jaroslav Libak
> >
> > -----Original Message-----
> > From: Mike Rheinheimer [mailto:rott@apache.org <ro...@apache.org>]
> > Sent: Friday, October 09, 2009 6:58 PM
> > To: wink-user@incubator.apache.org
> > Subject: Re: non functional PathSegment + PathParam
> >
> > Hi Jaroslav,
> >
> > I took your test and ran it through the latest WINK runtime.  The
> > behavior you described for your first test is also what I saw.  I did
> > not get the IndexOutOfBoundsException, but I also did not get the
> > expected PathParams in my resource method.
> >
> > Given the @Path you declared, the first query you tested would be
> > invalid.  The forward slashes are the delimiters.  Your @Path has only
> > two slashes (beginning with the one prior to "testRuns", where your
> > query had four (also beginning with the one prior to "testRuns").  So,
> > the results of the first test were not surprising.
> >
> > The fourth test you performed was the interesting one to me.  I would
> > have expected that to work.  It did not, of course, so I've submitted
> > a Jira and a patch:
> >
> > https://issues.apache.org/jira/browse/WINK-214
> >
> > The release manager for WINK 1.0 will accept this patch, so it will be
> > fixed in the next release (which is being renamed from 0.2 to 1.0).
> >
> > Thanks for catching this!
> >
> > Side note:  a workaround could have been to instead declare the @Path
> > as such:
> @Path("/{testRunsParams:testRuns}/{testSuitesParams:testSuites}")
> >
> > Side note #2:  also, declaring
> > @Path("/testRuns/{testRunsParams}/testSuites/{testSuitesParams}") and
> > sending only matrix params, like so:
> >
> http://localhost:8080/testqueryapi/rest/testRuns/;name=jaro/testSuites/;eyes=blue
> >  requires a little more effort to support in the WINK runtime.  If
> > this is an item WINK supports, it likely won't go into 1.0.  I've
> > opened a Jira for this as well:
> >
> > https://issues.apache.org/jira/browse/WINK-216
> >
> > mike
> >
> >
> > On Fri, Oct 9, 2009 at 6:49 AM, Libak, Jaroslav <ja...@hp.com>
> wrote:
> >> Hello
> >>
> >>
> >>
> >> I need to use PathSegments for multiple PathParams in my resource
> method. My
> >> method looks like:
> >>
> >>
> >>
> >> @GET
> >>
> >> @Path("/testRuns{testRunsParams:.*}/testSuites{testSuitesParams:.*}")
> >>
> >> @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON,
> >> MediaType.APPLICATION_ATOM_XML})
> >>
> >>     public TestRunsAsset findTestRuns(@PathParam("testRunsParams") final
> >> PathSegment testRunsParams,
> >>
> >>
> >>
>                                            @PathParam("testSuitesParams")
> >> final PathSegment testSuitesParams) {
> >>
> >>       // some code
> >>
> >>     }
> >>
> >>
> >>
> >> What I want to achieve is that if someone accesses my resource using:
> >>
> >>
> >>
> >>
> http://localhost:8080/testqueryapi/rest/testRuns/;name=jaro/testSuites/;eyes=blue
> >> - resource method gets executed but content of testRunsParams and
> >> testSuitesParams is wrong. testRunsParams seems to contain partially
> what
> >> testSuitesParams should, with matrix parameters "name" or "eyes" not
> >> present. In Idea debugger I see testRunsParams =
> >> {org.apache.wink.common.internal.PathSegmentImpl@751}"testSuites"
> >>
> >>
> >>
> >> http://localhost:8080/testqueryapi/rest/testRuns /testSuites/ - results
> in
> >> IndexOutOfBoundsException at UriTemplateMatcher:423
> >>
> >>
> http://localhost:8080/testqueryapi/rest/testRuns;name=jaro/testSuites/;eyes=blue
> >> - results in IndexOutOfBoundsException at UriTemplateMatcher:423
> >>
> >>
> http://localhost:8080/testqueryapi/rest/testRuns;name=jaro/testSuites;eyes=blue
> >> - results in IndexOutOfBoundsException at UriTemplateMatcher:423
> >>
> >>
> >>
> >> then my method gets executed and matrix parameters are available in
> >> testRunsParams for parameters in "testRuns" segment and in
> testSuitesParams
> >> for "testSuites" segment. All matrix parameters are optional.
> >>
> >>
> >>
> >> I saw on
> >>
> http://jboss.org/file-access/default/members/resteasy/freezone/docs/1.1.GA/userguide/html_single/index.html#_PathParam_and_PathSegment
> >> in section 4.2 that when you use @Path("/book/{id}") on method, then
> >>
> >> GET http://host.com/library/book;name=EJB 3.0;author=Bill Burke
> >>
> >> Will result in method being called and name, author being available in
> >> PathSegment.getMatrixParameters
> >>
> >>
> >>
> >> When I tried something similar on my method:
> >>
> >> @Path("/testRuns/{testRunsParams}/testSuites/{testSuitesParams}")
> >>
> >>
> >>
> >> Then accessing the following URLs does not result in method execution:
> >>
> >> http://localhost:8080/testqueryapi/rest/testRuns/testSuites
> >>
> >> http://localhost:8080/testqueryapi/rest/testRuns/;name=jaro/testSuites
> >>
> >>
> http://localhost:8080/testqueryapi/rest/testRuns/;name=jaro/testSuites/;eyes=blue
> >>
> >>
> http://localhost:8080/testqueryapi/rest/testRuns/;name=jaro/testSuites;eyes=blue
> >>
> >>
> http://localhost:8080/testqueryapi/rest/testRuns;name=jaro/testSuites;eyes=blue
> >>
> >>
> >>
> >>
> http://localhost:8080/testqueryapi/rest/testRuns/testRunsParams=1;name=jaro/testSuites/testSuitesParams=2;eyes=blue
> >> - results in IndexOutOfBoundsException at UriTemplateMatcher.java:436
> >>
> >>
> >>
> >> Is this URL matching correct or is it a bug? To me it appears there are
> two
> >> problems - first with URL matching and second with PathSegment.
> >>
> >>
> >>
> >> From
> >>
> http://jackson.codehaus.org/javadoc/jax-rs/1.0/javax/ws/rs/core/PathSegment.html
> >> we can read that value of PathParam annotation determines which path
> segment
> >> is selected for PathSegment.
> >>
> >>
> >>
> >> I tried Wink 0.1 and 0.2 snapshot and they both suffer from problem with
> >> PathSegment not being functional. I would appreciate having some patch
> for
> >> 0.2 snapshot soon.
> >>
> >>
> >>
> >> Jaroslav Libak
> >>
> >>
> >
>
>

Re: non functional PathSegment + PathParam

Posted by Nicholas L Gallardo <nl...@us.ibm.com>.
> This may need to be fixed before 1.0 is released.

We're not cutting the release today to wait for additional doc changes.  If
you can get this in today and do not feel like it will cause a regression,
then let's fix it.

If you're unsure of the fix, then it should probably be bumped to a service
release of 1.0.

-Nick

Nicholas Gallardo
WebSphere  - REST & WebServices Development
nlgallar@us.ibm.com
Phone: 512-286-6258
Building: 903 / 5G-016


                                                                           
             Mike Rheinheimer                                              
             <ro...@apache.org>                                             
                                                                        To 
             10/12/2009 09:03          wink-user@incubator.apache.org,     
             AM                        wink-dev@incubator.apache.org       
                                                                        cc 
                                                                           
             Please respond to                                     Subject 
             wink-dev@incubato         Re: non functional PathSegment +    
               r.apache.org            PathParam                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           




Ahhh, now I see.  :)  I've reproduced that problem, so I'll take a
look at a fix.  The JAX-RS spec, in section 3.4, says "A URI path
template is a string with zero or more embedded parameters...".  So at
first glance, it appears you have found a bug.  Since 1.0 is in the
works to be released, I'm copying the dev list too.  This may need to
be fixed before 1.0 is released.

mike

2009/10/12 Libak, Jaroslav <ja...@hp.com>:
> Thanks. But I'm still getting IndexOutOfBoundsException even after your
patch when I use correct URL for accessing the resource. I used wink trunk
from today.
>
> I have only one resource class:
>
> @Path("/")
> public class TestResultsResource {
>
> ...
>
> }
>
> I don't need to use more than one resource class (it's a very simple
application) so that's why I use @Path("/"). If I use @Path("/root") then I
don't get the IndexOutOfBoundsException anymore. @Path("") also causes
IndexOutOfBoundsException. Without the @Path annotation at class resources
will not be found.
>
> Jaroslav Libak
>
> -----Original Message-----
> From: Mike Rheinheimer [mailto:rott@apache.org]
> Sent: Friday, October 09, 2009 6:58 PM
> To: wink-user@incubator.apache.org
> Subject: Re: non functional PathSegment + PathParam
>
> Hi Jaroslav,
>
> I took your test and ran it through the latest WINK runtime.  The
> behavior you described for your first test is also what I saw.  I did
> not get the IndexOutOfBoundsException, but I also did not get the
> expected PathParams in my resource method.
>
> Given the @Path you declared, the first query you tested would be
> invalid.  The forward slashes are the delimiters.  Your @Path has only
> two slashes (beginning with the one prior to "testRuns", where your
> query had four (also beginning with the one prior to "testRuns").  So,
> the results of the first test were not surprising.
>
> The fourth test you performed was the interesting one to me.  I would
> have expected that to work.  It did not, of course, so I've submitted
> a Jira and a patch:
>
> https://issues.apache.org/jira/browse/WINK-214
>
> The release manager for WINK 1.0 will accept this patch, so it will be
> fixed in the next release (which is being renamed from 0.2 to 1.0).
>
> Thanks for catching this!
>
> Side note:  a workaround could have been to instead declare the @Path
> as such: @Path
("/{testRunsParams:testRuns}/{testSuitesParams:testSuites}")
>
> Side note #2:  also, declaring
> @Path("/testRuns/{testRunsParams}/testSuites/{testSuitesParams}") and
> sending only matrix params, like so:
>
http://localhost:8080/testqueryapi/rest/testRuns/;name=jaro/testSuites/;eyes=blue

>  requires a little more effort to support in the WINK runtime.  If
> this is an item WINK supports, it likely won't go into 1.0.  I've
> opened a Jira for this as well:
>
> https://issues.apache.org/jira/browse/WINK-216
>
> mike
>
>
> On Fri, Oct 9, 2009 at 6:49 AM, Libak, Jaroslav <ja...@hp.com>
wrote:
>> Hello
>>
>>
>>
>> I need to use PathSegments for multiple PathParams in my resource
method. My
>> method looks like:
>>
>>
>>
>> @GET
>>
>> @Path("/testRuns{testRunsParams:.*}/testSuites{testSuitesParams:.*}")
>>
>> @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON,
>> MediaType.APPLICATION_ATOM_XML})
>>
>>     public TestRunsAsset findTestRuns(@PathParam("testRunsParams") final
>> PathSegment testRunsParams,
>>
>>
>>                                            @PathParam
("testSuitesParams")
>> final PathSegment testSuitesParams) {
>>
>>       // some code
>>
>>     }
>>
>>
>>
>> What I want to achieve is that if someone accesses my resource using:
>>
>>
>>
>>
http://localhost:8080/testqueryapi/rest/testRuns/;name=jaro/testSuites/;eyes=blue

>> - resource method gets executed but content of testRunsParams and
>> testSuitesParams is wrong. testRunsParams seems to contain partially
what
>> testSuitesParams should, with matrix parameters "name" or "eyes" not
>> present. In Idea debugger I see testRunsParams =
>> {org.apache.wink.common.internal.PathSegmentImpl@751}"testSuites"
>>
>>
>>
>> http://localhost:8080/testqueryapi/rest/testRuns /testSuites/ - results
in
>> IndexOutOfBoundsException at UriTemplateMatcher:423
>>
>>
http://localhost:8080/testqueryapi/rest/testRuns;name=jaro/testSuites/;eyes=blue

>> - results in IndexOutOfBoundsException at UriTemplateMatcher:423
>>
>>
http://localhost:8080/testqueryapi/rest/testRuns;name=jaro/testSuites;eyes=blue

>> - results in IndexOutOfBoundsException at UriTemplateMatcher:423
>>
>>
>>
>> then my method gets executed and matrix parameters are available in
>> testRunsParams for parameters in "testRuns" segment and in
testSuitesParams
>> for "testSuites" segment. All matrix parameters are optional.
>>
>>
>>
>> I saw on
>>
http://jboss.org/file-access/default/members/resteasy/freezone/docs/1.1.GA/userguide/html_single/index.html#_PathParam_and_PathSegment

>> in section 4.2 that when you use @Path("/book/{id}") on method, then
>>
>> GET http://host.com/library/book;name=EJB 3.0;author=Bill Burke
>>
>> Will result in method being called and name, author being available in
>> PathSegment.getMatrixParameters
>>
>>
>>
>> When I tried something similar on my method:
>>
>> @Path("/testRuns/{testRunsParams}/testSuites/{testSuitesParams}")
>>
>>
>>
>> Then accessing the following URLs does not result in method execution:
>>
>> http://localhost:8080/testqueryapi/rest/testRuns/testSuites
>>
>> http://localhost:8080/testqueryapi/rest/testRuns/;name=jaro/testSuites
>>
>>
http://localhost:8080/testqueryapi/rest/testRuns/;name=jaro/testSuites/;eyes=blue

>>
>>
http://localhost:8080/testqueryapi/rest/testRuns/;name=jaro/testSuites;eyes=blue

>>
>>
http://localhost:8080/testqueryapi/rest/testRuns;name=jaro/testSuites;eyes=blue

>>
>>
>>
>>
http://localhost:8080/testqueryapi/rest/testRuns/testRunsParams=1;name=jaro/testSuites/testSuitesParams=2;eyes=blue

>> - results in IndexOutOfBoundsException at UriTemplateMatcher.java:436
>>
>>
>>
>> Is this URL matching correct or is it a bug? To me it appears there are
two
>> problems - first with URL matching and second with PathSegment.
>>
>>
>>
>> From
>>
http://jackson.codehaus.org/javadoc/jax-rs/1.0/javax/ws/rs/core/PathSegment.html

>> we can read that value of PathParam annotation determines which path
segment
>> is selected for PathSegment.
>>
>>
>>
>> I tried Wink 0.1 and 0.2 snapshot and they both suffer from problem with
>> PathSegment not being functional. I would appreciate having some patch
for
>> 0.2 snapshot soon.
>>
>>
>>
>> Jaroslav Libak
>>
>>
>

Re: non functional PathSegment + PathParam

Posted by Nicholas L Gallardo <nl...@us.ibm.com>.
> This may need to be fixed before 1.0 is released.

We're not cutting the release today to wait for additional doc changes.  If
you can get this in today and do not feel like it will cause a regression,
then let's fix it.

If you're unsure of the fix, then it should probably be bumped to a service
release of 1.0.

-Nick

Nicholas Gallardo
WebSphere  - REST & WebServices Development
nlgallar@us.ibm.com
Phone: 512-286-6258
Building: 903 / 5G-016


                                                                           
             Mike Rheinheimer                                              
             <ro...@apache.org>                                             
                                                                        To 
             10/12/2009 09:03          wink-user@incubator.apache.org,     
             AM                        wink-dev@incubator.apache.org       
                                                                        cc 
                                                                           
             Please respond to                                     Subject 
             wink-dev@incubato         Re: non functional PathSegment +    
               r.apache.org            PathParam                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           




Ahhh, now I see.  :)  I've reproduced that problem, so I'll take a
look at a fix.  The JAX-RS spec, in section 3.4, says "A URI path
template is a string with zero or more embedded parameters...".  So at
first glance, it appears you have found a bug.  Since 1.0 is in the
works to be released, I'm copying the dev list too.  This may need to
be fixed before 1.0 is released.

mike

2009/10/12 Libak, Jaroslav <ja...@hp.com>:
> Thanks. But I'm still getting IndexOutOfBoundsException even after your
patch when I use correct URL for accessing the resource. I used wink trunk
from today.
>
> I have only one resource class:
>
> @Path("/")
> public class TestResultsResource {
>
> ...
>
> }
>
> I don't need to use more than one resource class (it's a very simple
application) so that's why I use @Path("/"). If I use @Path("/root") then I
don't get the IndexOutOfBoundsException anymore. @Path("") also causes
IndexOutOfBoundsException. Without the @Path annotation at class resources
will not be found.
>
> Jaroslav Libak
>
> -----Original Message-----
> From: Mike Rheinheimer [mailto:rott@apache.org]
> Sent: Friday, October 09, 2009 6:58 PM
> To: wink-user@incubator.apache.org
> Subject: Re: non functional PathSegment + PathParam
>
> Hi Jaroslav,
>
> I took your test and ran it through the latest WINK runtime.  The
> behavior you described for your first test is also what I saw.  I did
> not get the IndexOutOfBoundsException, but I also did not get the
> expected PathParams in my resource method.
>
> Given the @Path you declared, the first query you tested would be
> invalid.  The forward slashes are the delimiters.  Your @Path has only
> two slashes (beginning with the one prior to "testRuns", where your
> query had four (also beginning with the one prior to "testRuns").  So,
> the results of the first test were not surprising.
>
> The fourth test you performed was the interesting one to me.  I would
> have expected that to work.  It did not, of course, so I've submitted
> a Jira and a patch:
>
> https://issues.apache.org/jira/browse/WINK-214
>
> The release manager for WINK 1.0 will accept this patch, so it will be
> fixed in the next release (which is being renamed from 0.2 to 1.0).
>
> Thanks for catching this!
>
> Side note:  a workaround could have been to instead declare the @Path
> as such: @Path
("/{testRunsParams:testRuns}/{testSuitesParams:testSuites}")
>
> Side note #2:  also, declaring
> @Path("/testRuns/{testRunsParams}/testSuites/{testSuitesParams}") and
> sending only matrix params, like so:
>
http://localhost:8080/testqueryapi/rest/testRuns/;name=jaro/testSuites/;eyes=blue

>  requires a little more effort to support in the WINK runtime.  If
> this is an item WINK supports, it likely won't go into 1.0.  I've
> opened a Jira for this as well:
>
> https://issues.apache.org/jira/browse/WINK-216
>
> mike
>
>
> On Fri, Oct 9, 2009 at 6:49 AM, Libak, Jaroslav <ja...@hp.com>
wrote:
>> Hello
>>
>>
>>
>> I need to use PathSegments for multiple PathParams in my resource
method. My
>> method looks like:
>>
>>
>>
>> @GET
>>
>> @Path("/testRuns{testRunsParams:.*}/testSuites{testSuitesParams:.*}")
>>
>> @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON,
>> MediaType.APPLICATION_ATOM_XML})
>>
>>     public TestRunsAsset findTestRuns(@PathParam("testRunsParams") final
>> PathSegment testRunsParams,
>>
>>
>>                                            @PathParam
("testSuitesParams")
>> final PathSegment testSuitesParams) {
>>
>>       // some code
>>
>>     }
>>
>>
>>
>> What I want to achieve is that if someone accesses my resource using:
>>
>>
>>
>>
http://localhost:8080/testqueryapi/rest/testRuns/;name=jaro/testSuites/;eyes=blue

>> - resource method gets executed but content of testRunsParams and
>> testSuitesParams is wrong. testRunsParams seems to contain partially
what
>> testSuitesParams should, with matrix parameters "name" or "eyes" not
>> present. In Idea debugger I see testRunsParams =
>> {org.apache.wink.common.internal.PathSegmentImpl@751}"testSuites"
>>
>>
>>
>> http://localhost:8080/testqueryapi/rest/testRuns /testSuites/ - results
in
>> IndexOutOfBoundsException at UriTemplateMatcher:423
>>
>>
http://localhost:8080/testqueryapi/rest/testRuns;name=jaro/testSuites/;eyes=blue

>> - results in IndexOutOfBoundsException at UriTemplateMatcher:423
>>
>>
http://localhost:8080/testqueryapi/rest/testRuns;name=jaro/testSuites;eyes=blue

>> - results in IndexOutOfBoundsException at UriTemplateMatcher:423
>>
>>
>>
>> then my method gets executed and matrix parameters are available in
>> testRunsParams for parameters in "testRuns" segment and in
testSuitesParams
>> for "testSuites" segment. All matrix parameters are optional.
>>
>>
>>
>> I saw on
>>
http://jboss.org/file-access/default/members/resteasy/freezone/docs/1.1.GA/userguide/html_single/index.html#_PathParam_and_PathSegment

>> in section 4.2 that when you use @Path("/book/{id}") on method, then
>>
>> GET http://host.com/library/book;name=EJB 3.0;author=Bill Burke
>>
>> Will result in method being called and name, author being available in
>> PathSegment.getMatrixParameters
>>
>>
>>
>> When I tried something similar on my method:
>>
>> @Path("/testRuns/{testRunsParams}/testSuites/{testSuitesParams}")
>>
>>
>>
>> Then accessing the following URLs does not result in method execution:
>>
>> http://localhost:8080/testqueryapi/rest/testRuns/testSuites
>>
>> http://localhost:8080/testqueryapi/rest/testRuns/;name=jaro/testSuites
>>
>>
http://localhost:8080/testqueryapi/rest/testRuns/;name=jaro/testSuites/;eyes=blue

>>
>>
http://localhost:8080/testqueryapi/rest/testRuns/;name=jaro/testSuites;eyes=blue

>>
>>
http://localhost:8080/testqueryapi/rest/testRuns;name=jaro/testSuites;eyes=blue

>>
>>
>>
>>
http://localhost:8080/testqueryapi/rest/testRuns/testRunsParams=1;name=jaro/testSuites/testSuitesParams=2;eyes=blue

>> - results in IndexOutOfBoundsException at UriTemplateMatcher.java:436
>>
>>
>>
>> Is this URL matching correct or is it a bug? To me it appears there are
two
>> problems - first with URL matching and second with PathSegment.
>>
>>
>>
>> From
>>
http://jackson.codehaus.org/javadoc/jax-rs/1.0/javax/ws/rs/core/PathSegment.html

>> we can read that value of PathParam annotation determines which path
segment
>> is selected for PathSegment.
>>
>>
>>
>> I tried Wink 0.1 and 0.2 snapshot and they both suffer from problem with
>> PathSegment not being functional. I would appreciate having some patch
for
>> 0.2 snapshot soon.
>>
>>
>>
>> Jaroslav Libak
>>
>>
>

Re: non functional PathSegment + PathParam

Posted by Mike Rheinheimer <ro...@apache.org>.
Ahhh, now I see.  :)  I've reproduced that problem, so I'll take a
look at a fix.  The JAX-RS spec, in section 3.4, says "A URI path
template is a string with zero or more embedded parameters...".  So at
first glance, it appears you have found a bug.  Since 1.0 is in the
works to be released, I'm copying the dev list too.  This may need to
be fixed before 1.0 is released.

mike

2009/10/12 Libak, Jaroslav <ja...@hp.com>:
> Thanks. But I'm still getting IndexOutOfBoundsException even after your patch when I use correct URL for accessing the resource. I used wink trunk from today.
>
> I have only one resource class:
>
> @Path("/")
> public class TestResultsResource {
>
> ...
>
> }
>
> I don't need to use more than one resource class (it's a very simple application) so that's why I use @Path("/"). If I use @Path("/root") then I don't get the IndexOutOfBoundsException anymore. @Path("") also causes IndexOutOfBoundsException. Without the @Path annotation at class resources will not be found.
>
> Jaroslav Libak
>
> -----Original Message-----
> From: Mike Rheinheimer [mailto:rott@apache.org]
> Sent: Friday, October 09, 2009 6:58 PM
> To: wink-user@incubator.apache.org
> Subject: Re: non functional PathSegment + PathParam
>
> Hi Jaroslav,
>
> I took your test and ran it through the latest WINK runtime.  The
> behavior you described for your first test is also what I saw.  I did
> not get the IndexOutOfBoundsException, but I also did not get the
> expected PathParams in my resource method.
>
> Given the @Path you declared, the first query you tested would be
> invalid.  The forward slashes are the delimiters.  Your @Path has only
> two slashes (beginning with the one prior to "testRuns", where your
> query had four (also beginning with the one prior to "testRuns").  So,
> the results of the first test were not surprising.
>
> The fourth test you performed was the interesting one to me.  I would
> have expected that to work.  It did not, of course, so I've submitted
> a Jira and a patch:
>
> https://issues.apache.org/jira/browse/WINK-214
>
> The release manager for WINK 1.0 will accept this patch, so it will be
> fixed in the next release (which is being renamed from 0.2 to 1.0).
>
> Thanks for catching this!
>
> Side note:  a workaround could have been to instead declare the @Path
> as such: @Path("/{testRunsParams:testRuns}/{testSuitesParams:testSuites}")
>
> Side note #2:  also, declaring
> @Path("/testRuns/{testRunsParams}/testSuites/{testSuitesParams}") and
> sending only matrix params, like so:
> http://localhost:8080/testqueryapi/rest/testRuns/;name=jaro/testSuites/;eyes=blue
>  requires a little more effort to support in the WINK runtime.  If
> this is an item WINK supports, it likely won't go into 1.0.  I've
> opened a Jira for this as well:
>
> https://issues.apache.org/jira/browse/WINK-216
>
> mike
>
>
> On Fri, Oct 9, 2009 at 6:49 AM, Libak, Jaroslav <ja...@hp.com> wrote:
>> Hello
>>
>>
>>
>> I need to use PathSegments for multiple PathParams in my resource method. My
>> method looks like:
>>
>>
>>
>> @GET
>>
>> @Path("/testRuns{testRunsParams:.*}/testSuites{testSuitesParams:.*}")
>>
>> @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON,
>> MediaType.APPLICATION_ATOM_XML})
>>
>>     public TestRunsAsset findTestRuns(@PathParam("testRunsParams") final
>> PathSegment testRunsParams,
>>
>>
>>                                            @PathParam("testSuitesParams")
>> final PathSegment testSuitesParams) {
>>
>>       // some code
>>
>>     }
>>
>>
>>
>> What I want to achieve is that if someone accesses my resource using:
>>
>>
>>
>> http://localhost:8080/testqueryapi/rest/testRuns/;name=jaro/testSuites/;eyes=blue
>> - resource method gets executed but content of testRunsParams and
>> testSuitesParams is wrong. testRunsParams seems to contain partially what
>> testSuitesParams should, with matrix parameters "name" or "eyes" not
>> present. In Idea debugger I see testRunsParams =
>> {org.apache.wink.common.internal.PathSegmentImpl@751}"testSuites"
>>
>>
>>
>> http://localhost:8080/testqueryapi/rest/testRuns /testSuites/ - results in
>> IndexOutOfBoundsException at UriTemplateMatcher:423
>>
>> http://localhost:8080/testqueryapi/rest/testRuns;name=jaro/testSuites/;eyes=blue
>> - results in IndexOutOfBoundsException at UriTemplateMatcher:423
>>
>> http://localhost:8080/testqueryapi/rest/testRuns;name=jaro/testSuites;eyes=blue
>> - results in IndexOutOfBoundsException at UriTemplateMatcher:423
>>
>>
>>
>> then my method gets executed and matrix parameters are available in
>> testRunsParams for parameters in "testRuns" segment and in testSuitesParams
>> for "testSuites" segment. All matrix parameters are optional.
>>
>>
>>
>> I saw on
>> http://jboss.org/file-access/default/members/resteasy/freezone/docs/1.1.GA/userguide/html_single/index.html#_PathParam_and_PathSegment
>> in section 4.2 that when you use @Path("/book/{id}") on method, then
>>
>> GET http://host.com/library/book;name=EJB 3.0;author=Bill Burke
>>
>> Will result in method being called and name, author being available in
>> PathSegment.getMatrixParameters
>>
>>
>>
>> When I tried something similar on my method:
>>
>> @Path("/testRuns/{testRunsParams}/testSuites/{testSuitesParams}")
>>
>>
>>
>> Then accessing the following URLs does not result in method execution:
>>
>> http://localhost:8080/testqueryapi/rest/testRuns/testSuites
>>
>> http://localhost:8080/testqueryapi/rest/testRuns/;name=jaro/testSuites
>>
>> http://localhost:8080/testqueryapi/rest/testRuns/;name=jaro/testSuites/;eyes=blue
>>
>> http://localhost:8080/testqueryapi/rest/testRuns/;name=jaro/testSuites;eyes=blue
>>
>> http://localhost:8080/testqueryapi/rest/testRuns;name=jaro/testSuites;eyes=blue
>>
>>
>>
>> http://localhost:8080/testqueryapi/rest/testRuns/testRunsParams=1;name=jaro/testSuites/testSuitesParams=2;eyes=blue
>> - results in IndexOutOfBoundsException at UriTemplateMatcher.java:436
>>
>>
>>
>> Is this URL matching correct or is it a bug? To me it appears there are two
>> problems - first with URL matching and second with PathSegment.
>>
>>
>>
>> From
>> http://jackson.codehaus.org/javadoc/jax-rs/1.0/javax/ws/rs/core/PathSegment.html
>> we can read that value of PathParam annotation determines which path segment
>> is selected for PathSegment.
>>
>>
>>
>> I tried Wink 0.1 and 0.2 snapshot and they both suffer from problem with
>> PathSegment not being functional. I would appreciate having some patch for
>> 0.2 snapshot soon.
>>
>>
>>
>> Jaroslav Libak
>>
>>
>

Re: non functional PathSegment + PathParam

Posted by Mike Rheinheimer <ro...@apache.org>.
Ahhh, now I see.  :)  I've reproduced that problem, so I'll take a
look at a fix.  The JAX-RS spec, in section 3.4, says "A URI path
template is a string with zero or more embedded parameters...".  So at
first glance, it appears you have found a bug.  Since 1.0 is in the
works to be released, I'm copying the dev list too.  This may need to
be fixed before 1.0 is released.

mike

2009/10/12 Libak, Jaroslav <ja...@hp.com>:
> Thanks. But I'm still getting IndexOutOfBoundsException even after your patch when I use correct URL for accessing the resource. I used wink trunk from today.
>
> I have only one resource class:
>
> @Path("/")
> public class TestResultsResource {
>
> ...
>
> }
>
> I don't need to use more than one resource class (it's a very simple application) so that's why I use @Path("/"). If I use @Path("/root") then I don't get the IndexOutOfBoundsException anymore. @Path("") also causes IndexOutOfBoundsException. Without the @Path annotation at class resources will not be found.
>
> Jaroslav Libak
>
> -----Original Message-----
> From: Mike Rheinheimer [mailto:rott@apache.org]
> Sent: Friday, October 09, 2009 6:58 PM
> To: wink-user@incubator.apache.org
> Subject: Re: non functional PathSegment + PathParam
>
> Hi Jaroslav,
>
> I took your test and ran it through the latest WINK runtime.  The
> behavior you described for your first test is also what I saw.  I did
> not get the IndexOutOfBoundsException, but I also did not get the
> expected PathParams in my resource method.
>
> Given the @Path you declared, the first query you tested would be
> invalid.  The forward slashes are the delimiters.  Your @Path has only
> two slashes (beginning with the one prior to "testRuns", where your
> query had four (also beginning with the one prior to "testRuns").  So,
> the results of the first test were not surprising.
>
> The fourth test you performed was the interesting one to me.  I would
> have expected that to work.  It did not, of course, so I've submitted
> a Jira and a patch:
>
> https://issues.apache.org/jira/browse/WINK-214
>
> The release manager for WINK 1.0 will accept this patch, so it will be
> fixed in the next release (which is being renamed from 0.2 to 1.0).
>
> Thanks for catching this!
>
> Side note:  a workaround could have been to instead declare the @Path
> as such: @Path("/{testRunsParams:testRuns}/{testSuitesParams:testSuites}")
>
> Side note #2:  also, declaring
> @Path("/testRuns/{testRunsParams}/testSuites/{testSuitesParams}") and
> sending only matrix params, like so:
> http://localhost:8080/testqueryapi/rest/testRuns/;name=jaro/testSuites/;eyes=blue
>  requires a little more effort to support in the WINK runtime.  If
> this is an item WINK supports, it likely won't go into 1.0.  I've
> opened a Jira for this as well:
>
> https://issues.apache.org/jira/browse/WINK-216
>
> mike
>
>
> On Fri, Oct 9, 2009 at 6:49 AM, Libak, Jaroslav <ja...@hp.com> wrote:
>> Hello
>>
>>
>>
>> I need to use PathSegments for multiple PathParams in my resource method. My
>> method looks like:
>>
>>
>>
>> @GET
>>
>> @Path("/testRuns{testRunsParams:.*}/testSuites{testSuitesParams:.*}")
>>
>> @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON,
>> MediaType.APPLICATION_ATOM_XML})
>>
>>     public TestRunsAsset findTestRuns(@PathParam("testRunsParams") final
>> PathSegment testRunsParams,
>>
>>
>>                                            @PathParam("testSuitesParams")
>> final PathSegment testSuitesParams) {
>>
>>       // some code
>>
>>     }
>>
>>
>>
>> What I want to achieve is that if someone accesses my resource using:
>>
>>
>>
>> http://localhost:8080/testqueryapi/rest/testRuns/;name=jaro/testSuites/;eyes=blue
>> - resource method gets executed but content of testRunsParams and
>> testSuitesParams is wrong. testRunsParams seems to contain partially what
>> testSuitesParams should, with matrix parameters "name" or "eyes" not
>> present. In Idea debugger I see testRunsParams =
>> {org.apache.wink.common.internal.PathSegmentImpl@751}"testSuites"
>>
>>
>>
>> http://localhost:8080/testqueryapi/rest/testRuns /testSuites/ - results in
>> IndexOutOfBoundsException at UriTemplateMatcher:423
>>
>> http://localhost:8080/testqueryapi/rest/testRuns;name=jaro/testSuites/;eyes=blue
>> - results in IndexOutOfBoundsException at UriTemplateMatcher:423
>>
>> http://localhost:8080/testqueryapi/rest/testRuns;name=jaro/testSuites;eyes=blue
>> - results in IndexOutOfBoundsException at UriTemplateMatcher:423
>>
>>
>>
>> then my method gets executed and matrix parameters are available in
>> testRunsParams for parameters in "testRuns" segment and in testSuitesParams
>> for "testSuites" segment. All matrix parameters are optional.
>>
>>
>>
>> I saw on
>> http://jboss.org/file-access/default/members/resteasy/freezone/docs/1.1.GA/userguide/html_single/index.html#_PathParam_and_PathSegment
>> in section 4.2 that when you use @Path("/book/{id}") on method, then
>>
>> GET http://host.com/library/book;name=EJB 3.0;author=Bill Burke
>>
>> Will result in method being called and name, author being available in
>> PathSegment.getMatrixParameters
>>
>>
>>
>> When I tried something similar on my method:
>>
>> @Path("/testRuns/{testRunsParams}/testSuites/{testSuitesParams}")
>>
>>
>>
>> Then accessing the following URLs does not result in method execution:
>>
>> http://localhost:8080/testqueryapi/rest/testRuns/testSuites
>>
>> http://localhost:8080/testqueryapi/rest/testRuns/;name=jaro/testSuites
>>
>> http://localhost:8080/testqueryapi/rest/testRuns/;name=jaro/testSuites/;eyes=blue
>>
>> http://localhost:8080/testqueryapi/rest/testRuns/;name=jaro/testSuites;eyes=blue
>>
>> http://localhost:8080/testqueryapi/rest/testRuns;name=jaro/testSuites;eyes=blue
>>
>>
>>
>> http://localhost:8080/testqueryapi/rest/testRuns/testRunsParams=1;name=jaro/testSuites/testSuitesParams=2;eyes=blue
>> - results in IndexOutOfBoundsException at UriTemplateMatcher.java:436
>>
>>
>>
>> Is this URL matching correct or is it a bug? To me it appears there are two
>> problems - first with URL matching and second with PathSegment.
>>
>>
>>
>> From
>> http://jackson.codehaus.org/javadoc/jax-rs/1.0/javax/ws/rs/core/PathSegment.html
>> we can read that value of PathParam annotation determines which path segment
>> is selected for PathSegment.
>>
>>
>>
>> I tried Wink 0.1 and 0.2 snapshot and they both suffer from problem with
>> PathSegment not being functional. I would appreciate having some patch for
>> 0.2 snapshot soon.
>>
>>
>>
>> Jaroslav Libak
>>
>>
>

RE: non functional PathSegment + PathParam

Posted by "Libak, Jaroslav" <ja...@hp.com>.
Thanks. But I'm still getting IndexOutOfBoundsException even after your patch when I use correct URL for accessing the resource. I used wink trunk from today.

I have only one resource class:

@Path("/")
public class TestResultsResource {

...

}

I don't need to use more than one resource class (it's a very simple application) so that's why I use @Path("/"). If I use @Path("/root") then I don't get the IndexOutOfBoundsException anymore. @Path("") also causes IndexOutOfBoundsException. Without the @Path annotation at class resources will not be found.

Jaroslav Libak

-----Original Message-----
From: Mike Rheinheimer [mailto:rott@apache.org] 
Sent: Friday, October 09, 2009 6:58 PM
To: wink-user@incubator.apache.org
Subject: Re: non functional PathSegment + PathParam

Hi Jaroslav,

I took your test and ran it through the latest WINK runtime.  The
behavior you described for your first test is also what I saw.  I did
not get the IndexOutOfBoundsException, but I also did not get the
expected PathParams in my resource method.

Given the @Path you declared, the first query you tested would be
invalid.  The forward slashes are the delimiters.  Your @Path has only
two slashes (beginning with the one prior to "testRuns", where your
query had four (also beginning with the one prior to "testRuns").  So,
the results of the first test were not surprising.

The fourth test you performed was the interesting one to me.  I would
have expected that to work.  It did not, of course, so I've submitted
a Jira and a patch:

https://issues.apache.org/jira/browse/WINK-214

The release manager for WINK 1.0 will accept this patch, so it will be
fixed in the next release (which is being renamed from 0.2 to 1.0).

Thanks for catching this!

Side note:  a workaround could have been to instead declare the @Path
as such: @Path("/{testRunsParams:testRuns}/{testSuitesParams:testSuites}")

Side note #2:  also, declaring
@Path("/testRuns/{testRunsParams}/testSuites/{testSuitesParams}") and
sending only matrix params, like so:
http://localhost:8080/testqueryapi/rest/testRuns/;name=jaro/testSuites/;eyes=blue
 requires a little more effort to support in the WINK runtime.  If
this is an item WINK supports, it likely won't go into 1.0.  I've
opened a Jira for this as well:

https://issues.apache.org/jira/browse/WINK-216

mike


On Fri, Oct 9, 2009 at 6:49 AM, Libak, Jaroslav <ja...@hp.com> wrote:
> Hello
>
>
>
> I need to use PathSegments for multiple PathParams in my resource method. My
> method looks like:
>
>
>
> @GET
>
> @Path("/testRuns{testRunsParams:.*}/testSuites{testSuitesParams:.*}")
>
> @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON,
> MediaType.APPLICATION_ATOM_XML})
>
>     public TestRunsAsset findTestRuns(@PathParam("testRunsParams") final
> PathSegment testRunsParams,
>
>
>                                            @PathParam("testSuitesParams")
> final PathSegment testSuitesParams) {
>
>       // some code
>
>     }
>
>
>
> What I want to achieve is that if someone accesses my resource using:
>
>
>
> http://localhost:8080/testqueryapi/rest/testRuns/;name=jaro/testSuites/;eyes=blue
> - resource method gets executed but content of testRunsParams and
> testSuitesParams is wrong. testRunsParams seems to contain partially what
> testSuitesParams should, with matrix parameters "name" or "eyes" not
> present. In Idea debugger I see testRunsParams =
> {org.apache.wink.common.internal.PathSegmentImpl@751}"testSuites"
>
>
>
> http://localhost:8080/testqueryapi/rest/testRuns /testSuites/ - results in
> IndexOutOfBoundsException at UriTemplateMatcher:423
>
> http://localhost:8080/testqueryapi/rest/testRuns;name=jaro/testSuites/;eyes=blue
> - results in IndexOutOfBoundsException at UriTemplateMatcher:423
>
> http://localhost:8080/testqueryapi/rest/testRuns;name=jaro/testSuites;eyes=blue
> - results in IndexOutOfBoundsException at UriTemplateMatcher:423
>
>
>
> then my method gets executed and matrix parameters are available in
> testRunsParams for parameters in "testRuns" segment and in testSuitesParams
> for "testSuites" segment. All matrix parameters are optional.
>
>
>
> I saw on
> http://jboss.org/file-access/default/members/resteasy/freezone/docs/1.1.GA/userguide/html_single/index.html#_PathParam_and_PathSegment
> in section 4.2 that when you use @Path("/book/{id}") on method, then
>
> GET http://host.com/library/book;name=EJB 3.0;author=Bill Burke
>
> Will result in method being called and name, author being available in
> PathSegment.getMatrixParameters
>
>
>
> When I tried something similar on my method:
>
> @Path("/testRuns/{testRunsParams}/testSuites/{testSuitesParams}")
>
>
>
> Then accessing the following URLs does not result in method execution:
>
> http://localhost:8080/testqueryapi/rest/testRuns/testSuites
>
> http://localhost:8080/testqueryapi/rest/testRuns/;name=jaro/testSuites
>
> http://localhost:8080/testqueryapi/rest/testRuns/;name=jaro/testSuites/;eyes=blue
>
> http://localhost:8080/testqueryapi/rest/testRuns/;name=jaro/testSuites;eyes=blue
>
> http://localhost:8080/testqueryapi/rest/testRuns;name=jaro/testSuites;eyes=blue
>
>
>
> http://localhost:8080/testqueryapi/rest/testRuns/testRunsParams=1;name=jaro/testSuites/testSuitesParams=2;eyes=blue
> - results in IndexOutOfBoundsException at UriTemplateMatcher.java:436
>
>
>
> Is this URL matching correct or is it a bug? To me it appears there are two
> problems - first with URL matching and second with PathSegment.
>
>
>
> From
> http://jackson.codehaus.org/javadoc/jax-rs/1.0/javax/ws/rs/core/PathSegment.html
> we can read that value of PathParam annotation determines which path segment
> is selected for PathSegment.
>
>
>
> I tried Wink 0.1 and 0.2 snapshot and they both suffer from problem with
> PathSegment not being functional. I would appreciate having some patch for
> 0.2 snapshot soon.
>
>
>
> Jaroslav Libak
>
>

Re: non functional PathSegment + PathParam

Posted by Mike Rheinheimer <ro...@apache.org>.
Hi Jaroslav,

I took your test and ran it through the latest WINK runtime.  The
behavior you described for your first test is also what I saw.  I did
not get the IndexOutOfBoundsException, but I also did not get the
expected PathParams in my resource method.

Given the @Path you declared, the first query you tested would be
invalid.  The forward slashes are the delimiters.  Your @Path has only
two slashes (beginning with the one prior to "testRuns", where your
query had four (also beginning with the one prior to "testRuns").  So,
the results of the first test were not surprising.

The fourth test you performed was the interesting one to me.  I would
have expected that to work.  It did not, of course, so I've submitted
a Jira and a patch:

https://issues.apache.org/jira/browse/WINK-214

The release manager for WINK 1.0 will accept this patch, so it will be
fixed in the next release (which is being renamed from 0.2 to 1.0).

Thanks for catching this!

Side note:  a workaround could have been to instead declare the @Path
as such: @Path("/{testRunsParams:testRuns}/{testSuitesParams:testSuites}")

Side note #2:  also, declaring
@Path("/testRuns/{testRunsParams}/testSuites/{testSuitesParams}") and
sending only matrix params, like so:
http://localhost:8080/testqueryapi/rest/testRuns/;name=jaro/testSuites/;eyes=blue
 requires a little more effort to support in the WINK runtime.  If
this is an item WINK supports, it likely won't go into 1.0.  I've
opened a Jira for this as well:

https://issues.apache.org/jira/browse/WINK-216

mike


On Fri, Oct 9, 2009 at 6:49 AM, Libak, Jaroslav <ja...@hp.com> wrote:
> Hello
>
>
>
> I need to use PathSegments for multiple PathParams in my resource method. My
> method looks like:
>
>
>
> @GET
>
> @Path("/testRuns{testRunsParams:.*}/testSuites{testSuitesParams:.*}")
>
> @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON,
> MediaType.APPLICATION_ATOM_XML})
>
>     public TestRunsAsset findTestRuns(@PathParam("testRunsParams") final
> PathSegment testRunsParams,
>
>
>                                            @PathParam("testSuitesParams")
> final PathSegment testSuitesParams) {
>
>       // some code
>
>     }
>
>
>
> What I want to achieve is that if someone accesses my resource using:
>
>
>
> http://localhost:8080/testqueryapi/rest/testRuns/;name=jaro/testSuites/;eyes=blue
> – resource method gets executed but content of testRunsParams and
> testSuitesParams is wrong. testRunsParams seems to contain partially what
> testSuitesParams should, with matrix parameters “name” or “eyes” not
> present. In Idea debugger I see testRunsParams =
> {org.apache.wink.common.internal.PathSegmentImpl@751}"testSuites"
>
>
>
> http://localhost:8080/testqueryapi/rest/testRuns /testSuites/ – results in
> IndexOutOfBoundsException at UriTemplateMatcher:423
>
> http://localhost:8080/testqueryapi/rest/testRuns;name=jaro/testSuites/;eyes=blue
> – results in IndexOutOfBoundsException at UriTemplateMatcher:423
>
> http://localhost:8080/testqueryapi/rest/testRuns;name=jaro/testSuites;eyes=blue
> – results in IndexOutOfBoundsException at UriTemplateMatcher:423
>
>
>
> then my method gets executed and matrix parameters are available in
> testRunsParams for parameters in “testRuns” segment and in testSuitesParams
> for “testSuites” segment. All matrix parameters are optional.
>
>
>
> I saw on
> http://jboss.org/file-access/default/members/resteasy/freezone/docs/1.1.GA/userguide/html_single/index.html#_PathParam_and_PathSegment
> in section 4.2 that when you use @Path("/book/{id}") on method, then
>
> GET http://host.com/library/book;name=EJB 3.0;author=Bill Burke
>
> Will result in method being called and name, author being available in
> PathSegment.getMatrixParameters
>
>
>
> When I tried something similar on my method:
>
> @Path("/testRuns/{testRunsParams}/testSuites/{testSuitesParams}")
>
>
>
> Then accessing the following URLs does not result in method execution:
>
> http://localhost:8080/testqueryapi/rest/testRuns/testSuites
>
> http://localhost:8080/testqueryapi/rest/testRuns/;name=jaro/testSuites
>
> http://localhost:8080/testqueryapi/rest/testRuns/;name=jaro/testSuites/;eyes=blue
>
> http://localhost:8080/testqueryapi/rest/testRuns/;name=jaro/testSuites;eyes=blue
>
> http://localhost:8080/testqueryapi/rest/testRuns;name=jaro/testSuites;eyes=blue
>
>
>
> http://localhost:8080/testqueryapi/rest/testRuns/testRunsParams=1;name=jaro/testSuites/testSuitesParams=2;eyes=blue
> – results in IndexOutOfBoundsException at UriTemplateMatcher.java:436
>
>
>
> Is this URL matching correct or is it a bug? To me it appears there are two
> problems – first with URL matching and second with PathSegment.
>
>
>
> From
> http://jackson.codehaus.org/javadoc/jax-rs/1.0/javax/ws/rs/core/PathSegment.html
> we can read that value of PathParam annotation determines which path segment
> is selected for PathSegment.
>
>
>
> I tried Wink 0.1 and 0.2 snapshot and they both suffer from problem with
> PathSegment not being functional. I would appreciate having some patch for
> 0.2 snapshot soon.
>
>
>
> Jaroslav Libak
>
>