You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Kynan Fraser <ky...@customware.net> on 2009/09/15 07:43:36 UTC

[JAX-RS] Multiple service beans - single class resource match

Hi All,

I've seen a number of related threads but nothing which will suit exactly. I
have 2 service classes, one needs to bind to "/" the other binds to say
"/a".

Now the first has operations like "/b" but also "a/123/blah" and the second
has operations at "/a" and "/a/123" (never a direct overlap on operations).
Unfortunately the current selection algorithm matches the class level first
and so requests to "/a/123/blah" end up throwing the 'No operation matching
request path..' errors. Was any work ever done on supporting an iterative
approach to class level matching?

Something like (psuedo code):

List<ClassResourceInfo> criList = JAXRSUtils.selectResourceClass();
OperationResourceInfo ori = null;
for(ClassResourceInfo cri : criList){
  try {
    ori = JAXRSUtils.findTargetMethod();
  catch (WebApplicationException e){
   // ignore and continue or save and continue
}
if (ori == null){
// not sure how we'd choose which of the exceptions in the loop to throw
here, possibly a new one
throw WebApplicationException();
}

If not, is there any smart way to get this to work?

The alternative of splitting the classes out or merging them is not really
desirable... but is the back up plan.

Thanks,
Kynan

FYI: I did just post a follow up here on multiple root resources (which is
related) -
http://www.nabble.com/JAXRS%3A-Multiple-service-beans-problem-to23069677.html#a25447827
-- 
View this message in context: http://www.nabble.com/-JAX-RS--Multiple-service-beans---single-class-resource-match-tp25448148p25448148.html
Sent from the cxf-user mailing list archive at Nabble.com.