Some information is here, but I'll add another example and some clarifications
http://cxf.apache.org/docs/jax-rs-basics.html#JAX-RSBasics-Overviewoftheselectionalgorithm . Cheers, Sergey On Wed, Mar 23, 2011 at 9:29 PM, KARR, DAVID (ATTSI) <[email protected]> wrote: > Bingo, works perfectly. Is that mechanism described in the wiki? I > don’t see it. I think I remember seeing this in the JAX-RS spec, but I > noticed at one time that I couldn’t find some of the features described in > the spec in the CXF wiki. > > > > *From:* Sergey Beryozkin [mailto:[email protected]] > *Sent:* Wednesday, March 23, 2011 2:18 PM > *To:* [email protected] > *Cc:* KARR, DAVID (ATTSI) > *Subject:* Re: Possible to have controller handler method that matches if > nothing else matches? > > > > Hi > > On Wed, Mar 23, 2011 at 9:00 PM, KARR, DAVID (ATTSI) <[email protected]> > wrote: > > I have a controller with a root "@Path()" annotation. I have controller > handler methods in that class with "@Path()" annotations. If I supply a > valid URL that matches the controller and one of the handler methods, it > works fine. > > If I supply a URL that matches at least the root Path for the controller, > but not any of the handler methods, it understandably gets a 404 back. > > Is there any way I can write a handler method, along with the all-important > "@Path" annotation, which will match any request that isn't matched by any > of the other handler methods? > > > CXF allows customizing the selection algorithm [1] but it might useful when > several matching root resources or methods are available. > > You might want to introduce a resource method with a Path value containing > a regular expression, say: > > @Path("{id:.*}") > > This Path will capture everything but the method will be selected only if > no other, more specific matches have been found. Give it a try please. > > Cheers, Sergey > > > > > [1] > http://cxf.apache.org/docs/jax-rs-basics.html#JAX-RSBasics-Customselectionbetweenmultipleresources >
