You need to attach a CLAP client to the component created by the
ServerServlet. I do this (in Restlet 1.1) by subclassing Component and
putting
getClients().add(Protocol.CLAP);
in the constructor for my subclass. Then, in web.xml where you declare the
ServerServlet, tell it to load your custom component instead.
<init-param>
<param-name>org.restlet.component</param-name>
<param-value>com.yourdomain.YourComponentSubclass</param-value>
</init-param>
I don't have any great advice as to how to do it in 1.0. ServerServlet does
have a getComponent() method, so if your container offers a way to access
the ServerServlet instance, you could access the existing component there.
- Rob
On Sun, May 18, 2008 at 8:57 AM, Jean-Yves Cronier <[EMAIL PROTECTED]>
wrote:
> It works now ! :) but only in "Standalone-mode" :(
>
> I've added in the main class (to launch RESTlet application in
> "Standalone-mode")
>
> component.getClients().add(Protocol.CLAP);
>
>
>
> In attached ZIP file, a "test-case" Eclipse project :
>
> -> JAR of application : src/main/webapp/WEB-INF/lib/clapTestCase-app.jar
> - The RESTlet application main class :
> com/test/clapTestCase/app/RestletApplication.class
> (source) :
> com/test/clapTestCase/app/RestletApplication.java
> - The static resource to serve :
> com/test/clapTestCase/app/resources/test.txt
>
> -> Main class to launch RESTlet application in "standalone-mode" :
> - src/main/java/Main.java
>
> -> web.xml for "servlet-mode"
> - src/main/webapp/WEB-INF/web.xml
>
>
>
> What can I do to make it work with "servlet mode" ?
>
> How to add a CLAP client in "servlet mode"?
>
>
>
>
> Rob Heittman a écrit :
>
>> That's the right idea. What is the symptom of it not working? 404 not
>> found? Does the log show any evidence of Directory being invoked at all?
>> Another issue I've run into sometimes is that the resources aren't
>> available from the thread's classloader. You may need clap://system or
>> change how your classes are being loaded.
>>
>> On Fri, May 16, 2008 at 2:41 AM, Jean-Yves Cronier <[EMAIL PROTECTED]<mailto:
>> [EMAIL PROTECTED]>> wrote:
>>
>> router.attach(
>> "/xsl",
>> new Directory("clap://thread/com/vsct/resources/xsl/")
>> );
>>
>>
>>