Yeah, after reading the source code, I realized that the path resolution
happens in 2 phases. The first is the servelet selection based on the first
address.startsWith(path) match, and the second the score based match for the
URL once it gets into the servlet. Because of that overlapping URI path
elements won't ever get to the appropriate class (at least in my example).
The JSR-311 bindings look neat though (at least based on your description) so
I'll try to take a look at it. Thanks for the info!
-- Cheers
-- James
-Original Message-
From: Sergey Beryozkin [mailto:[EMAIL PROTECTED]
Sent: Thursday, January 31, 2008 2:52 AM
To: cxf-user@incubator.apache.org
Subject: Re: Question on URI resolution and WS endpoints.
Hi
I'm not sure you can achive it with CXF-specific REST bindings but it's most
likely you can do it (I hope pretty easily) with the CXF JAX-RS implementation.
Here's the way Servers and Server resources may look like. I belive there's no
need to specifically annotate ResultySet class in this case.
@UriTemplate("/servers")
public class Servers {
@HttpMethod
public Source getAll() {
return serversConvertedToSource;
}
// sub-resource locator
@UriTemplate("{server}")
public Server getServer(@UriParam String server) {
// use server id to find a Server instance
return server;
}
}
@UriTemplate("/servers/{server}")
public class Server {
@HttpMethod
public Response getState() {
}
@HttpMethod
@UriTemplate("resultsets")
public Source getAllResultSets() {
return resultSetsConvertedToSource;
}
// sub-resource locator
@UriTemplate("resultsets/{id}")
public ResultSet getResultSet(@UriParam String id) {
return resultSet;
}
}
1. /Servers should be handled by Servers.getAll(), 2. /Servers/1 should be
handled by an individual Server.getState(), preliminary routed through a
subresource locator Servers.getServer() 3. /Servers/1/resultsets and
/Servers/1/resultsets/1 will be handled by an individual Serve instance
It's likely that some chnages may need to be done to the above classes to make
them work with CXF JSR 311 impl.
For ex it supports DOMSource only at the moment, not sure about Response, about
its ability to match GET to @HttpMethod annotated methods starting with 'get'
(so @HttpMethod(name=GET) may need to be used), etc...
We haven't had time and resources yet to polish CXF JSR311 but it's going to
happen, sooner rather than later...
And as I said earlier, most of the issues which may need to be fixed are quite
trivial thus patches are welcome :-)
Cheers, Sergey
- Original Message -
From: "James Mello" <[EMAIL PROTECTED]>
To:
Sent: Wednesday, January 30, 2008 9:52 PM
Subject: Question on URI resolution and WS endpoints.
So I've got the following scenario. I'd like to have the following URI's
available for use using the REST paradigm.
/Servers returns a list of servers
/Servers/{server} returns info about a specific server
/Servers/{server}/ResultSets returns info about the result sets contained on a
server
/Servers/{server}/ResultSets/{resultSet} returns info about a particular result
set on a server.
The thing is I want have the requests to the following URIs to go to a server
object
/Servers/
/Servers/{server}
while requests to
/Servers/{server}/ResultSets/
/Servers/{server}/ResultSets/{resultSets} to go to a ResultSet object.
I've currently got the following configuration and classes (note, most of this
probably doesn't work as I've been mucking with things quite a bit):
Spring Config:
http://www.springframework.org/schema/beans";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xmlns:jaxws="http://cxf.apache.org/jaxws";
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/jaxws
http://cxf.apache.org/schemas/jaxws.xsd";>
http://apache.org/cxf/binding/http";>
Servers class:
package com.atsid.test;
import java.util.ArrayList;
import java.util.List;
import javax.jws.WebService;
import org.codehaus.jra.Get;
import org.codehaus.jra.HttpResource;
@WebService
public class Servers
{
private List servers = new ArrayList();
public Servers()
{
servers.add("nun");
servers.add("jackson");
}
@Get
@HttpResource(location="/Servers")
public List getServers()
{