2016-06-22 4 views
7

है Restlet संसाधनों के लिए किए गए प्रत्येक अनुरोध पर, मैं गूगल एप इंजन लॉग में निम्न लॉगRestlet GAE पर क्यों कहते हैं करता घटक शून्य

21:38:50.059 javax.servlet.ServletContext log: ExampleAPIs: [Restlet] ServerServlet: component class is null 
21:38:51.568 javax.servlet.ServletContext log: ExampleAPIs: [Restlet] Attaching application: [email protected] to URI: /example/v1 

क्यों कहता है देखें घटक रिक्त है? मैं मानता हूं कि मैंने घटक को परिभाषित नहीं किया बल्कि सर्वर संसाधनों का उपयोग किया और उन्हें एप्लिकेशन क्लास में राउटर में मैप किया। लेकिन यह है कि इसे रीसेट गैए संस्करण संस्करण दस्तावेज के अनुसार कैसे किया जाना चाहिए। जो संभालती है और एक JSON प्रतिनिधित्व

public class XYZ extends ServerResource { 

    private static final Logger logger = Logger.getLogger("API:Xyz"); 

    @Get(":json") 
    public Representation handleGetRequest() { 
     .. 
     return new JsonRepresentation("{\"code\": 4008, \"description\": \"Something blah something\"}"); 
    } 
} 

रिटर्न तारों मार्गों के लिए

आवेदन वर्ग

public Example extends Application { 
    @Override 
    public Restlet createInboundRoot() { 
     router = new Router(getContext()); 
     CorsService corsService = new CorsService();   
     corsService.setAllowedOrigins(new HashSet<String>(Arrays.asList("http://example.com"))); 
     corsService.setAllowedCredentials(true); 
     getServices().add(corsService); 

     router.attach("/xyz", XYZ.class); 
    } 
} 

सर्वर संसाधन वहाँ कुछ मैं गलत कर रहा हूँ है?

उत्तर

0

क्या आपने अपनी सर्वलेट कॉन्फ़िगरेशन फ़ाइल को दस्तावेज़ में समझाया गया है (नीचे लिंक)। मुझे लगता है कि सर्वलेट एक वर्ग से बंधे नहीं है।

https://restlet.com/technical-resources/restlet-framework/guide/2.3/editions/gae

अद्यतन

ठीक है, इसलिए यदि आप दस्तावेज में गहरी: https://restlet.com/technical-resources/restlet-framework/javadocs/2.0/jee/ext/org/restlet/ext/servlet/ServerServlet.html
https://restlet.com/technical-resources/restlet-framework/javadocs/2.0/jee/api/org/restlet/Component.html आप देख सकते हैं कि घटक वैकल्पिक है, लेकिन उपयोगी हो सकता है, लेकिन शायद GAE कार्यान्वयन में यह नहीं है डिफ़ॉल्ट रूप से एक।

+0

हाँ मैंने किया। मैंने पुस्तक के बाद इसका पालन किया। मजेदार हिस्सा यह है कि मैं इसे बिना किसी समस्या के चला रहा हूं, लेकिन ये लॉग मुझे बाहर निकाल देते हैं – Atrix1987

संबंधित मुद्दे