0

Hi I'm trying to deploy my restlet classes to a servlet contatiner to a tomcat apache server. However when i deploy it, it cannot start, which is to say a severe error occurred. Can anyone help me?

PS. Why is there so little restlet documentation? Whats there is either too little or too complex...

   package com.restletTest;

   import org.restlet.Application;
   import org.restlet.Restlet;
   import org.restlet.routing.Router;

   public class FirstStepsApplication extends Application {
/*
 * Creates a root Restlet that will handle all incoming calls
 */

@Override
public synchronized Restlet createInboundRoot(){
    //Creates a router Restlet that routes each call to a new instance of helloWorldResponse
    Router router = new Router(getContext());

    //Defines only one route
    router.attach("/hello", HelloWorldResource.class);
    router.attach("/goodbye", GoodbyeWorldResource.class);
    router.attach("/jsonResource" , JSONResource.class);



    return router;

}
   }

My web.xml:

<?xml version="1.0" encoding="UTF-8"?>  
<web-app id="WebApp_ID" version="2.4"  
            xmlns="http://java.sun.com/xml/ns/j2ee"  
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
            xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee  
                 http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">  
   <display-name>TestServer</display-name>  
   <!-- Application class name -->  
   <context-param>  
      <param-name>org.restlet.application</param-name>  
      <param-value>  
         com.restletTest.FirstStepsApplication
      </param-value>  
   </context-param>  

   <!-- Restlet adapter -->  
   <servlet>  
      <servlet-name>RestletServlet</servlet-name>  
      <servlet-class>  
         org.restlet.ext.servlet.ServerServlet
      </servlet-class>  
   </servlet>  

   <!-- Catch all requests -->  
   <servlet-mapping>  
      <servlet-name>RestletServlet</servlet-name>  
      <url-pattern>/*</url-pattern>  
   </servlet-mapping>  
</web-app>  

Any chance for help?

Jonathan
  • 1
  • 1
  • 1

1 Answers1

0

Not sure if this will get you over the bump, because I am trying this little library out for myself.

First thing: you must have defined the 3 resource classes.

Second: in the web.xml, the context-param data should be inside the servlet data.

Hope this helps.

bruceberk
  • 29
  • 1