Hello,

I am trying at the moment to implement a RESTful Service without annotations
(as in using "user model" instead) and using this (for my taste bit
confusing) guide: http://cxf.apache.org/docs/jax-rs.html

Since my implementation does not work I am trying to understand the whole
mechanics in-depth and am stuck at the moment on this example:
http://svn.apache.org/repos/asf/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerUserResourceTest.java

The question I have here, is: Why is it required to programmatically create
UserRessource instances

<snip>
JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();

...
UserResource ur = new UserResource();
ur.setName(BookStoreNoAnnotations.class.getName());
ur.setPath("/bookstoreNoAnnotations");
...
 sf.setModelBeans(ur);
...
</snap>

in addition to setting ModelRef?

<snip>
...
String modelRef =
"classpath:/org/apache/cxf/systest/jaxrs/resources/resources2.xml";
sf.setModelRefWithServiceClass(modelRef,
BookStoreNoAnnotationsInterface.class);
...
</snap>

Isn't it so that the model already describes EVERYTHING UserResource
instances do. When I don't create UserResource instances I get this error:

ERROR [main] apache.cxf.jaxrs.AvstractJAXRSFactoryBean (231) - No resource
classes found

My code looks like this:

...
JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
sf.setAddress("hhtp:/...");
sf.setModelRef("classpath:/to/my/modelref.xml");
sf.setServiceBeans(new MyWSImplementationNoAnnotations);
sf.create()
...

modelref.xml looks like this:

<model xlmns="http://cxf.apache.org/jaxrs";>
        <resource name="MyWSImplementationNoAnnotationsInterface"
path="mywsservice"
                produces="application/json" consumes="multipart/form-data">
                <operation name="do" verb="POST" path="/do">
                        
                        
                </operation>
        </resource>
</model>

And the

public class MyWSImplementationNoAnnotations implements
MyWSImplementationNoAnnotationsInterface {
...
public void do(ComplexClass docontext, AnotherComplexClass domoreStuff) {
...
}
}

cheers
reinis
-- 
View this message in context: 
http://old.nabble.com/RESTful-services-without-annotations-tp27637811p27637811.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to