Hi Jerome,
That would be great. As a counter favor, I'll help you with the
Tomcat/Spring integration guide.
Have a nice day,
Marcel
Jerome Louvel wrote:
Hi Marcel,
Thanks for the details about your issue. There is a plan to write an
integration guide for Tomcat as we are getting many related questions. I'll
have a look at your case and get back to you tomorrow.
Best regards,
Jerome
-----Message d'origine-----
De : Marcel Schepers [mailto:[EMAIL PROTECTED]
Envoyé : vendredi 11 août 2006 12:26
À : [email protected]
Objet : b17, tomcat and spring
Hello,
I'm having a hard time getting the b17 release running using
Tomcat and
Spring. What I am trying to accomplish is the setup as described by
Manohar Viswanathan, but unlike Manohar I am using the B17 release.
This is what I've done so far.
The 'standard' stuff in web.xml. The
'org.restlet.target.class' is set
to 'com.javafabric.jobstoday.ws.rest.util.RestTarget', a
class extending
'org.restlet.component.RestletContainer'. The 'handle' method is
overridden. For the sake of readability I've attached the
sources files.
Looking at RestTarget you'll notice that on the first handle
invocation
a manager bean is retrieved from the Spring context. That
manager uses
the RestTarget instance to setup a 'RestletContainerBuilder'.
The following snippet shows how I think the various resources
should be
linked to instances of Restlet. This snippet is from the
manager's init
method.
RestletContainerBuilder builder =
Builders.buildContainer(rootContainer);
for ( ResourceMapping mapping : resourceMappings ) {
Map<String, Restlet> restletMap = mapping.getRestletMap();
for ( String key : restletMap.keySet() ) {
LOG.info(key + "/" + restletMap.get(key));
builder.attachRouter().attach(key, restletMap.get(key));
}
}
Now, assuming that the key has a value of '/vacancy' and the
corresponding map class is an instance of Restlet with a handleGet
method, then an 'http://localhost:8080/ws-rest/vacancy' URL should
invoke the restlet's handleGet method?
I've included the spring configuration file
(ws-rest-application-context.xml). the resource (Vacancy.java), an
overridden RestletContainer (RestTarget.java) and the manager
to set up
the restlets and their corresponsind URLs (RestManager.java).
Deployment of this code works like a charm. With the a
'http://localhost:8080/ws-rest' url I notice the invocation of the
handle method of RestTarget. However, Tomcat gives a 405 error; 'The
method specified in the Request-Line is not allowed for the resource
identified by the request URI'. What is it that I do work?
Thank you very much for your time,
Marcel
Resources:
http://manoharviswanathan.com/blog/tech/developing-restful-web
-services-in-java/