restlet

“Not Found (404)” error in restlet

◇◆丶佛笑我妖孽 提交于 2019-12-11 23:27:18
问题 i am new to restlet framework. i have created a small java ee application but it give me an error "Not Found (404)" public class MailServerApplication extends Application { @Override public Restlet createInboundRoot() { Router router = new Router(getContext()); router.attach("http://localhost:8084/accounts/{accountId}/mails/{mailId}", MailServerResource.class); return router; } } //////////////////////////////// public class MailServerResource extends ServerResource { @Override protected

Getting client certificate in restlet

喜夏-厌秋 提交于 2019-12-11 20:25:43
问题 I managed to implement an https restlet with bot client and server certificated. I can prove it works since if I call the server with an untrusted certification communication fails. Unfortunately I can't find the certificate of the client on the server. I'm using this code: List<Certificate> certs = request.getClientInfo().getCertificates(); but list is empty. What I'm doing wrong? EDIT : version is Restlet-Framework/2.3m2 回答1: The problem is related to the use of the default server

Restlet API example

折月煮酒 提交于 2019-12-11 15:12:29
问题 Is there any simple example of Restlet API with Java? I want a simple example of Restlet API by calling Get / POST method. One client should call one method from the server through Restlet. The server should execute that method and send the reply accordingly. How can the server open those methods to respond to the client using Restlet? 回答1: You may want to consider looking at http://www.restlet.org/documentation/ the documentation provided by the project provides good examples to get started

How can I get Restlet via Maven when I am behind a proxy?

自闭症网瘾萝莉.ら 提交于 2019-12-11 12:49:23
问题 I tried their official sample pom at here and got the following error: [ERROR] Failed to execute goal on project myproject: Could not resolve dependencies for project com.example:myproject:jar:1.0-SNAPSHOT: Failed to collect dependencies at org.restlet.jse:org.restlet:ja r:2.3.4: Failed to read artifact descriptor for org.restlet.jse:org.restlet:jar:2.3.4: Could not transfer artifact org.restlet.jse:org.restlet:pom:2.3.4 from/to maven-restlet (http://maven.restlet.com ): Not authorized ,

[restlet ]TruncatedChunkException:

佐手、 提交于 2019-12-11 11:56:52
问题 For my project (http://snooze.inria.fr/) i have dependencies on java library restlet. If I set up the dependency to restlet 2.2-SNAPSHOT a TruncatedChunkException when visualizing the hierarchy on the client (it's a big json received form the system) If I set up the dependency to restlet 2.1-SNAPSHOT i have no error, everything looks fine. Do you know why ? Best Regards, Matt ps : here the stack trace : org.restlet - Unable to convert a [application/json] representation into an object of

JsonMappingException: How to transfert a Objectify Entity (with Key) through Restlet

橙三吉。 提交于 2019-12-11 11:37:31
问题 I am developping an Android Application, comunicating with a GAE server + Objectify DB. I choose Restlet for rest framework. I have a problem when I try to retrieve an Entity with a Key attribute. The server throws an error: org.codehaus.jackson.map.JsonMappingException: Direct self-reference leading to cycle (through reference chain: java.util.ArrayList[0]->com.my.model.MyMessage["senderKey"]->com.googlecode.objectify.Key["root"]) Here is my model (very simple): public class MyMessage

Setting ETAG/LastModified on Representation sent by ServerResource

寵の児 提交于 2019-12-11 10:45:52
问题 I know I can set the ETAG and LastModified properties on Representation/Repre​sentationInfo. But I have a simple resource implemented like this : public class AccountServerResource extends ServerResource implements AccountResource { private static Logger log = Logger.getLogger(Acc​ountServerResource.c​lass.getName()); @Override public Account retrieve() { User user = getClientInfo().getUser(); AccountDAO dao = new AccountDAO(); Account ret = dao.getAccountByEmai​l(user.getEm​ail()); log.info(

Restlet streaming with Thread.sleep()

天大地大妈咪最大 提交于 2019-12-11 07:38:28
问题 This example is based on an example from the book Restlet in Action . If I try public class StreamResource extends ServerResource { @Get public Representation getStream() throws ResourceException, IOException { Representation representation = new WriterRepresentation(MediaType.TEXT_PLAIN) { @Override public void write(Writer writer) throws IOException { String json = "{\"foo\" : \"bar\"}"; while (true) { writer.write(json); } } }; return representation; } } it works and it continuously sends

Multiple get methods in single Resource class with Restlet

末鹿安然 提交于 2019-12-11 06:30:07
问题 here is my code : this is my application class >>> import org.restlet.Application; import org.restlet.Restlet; import org.restlet.routing.Router; import firstSteps.UserResource; public class FirstStepsApplication extends Application { @Override public synchronized Restlet createRoot() { Router router = new Router(getContext()); router.attach("/hello", UserResource.class); router.attach("/isuserloggedin",UserResource.class); return router; } } this is resource class >>> import org.restlet

Jackson: Serializing/Deserializing String to Array with single entry

大憨熊 提交于 2019-12-11 05:39:46
问题 I am currently writing a Java client that consumes a RESTful service, using the Restlet package and its Jackson extension. I want to query the service for a user and deserialize the response to a User POJO that looks as follows: @JsonIgnoreProperties(ignoreUnknown=true) public class User { private Integer uid; private String name; private String mail; private String field_nickname; // omitted for brevity: getters/setters, toString } A sample response from the service looks as follows: { "uid"