Hi

No problems at all and thanks for asking this question.
The problem is that both resources match requests starting from
/a/known/path/with or indeed with
/a/, etc. It is not possible in JAXRS to try to find an operation on one
matching resource and then try to do the same for another matching resource,
etc; though a JIRA has been opened in CXF to extend the selection algorithm.

So try restricting the URI space that a default resource can handle, ex,
assuming that possible URIs are either

/a/known/path/with/{parameters}

or /a/known/path/with

then    

@path("/a/known/path/with/")
interface AKnownResource {
  @path("{variables}")
  Response aKnownMethod();
}

@path("/a/known/path/with")
interface ADefaultResource {
   @GET
   Response defaultResource();
}

should do it.

By the way, can you please give a bit more info about this message :

"No operation matching request path l is found on subresource"

is it '|' which is actually reported in this case ? or '/' ?

thanks, Sergey


devon.boyle wrote:
> 
> Hi.
> 
> I'm wondering if its possible to setup a default resource/service class to
> handle requests that don't otherwise match existing resources in the
> server? 
> 
> I'm new to CXF and JAX-RS, so I apologize if this is a painfully obvious
> question. But somehow, I couldn't find any answers to it in the
> documentation or on the forums. Perhaps I don't know the right key words
> yet...  At any rate, I'd really appreciate any help anyone could offer.
> 
> Here is a very simple example to explain what I'm trying to do:
> 
> interface AKnownResource {
>   @path("/a/known/path/with/{variables}")
>   Response aKnownMethod();
> }
> 
> interface ADefaultResource {
>   // Not sure what to put for @path()
>   Response defaultResource();
> }
> 
> With the idea that request for
> "http://mydomain/a/known/path/with/variables"; would invoke aKnownMethod(),
> while any other URL would invoke defaultResource().
> 
> I've tried using the regex variable syntax to register the default
> service, such as:
> 
> @Path("{path:(.)+}")
> 
> This successfully invokes the defaultResource() method, but then the
> server fails to find a subresource to complete the processing of the
> response.:
> 
> "No operation matching request path l is found on subresource"
> 
> I'm sure I am going about this all wrong. Would anyone mind pointing me in
> the right direction?
> 
> Thank you,
> -Devon
> 

-- 
View this message in context: 
http://www.nabble.com/Is-it-possible-to-register-a-default-resource--tp25828961p25847003.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to