restlet-2.0

Restlet in OSGI can not find com/sun/net/httpserver/HttpHandler

心不动则不痛 提交于 2020-01-05 02:12:07
问题 I am trying to use Restlet in embedded OSGi environment. I have added the org.restlet.jar version 2.3.0 in the class path of my restlet test bundled. But it kept giving me the following error. java.lang.NoClassDefFoundError: com/sun/net/httpserver/HttpHandler The documentation says that this jar should be enough but it is currently not working. The bundle is started by an Equinox Framework which is started by a standalone launcher, later to be used outside of Eclipse environment. Is there

How to register Jackson Jdk8 module in Restlet

不羁岁月 提交于 2020-01-02 18:07:07
问题 Is it possible to register the jackson-datatype-jdk8 module in the Restlet org.restlet.ext.jackson extension package? I need to take advantage of the new Optional feature. My guess is that it should be accessible through the converter services ( getConverterService() ) but I can't find anything in the documentation that suggests exactly how setting a module is possible. 回答1: I eventually pieced together from a variety of sources an answer that works with Restlet 2.3. My guess is that this

Restlet Rest server on android

三世轮回 提交于 2019-12-23 05:48:25
问题 I want to host a simple rest server on an android phone to get remote access to some data. I followed the descriptions on the restlet website but I cant even get a simple example running. I downloaded the android restlet package and added the org.restlet.jar as dependency. In my onCreate method of the activity I have added these lines to start a simple server component. Component serverComponent = new Component(); serverComponent.getServers().add(Protocol.HTTP, 80); final Router router = new

Restlet server on Android: client is getting a null object

为君一笑 提交于 2019-12-13 01:28:37
问题 I implemented a simple Android Restlet server demo that can provide the sensor values to a Restlet client. However, when the restlet client receives the object, it is null. I suppose there is not much missing because the transaction shows that it was done correctly in the server logcat: D/SensorTemperature: GET temperature: 20.0 W/System.err: 2015-10-23 20:28:37 192.168.2.129 - - 8080 GET /sensors/temperature - 200 - 0 198 http://192.168.2.94:8080 Restlet-Framework/2.3.5 - And on the client

org.restlet: Posting JSON content against webservice returns HTTP error 411 (length required)

≡放荡痞女 提交于 2019-12-13 00:54:43
问题 Simplified code example: http://pastebin.com/9ZQxSXi9 Hi I wanted to experiment with the restlet 2.0 library and the gpodder webservice but somehow i reached a point where I can't see the wood for the trees. The service in the example requires HTTP authentication and to post some JSON content to a URL. Nothing that complicated but somehow even though the debug view claims the request object to contain the necessary content the RESTful webservice's response leads me to believe the HTTP header

Why is Restlet unable to Register the JSON Converter?

我的梦境 提交于 2019-12-12 16:20:03
问题 I'm at my wit's end here - never seemed to have faced this problem. I find it relatively easy to set up quick HelloWorld applications to ensure Restlet 2.0 is up and running. However, I'm facing a strange exception which I've never encountered before. I have the jars in my classpath as well as the WEB-INF/lib folder but for some reason I keep getting the following exception: INFO: Unable to register the helper org.restlet.ext.json.JsonConverter java.lang.NoClassDefFoundError: org/json

Is Restlet returning 415 Unsupported Media Type when it should return 400 Bad Request?

流过昼夜 提交于 2019-12-12 07:18:03
问题 I'm using Restlet 2.1 with jackson to build a json REST api. When I make a request with the expected content type but a malformed body, I get back a 415 "Unsuppored Media Type" status code. I think the correct error code should be 400 "Bad Request". Apparently the mixup happens when Jackson tries and fails to decode the garbage. I'll try to make the case more clear with some code: // java method mapping @Post("json") public Project create(Project project) { The service invocation with curl $

apache restlet connector overload

↘锁芯ラ 提交于 2019-12-12 06:27:50
问题 I use restlet in camel route in from("restlet:http/myLink") clause. When user's requests more then ten per second, I begin recieve errors processing request like a "org.restlet.engine.connector.Controller run INFO: Connector overload detected. Stop accepting new work" I think, that error is caused by number of threads,request query's size or number,or something like that. I try set to maxThreads param different values in spring config <bean id="restlet" class="org.apache.camel.component

Setting a custom Content-Range Header using Restlet

最后都变了- 提交于 2019-12-12 06:25:07
问题 I'm using restlet 2.0.11 to provide data for a Dojo-based web application via a REST-Web-Interface. According to the documentation of dojo, pagination is realized using the "content-range" header of HTTP, thus dojo expects a header like: Content-Range: items 0-19/100 (Source: http://dojotoolkit.org/reference-guide/1.7/dojox/data/JsonRestStore.html) Which means that the REST-Api provides the first 20 of 100 total items. Setting the Content-Range header manually like this getResponse()

when geting objects from a Json with restlet how can I get different objects in case the Json chnges its structure

一笑奈何 提交于 2019-12-12 01:32:24
问题 I have a Json with some hierarchy, that at some point can change in its structure. The key OnOff can either have an object or an array, it can have an array like this: "OnOff": [ { "state": { "last_update": 1401855332, "value": "off" } } ] Or it can only have an object, like this: "OnOff": { "state": { "last_update": 1401855332, "value": "off" } } The idea is to read the json and turn it into an object with Restlet for android. I'am using objects and interfaces, the class in the array case is