cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tong, Gary" <Gary.T...@morganstanley.com>
Subject RE: JAX-RS Request Matching Wierdness
Date Sun, 12 Jul 2009 10:52:25 GMT
Hi Sergey,

The problems come up in a number of situations, all involving multiple service beans.  The
simplest case is the following:

public class AWebService {
  @GET
  @Path("/a")
  public String a() {
    return "a";
  }
}

public class BWebService {
  @GET
  @Path("/b")
  public String b() {
    return "b";
  }
}

One of the two will work, but not both.

This is of course the simplest case, but there are a number of other more concrete use cases
that cause issues.  For instance, if I had the following URLs:

GET /user
POST /user
GET /user/search?params

And I wanted to put the CRUD ops on UserWebService but the search stuff on a SearchWebService
that uses @Path("/{type}/search") then that wouldn't work in CXF.  Also, for instance if I
had the following urls:

GET /posts
GET /user
GET /user/{id}/posts

/posts would go on PostWebService and /user would go on UserWebService, but if I wanted PostWebService
to handle /user/{id}/posts as just a specialized version of /posts that would be tricky with
CXF.  It's doable with sub-resource locators, but then my response objects start getting complicated.

Thanks,
Gary

-----Original Message-----
From: Sergey Beryozkin [mailto:sberyozk@progress.com] 
Sent: 11 July 2009 21:28
To: dev@cxf.apache.org
Subject: RE: JAX-RS Request Matching Wierdness

Hi Gary

So what is the concrete problem you're facing ?

FYI, it is the map that sorts resource classes according a number of criteria. Another thing
is that the JAX-RS selection algorithm does not have be implemented literally the way it's
documented in the spec, rather the final result should be correct.

So let me know please what exactly is happening in your case

Thanks, Sergey     

-----Original Message-----
From: Tong, Gary [mailto:Gary.Tong@morganstanley.com]
Sent: 11 July 2009 16:57
To: dev@cxf.apache.org
Subject: JAX-RS Request Matching Wierdness

Hello,

Hey guys, just fyi, CXF's jax-rs doesn't do request matching correctly.
According to JSR 311 in section 3.7.2, the jax-rs server is supposed to apply a series of
steps to determine which URL to use for the request.
Instead, CXF applies a path filter at the class level, and then returns the first entry it
finds.  Specifically the code that does this is in
JAXRSUtils.selectResourceClass:

        if (!candidateList.isEmpty()) {
            Map.Entry<ClassResourceInfo, MultivaluedMap<String, String>> firstEntry
=
                candidateList.entrySet().iterator().next();
            values.putAll(firstEntry.getValue());
            return firstEntry.getKey();
        }


Not sure if you guys know about this.

Cheers,
Gary

------------------------------------------------------------------------
--
NOTICE: If received in error, please destroy, and notify sender. Sender does not intend to
waive confidentiality or privilege. Use of this email is prohibited when received in error.
We may monitor and store emails to the extent permitted by applicable law.

--------------------------------------------------------------------------
NOTICE: If received in error, please destroy, and notify sender. Sender does not intend to
waive confidentiality or privilege. Use of this email is prohibited when received in error.
We may monitor and store emails to the extent permitted by applicable law.

Mime
View raw message