Re: Using Restlet with Maven
I'm also interesting about this question... I can browse in chrome the whole tree but in eclipse I can only see version 2.0.11 and some 2.1rc3... Regards Guillaume -- View this message in context: http://restlet-discuss.1400322.n2.nabble.com/Using-Restlet-with-Maven-tp7418239p7578055.html Sent from the Restlet Discuss mailing list archive at Nabble.com. -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2969417
How to get init-parameter in JAX-RS resource
I try to get init-parameter into my JAX-RS resource with the @Context HttpServletRequest (ref http://restlet-discuss.1400322.n2.nabble.com/JAX-RS-Context-for-HttpServletRequest-tp2227122.html http://restlet-discuss.1400322.n2.nabble.com/JAX-RS-Context-for-HttpServletRequest-tp2227122.html ) but got this exception Caused by: org.restlet.ext.jaxrs.internal.todo.NotYetImplementedException: The returnin of Servlet depending Context is not implemented for now. Is there another way to get init-parameter from JAX-RS Regards Guillaume -- View this message in context: http://restlet-discuss.1400322.n2.nabble.com/How-to-get-init-parameter-in-JAX-RS-resource-tp7578033.html Sent from the Restlet Discuss mailing list archive at Nabble.com. -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2967180
Re: jaxrs processing response
I try to do the same thing Client side ClientResource consumer = new ClientResource(// uri //); Campus camp = new Campus(Montréal); try { consumer.post(camp, MediaType.APPLICATION_JSON).write(System.out); // should echo {key:ahJzfm5vdGV0b25zdGExMzQ1MDhyDQsSBkNhbXB1cxjpBww,name:Montréal} } catch (ResourceException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } Server side @POST @Path(campus) @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) public Campus create(Campus campus){ // but introspecting the campus object and get nothing // store in database and retrieve the new created campus object // {key:ahJzfm5vdGV0b25zdGExMzQ1MDhyDQsSBkNhbXB1cxjpBww,name:Montréal} return campus; } My Campus Object @Entity public class Campus implements Serializable { private static final long serialVersionUID = 1L; private static final Logger log = Logger.getLogger(Campus.class.getSimpleName()); @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @JsonIgnore private Key key; @Basic private String name; @Basic @JsonIgnore private List interventionIds; public Campus(){} public Campus(Key key, String name) { this.key = key; this.name = name; } public Key getKey() { return key; } public void setKey(Key key) { this.key = key; } public String getName() { return name; } public void setName(String name) { this.name = name; } public List getInterventionIds() { return interventionIds; } public void setInterventionsKey(List interventionIds) { this.interventionIds = interventionIds; } public void addInterventionId(Long id){ if(!this.interventionIds.contains(id)) { this.interventionIds.add(id); } } public void removeInterventionId(Long id) throws KeyNotFoundException { if(!this.interventionIds.contains(id)){ throw new KeyNotFoundException(); } this.interventionIds.remove(id); } @JsonProperty public String key(){ log.log(Level.INFO, Key conversion (before), this.key); String convert_key = KeyFactory.keyToString(this.key); log.log(Level.INFO, Key conversion (after), convert_key); return convert_key; } @JsonProperty public void key(String k){ this.setKey(KeyFactory.stringToKey(k)); } @Override public boolean equals(Object arg0) { // TODO Auto-generated method stub return EqualsBuilder.reflectionEquals(this, arg0); } @Override public int hashCode() { // TODO Auto-generated method stub return HashCodeBuilder.reflectionHashCode(this); } @Override public String toString() { return ToStringBuilder.reflectionToString(this); } } @Produces works fine and I get the good representation but @Consumes not consumes the JSON to Java Object If someone can help us. -- View this message in context: http://restlet-discuss.1400322.n2.nabble.com/jaxrs-processing-response-tp7084522p7313223.html Sent from the Restlet Discuss mailing list archive at Nabble.com. -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2926001
Re: Restlet ClientResource Post Chunked Encoding - WCF Unsuported
Did you try setRequestEntityBuffering(true) like this: ClientResource cr = new ClientResource(// uri //); cr.setRequestEntityBuffering(true); It work for me. -- View this message in context: http://restlet-discuss.1400322.n2.nabble.com/Restlet-ClientResource-Post-Chunked-Encoding-WCF-Unsuported-tp455p7313256.html Sent from the Restlet Discuss mailing list archive at Nabble.com. -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2926003
Re: jaxrs processing response
Each time I post a message, five minute after I find the solution: just setRequestEntityBuffering to true. -- View this message in context: http://restlet-discuss.1400322.n2.nabble.com/jaxrs-processing-response-tp7084522p7313263.html Sent from the Restlet Discuss mailing list archive at Nabble.com. -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2926005
Need JAX-RS + JSON Good example
I try to retrieve a list of Object (ArrayList for instance) to a JSON representation For instance a sample User class: public class User { private String lastname; private String firstname; public User(){}; public User(String lname,String fname){ this.firstname = fname; this.lastname = lname; } public String getLastname() { return lastname; } public void setLastname(String lastname) { this.lastname = lastname; } public String getFirstname() { return firstname; } public void setFirstname(String firstname) { this.firstname = firstname; } } I want to retrieve a list of User like this @GET @Path(users) @Produces(MediaType.APPLICATION_JSON) public ArrayListlt;Usergt; getUsers() { ArrayListlt;Usergt; users = new ArrayListlt;Usergt;(); users.add(new User(userlastname1, userfirstname1)); users.add(new User(userlastname3, userfirstname2)); return users; } and I want to get this JSON representation [ { lastname: userlastname1, firstname: userfirstname1 }, { lastname: userlastname2, firstname: userfirstname2 } ] What is the best way to achieve this? The Restlet documentation mentioned the serialization proccess is automated, yes it#8217;s the case for only one Object like #8220;User#8221; new User(userlastname1, userfirstname1) return me the good JSON representation { lastname: userlastname1, firstname: userfirstname1 } If some one can give me some explanation about that. much appreciated Best regards -- View this message in context: http://restlet-discuss.1400322.n2.nabble.com/Need-JAX-RS-JSON-Good-example-tp7290704p7290704.html Sent from the Restlet Discuss mailing list archive at Nabble.com. -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2923428
RE: Restlet XStream/Jackson different JSON wrapper
What is the package name for the Element class? -- View this message in context: http://restlet-discuss.1400322.n2.nabble.com/Restlet-XStream-Jackson-different-JSON-wrapper-tp7197038p7290802.html Sent from the Restlet Discuss mailing list archive at Nabble.com. -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2923440
RE: V2. RC.3 : java.lang.NoSuchMethodError when POSTing xml
I've the same issue my war lib directory look like this appengine-api-1.0-sdk-1.6.2.jar appengine-api-labs-1.6.2.jar appengine-jsr107cache-1.6.2.jar c2dm-server.jar c2dm-server-src.jar datanucleus-appengine-1.0.10.final.jar datanucleus-core-1.1.5.jar datanucleus-jpa-1.1.5.jar geronimo-jpa_3.0_spec-1.1.1.jar geronimo-jta_1.1_spec-1.1.1.jar google_sql.jar gwt-servlet.jar javax.servlet.jar javax.xml.bind.jar javax.xml.stream.jar jdo2-api-2.3-eb.jar json-1.5.jar jsr107cache-1.1.jar org.codehaus.jackson.core.jar org.codehaus.jackson.mapper.jar org.json.jar org.restlet.ext.jackson.jar org.restlet.ext.json.jar org.restlet.ext.servlet.jar org.restlet.jar validation-api-1.0.0.GA.jar validation-api-1.0.0.GA-sources.jar An the exception Exception in thread main java.lang.NoClassDefFoundError: com/google/gwt/user/client/rpc/IsSerializable at org.restlet.ext.gwt.GwtConverter.getVariants(GwtConverter.java:75) at org.restlet.engine.converter.ConverterUtils.getVariants(ConverterUtils.java:93) at org.restlet.service.ConverterService.getVariants(ConverterService.java:116) at org.restlet.engine.resource.AnnotationInfo.getResponseVariants(AnnotationInfo.java:438) at org.restlet.engine.resource.ClientInvocationHandler.invoke(ClientInvocationHandler.java:217) at $Proxy5.getUsers(Unknown Source) at com.youfood.client.Client.main(Client.java:23) or Exception in thread main java.lang.NoClassDefFoundError: com/sun/syndication/feed/synd/SyndFeed at org.restlet.ext.rome.RomeConverter.getVariants(RomeConverter.java:76) at org.restlet.engine.converter.ConverterUtils.getVariants(ConverterUtils.java:93) at org.restlet.service.ConverterService.getVariants(ConverterService.java:116) at org.restlet.engine.resource.AnnotationInfo.getResponseVariants(AnnotationInfo.java:438) at org.restlet.engine.resource.ClientInvocationHandler.invoke(ClientInvocationHandler.java:217) at $Proxy7.retrieve(Unknown Source) at com.restletexample.Test.main(Test.java:18) Thierry Boileau wrote Hello, could you describe what are your needs? That is to says, the kind of Restlet extensions you need. Then, in each distribution, you can have a look at the /lib/readme.txt file. it lists extensions and their dependencies. Best regards, Thierry Boileau -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2702700 -- View this message in context: http://restlet-discuss.1400322.n2.nabble.com/V2-RC-3-java-lang-NoSuchMethodError-when-POSTing-xml-tp5114202p7292103.html Sent from the Restlet Discuss mailing list archive at Nabble.com. -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2923513
Re: Restlet + GAE + JAX-RS
I try the code provide in the http://wiki.restlet.org/docs_2.0/13-restlet/28-restlet/57-restlet.html?showComments=true#daisycomment151 wiki but it don't work for me, Google App engine say me Error: Not Found !. I tried with version (GAE Edition) 2.0.11 and 2.1rc2. My web.xml look like: ?xml version=1.0 encoding=utf-8? org.restlet.ext.jaxrs.JaxRsApplication com.restletexample.JaxRsEntryPoint RestletServlet org.restlet.ext.servlet.ServerServlet RestletServlet /* index.html and in my lib folder I've import those libraries javax.ws.rs.jar javax.xml.bind.jar javax.xml.stream.jar org.json.jar org.restlet.ext.jaxrs.jar org.restlet.ext.servlet.jar org.restlet.jar My code is available http://dl.dropbox.com/u/5552535/RestletExample.zip here If someone can help me to do it work -- View this message in context: http://restlet-discuss.1400322.n2.nabble.com/Restlet-GAE-JAX-RS-tp3890645p7288376.html Sent from the Restlet Discuss mailing list archive at Nabble.com. -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2922994
Re: Restlet + GAE + JAX-RS
Same error I added codepre lt;init-paramgt; lt;param-namegt;org.reslet.applicationlt;/param-namegt; lt;param-valuegt;com.restletexample.JaxRsEntryPointlt;/param-valuegt; lt;/init-paramgt; /pre/code I think the the parameter org.reslet.application expect a class of that type but my class JaxRsEntryPoint is of type JaxRsApplication I spend couple of day read the restlet documentation, made all the sample code they provide but anything works specially on Google AppEngine. I commit the code on https://github.com/guillaumemaka/RestletExample GitHub Thank for your help -- View this message in context: http://restlet-discuss.1400322.n2.nabble.com/Restlet-GAE-JAX-RS-tp3890645p7288539.html Sent from the Restlet Discuss mailing list archive at Nabble.com. -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2923004
Re: Restlet + GAE + JAX-RS
Finally its ok I misspell the parameter-name (the evil copy/paste) but thank you for focusing me on these line. Thank you very much -- View this message in context: http://restlet-discuss.1400322.n2.nabble.com/Restlet-GAE-JAX-RS-tp3890645p7288677.html Sent from the Restlet Discuss mailing list archive at Nabble.com. -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2923023
RE: ClientResource Examples?
I've some question about the sample code: 1. How to retrieve the list of customers/users ? 2. What type must I use (ArrayList, Set, List, act...) ? Because I try to retrieve a list but I got an exception java.lang.NoClassDefFoundError: com/sun/syndication/feed/synd/SyndFeed My code Server side public interface RootControllerResource { @Get ArrayList findAll(); } public class RootController extends ServerResource implements RootControllerResource { private ArrayList users; public RootController() { super(); // Generate some sample data this.users = new ArrayList(); users.add(new User(1, user1, user_f, user_l, 26)); users.add(new User(2, user2, user_f, user_l, 24)); } @Override public ArrayList findAll() { return users; } } JEE Client public class Client { /** * @param args */ public static void main(String[] args) { ClientResource cr = new ClientResource(// uri //); RootControllerResource rcr = cr.wrap(RootControllerResource.class); ArrayList users = rcr.findAll(); for (User u : users){ System.out.println(u.userid); System.out.println(u.username); System.out.println(u.firstname); System.out.println(u.lastname); System.out.println(u.age); } try { // Try to get the json representation cr.get(MediaType.APPLICATION_JSON).write(System.out); } catch (ResourceException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } Say me if it's a good way. Best regards -- View this message in context: http://restlet-discuss.1400322.n2.nabble.com/ClientResource-Examples-tp3506100p7288837.html Sent from the Restlet Discuss mailing list archive at Nabble.com. -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2923029