2011-05-25 91 views
0

嗨我試圖將我的restlet類部署到servlet contatiner到tomcat apache服務器。但是,當我部署它時,它無法啓動,也就是說發生了嚴重錯誤。誰能幫我?部署到Tomcat的Restlet類

PS。爲什麼只有很少的restlet文檔?請告訴我有要麼太少或太複雜......

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; 

} 
    } 

我的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> 

任何機會尋求幫助?

+0

請提供給我們您給出的確切錯誤 – Grooveek 2011-05-25 09:14:40

回答

0

不知道這是否會讓你過度凹凸,因爲我正在爲自己試試這個小圖書館。

首先,您必須定義了3個資源類。

第二:在web.xml中,context-param數據應該在servlet數據中。

希望這會有所幫助。