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: <cxf-user@incubator.apache.org> 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: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="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"> <import resource="classpath:META-INF/cxf/cxf.xml"/> <import resource="classpath:META-INF/cxf/cxf-extension-http-binding.xml"/> <import resource="classpath:META-INF/cxf/cxf-servlet.xml"/> <!-- <jaxws:endpoint id="CCM" implementor="com.atsid.test.ResultSetsImpl" address="/Resources/Servers" bindingUri="http://apache.org/cxf/binding/http"> <jaxws:serviceFactory> <bean class="org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean"> <property name="wrapped" value="false" /> </bean> </jaxws:serviceFactory> </jaxws:endpoint> --> <jaxws:endpoint id="Servers" implementor="com.atsid.test.Servers" address="/Resources" bindingUri="http://apache.org/cxf/binding/http"> <jaxws:serviceFactory> <bean class="org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean"> <property name="wrapped" value="false" /> </bean> </jaxws:serviceFactory> </jaxws:endpoint> </beans> 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<String> servers = new ArrayList<String>(); public Servers() { servers.add("nun"); servers.add("jackson"); } @Get @HttpResource(location="/Servers") public List<String> getServers() { return servers; } } ResultSets Interface: package com.atsid.test; import java.util.Collection; import javax.jws.WebParam; import javax.jws.WebResult; import javax.jws.WebService; import org.codehaus.jra.Get; import org.codehaus.jra.HttpResource; import com.apptechsys.ndcore.api.util.ApiException; @WebService public interface ResultSets { @Get @HttpResource(location = "/Servers/{server}") @WebResult(name = "ResultSet") public abstract Collection<String> getResultSets(@WebParam(name = "GetResultSets") GetResultSets rss) throws ApiException; @Get @HttpResource(location = "/Servers/{server}/{resultset}") public ResultSetInfo getResultSet(@WebParam(name="GetResultSets") GetResultSets rss); } Result Sets Impl: package com.atsid.test; import java.util.Arrays; import java.util.Collection; import javax.jws.WebService; import com.apptechsys.ndcore.api.Workspace; import com.apptechsys.ndcore.api.WorkspaceFactory; import com.apptechsys.ndcore.api.util.ApiException; @WebService(endpointInterface = "com.atsid.test.ResultSets") public class ResultSetsImpl implements ResultSets { public Collection<String> getResultSets(GetResultSets rss) throws ApiException { Workspace workspace = WorkspaceFactory.getDefaultWorkspaceType(); workspace.open(rss.getServer(), null, null); return Arrays.asList(workspace.getDatabases("")); } public ResultSetInfo getResultSet(GetResultSets rss) { ResultSetInfo resultSetInfo = new ResultSetInfo(); resultSetInfo.setDescription("foo baz bar"); resultSetInfo.setName("ccm://" + rss.getServer() + "/" + rss.getResultSet()); return resultSetInfo; } } ---------------------------- IONA Technologies PLC (registered in Ireland) Registered Number: 171387 Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland