RE: resource scheme
Hi there, As it seems more like a general REST question, I suggest that you have a look at some REST specific information: http://www.restlet.org/about/faq#04 Best regards, Jerome Louvel -- Restlet ~ Founder and Lead developer ~ http://www.restlet.org Noelios Technologies ~ Co-founder ~ http://www.noelios.com -Message d'origine- De : webp...@tigris.org [mailto:webp...@tigris.org] Envoyé : vendredi 10 avril 2009 10:01 À : discuss@restlet.tigris.org Objet : resource scheme Hi, i need suggestion. I have to implement a multi-side RESTlet architecture to exchange message/resource between pharmacies and suppliers, and between suppliers and agents. It implicates thet in the suppliers side, there are resources POSTed or PUTted by booth pharmacies and agents and some resources destined to different pharmacies (fiscal invoices and similar) and other destined to different agents (order sheet and similar). It implicates thet each side cannot know the resources map and their structure in the other side (and cannot know the specific URI's). I think it's necessary to provide, before different clients GET, POST or PUT resources, an XML resource thet maps the structure of resources and over this map the client can generate the right URI's for the HTTP packets (WADL like). I'm aware this approach gets further from restlet architecture, but i don't succeed in imagining other solutions. It's all right or i'm crazy? If it's all right can you recommend me a particular structure for resources that is easier to manipulate? I can create a directory for each client and in each directory a tree of other directory for different resources using the name of directories as identifier... or there are other easier way to implement an manipulate better resource structure and map? Thanks in advance!! Illuminate me!! -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=16265 22 -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=1741488
post in putUser Bookmark throws error
Hi, I changed the Bookmark example C:\restlet-1.1.4\src\org.restlet.example\org\restlet\example\book\rest\ch7\ApplicationTest.java from Put to Post in putUser method as shown below: public static void putUser(String userName, String password, String fullName, String email) { final Form form = new Form(); form.add(user[password], password); form.add(user[full_name], fullName); form.add(user[email], email); final Response resp = new Client(Protocol.HTTP).post( getUserUri(userName), form.getWebRepresentation()); System.out.println(resp.getStatus()); } But now when I'm trying to add user, it throws error Internal Server Error (500) - The server encountered an unexpected condition which prevented it from fulfilling the request I'm using stable restlet 1.1.7. Can you please tell me if its a bug or what I'm doing wrong??? Thanks! -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=1733294
Re: Re: Google AppEngine and Restlet
Jérôme, As far as I understand, we can't reuse Restlet extensions made for org.restlet.* with org.restlet.gae.* classes, can we ? I have thought at a time that GAE would be a deployment option for our restlet applications. With the gae copy, we may not reuse an application as straitforward as I may have dreamed. I see Restlet extensible enough not to have to copy the full code base. Would that dream have been possible with 1.1 with the API and Engine separation ? Why should not we support this scenario ;) ? Thanks, Rémi On Wed, Apr 15, 2009 at 22:29, Jerome Louvel jerome.lou...@noelios.comwrote: Hi Richy, Thanks for sharing your experience! When I did the adaptation of Restlet to GAE (resulting in the new org.restlet.gae.jar available in recent snapshots), I took the source code and had to remove many classes that didn't compile due to the lack of sockets and SSL support (mainly the internal connectors). I'm surprised that the org.restlet.jar works despite this and I'm not sure if we should support this usage scenario. In addition, org.restlet.gae.jar includes the ServerServlet, the JavaMail and the JDK's Net connectors. In the future, it will leverage other GAE APIs. Regarding FreeMarker, the ContextTemplateLoader I just added to SVN trunk will probably help simplifying its usage in GAE with Restlet. Let me know if you have a chance to test it. Best regards, Jerome Louvel -- Restlet ~ Founder and Lead developer ~ http://www.restlet.org Noelios Technologies ~ Co-founder ~ http://www.noelios.com -Message d'origine- De : webp...@tigris.org [mailto:webp...@tigris.org] Envoyé : samedi 11 avril 2009 14:49 À : discuss@restlet.tigris.org Objet : RE: Re: Google AppEngine and Restlet After a bit of experimentation I have managed to get a Restlet/Freemarker stack running on GAE. The basic steps I took were : 1. Modify ServletConverter and ServletContextAdapter as detailed below. Basically this means replacing the calls to new ServletLogger with Logger.getLogger e.g. in the ServletConverter constructor do something like... super(new Context(Logger.getLogger(ServletConverter.class.getName(; 2. Add org.freemarker.jar, org.restlet.jar, org.restlet.ext.servlet.jar and org.restlet.ext.freemarker.jar to the WEB-INF/lib of your google app project and add to the build path. 3. Follow usual setup for getting Restlet working in a Servlet environment. Folow the HelloWorld tutorial in the getting started docs - it should work fine locally (even without doing step 1. However, you'll need to replace these calls in order to get it to run in the real GAE) 4. Freemarker was a little more tricky, but not much. Create a freemarker configuration that uses the class template loader and put this in the Restlet Application context attributes. 5. Make sure your templates are somewhere on the class path. 6. Use the TemplateRepresentation along with your freemarker config from the context attributes 7. Make sure it works locally and upload to the app engine. Hopefully I'll get a chance to write this up properly over easter, but it wasn't too bad and looks promising so far. Cheers, Richy http://wiredupandfiredup.com -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=16485 97 -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=1732294 -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=1732825
RE: Re: Re: userpass
Hi Rob, thank you for the answer! ok, I can happy use the cookies, but is this use versus the rest-philosophy? is there another solution to bring client-side the access credentials? server-side security isn't now a problem, and then also HTTP_BASIC is good for me. Thanx again. -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=1731082
RE: Managing a JPA/Hibernate session
Hi Could anyone give me some advice how I could implement such a Filter or ConnectorService for hibernate? The main problem is: How can I get the EntityManager that I created in the Filter at some other point? Now I'm using auto-generated JPA Controller classes form NetBeans but this leads to lots of problems when accessing data when the EntityManager has already been closed. Thanks for any Help Matt -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=1730594
RE: ServerResource is currently incompatible with OSGi
Hi Tal and Tim, Thanks for the discussion. I have added a clearCache() method which is invoked each time an application is stopped (there is no Application#release() method). The minor issue with an application specific cache is that resource classes could be shared by several applications. I have also entered a RFE to keep track of the need for a more optimal solution in the future: Improve cleaning of annotation descriptors http://restlet.tigris.org/issues/show_bug.cgi?id=784 Best regards, Jerome Louvel -- Restlet ~ Founder and Lead developer ~ http://www.restlet.org/ http://www.restlet.org Noelios Technologies ~ Co-founder ~ http://www.noelios.com/ http://www.noelios.com _ De : Tal Liron [mailto:tal.li...@threecrickets.com] Envoyé : dimanche 12 avril 2009 17:39 À : discuss@restlet.tigris.org Objet : Re: ServerResource is currently incompatible with OSGi Tim... you seem to be agreeing with me, then, that this does have something to do with the Application, and you are also allowing for some redundancy in calculation and memory use, so, again, why not just store it in the Application's Context, where all this is taken care of automatically? I think Jerome's first instinct here may have been the most straightforward. Barring that, how about calling the clearCache in the Application's release(), rather than stop()? -Tal Tim Peierls wrote: I wouldn't recommend RRWL for this. Since it's harmless to recompute the AnnotationInfos, I think just having an AnnotationUtils.clearCache method would work well. Call it whenever an Application stops, say. It's worth a little redundant computation to avoid having to deal with shared locks and liveness. --tim On Thu, Apr 9, 2009 at 2:22 PM, Tal Liron tal.li...@threecrickets.com wrote: Oh, I didn't mean synchronizing the whole map. I actually didn't mean much beyond suggesting that we brainstorm a way to use WeakReferences as keys in this particular case. I still don't have a complete solution in mind. Another idea: Perhaps we can use a ReentrantReadWrite lock around a simple WeakHashMap? Since this is a 99% read situation, most requests won't need to acquire locks. (ConcurrentHashMap is actually a very complicated and delicately tuned class, and it would be anything but trivial for us to try to re-implement it using WeakReferences.) I know there are generic 3rd party solutions to this, but I know we'd all prefer to use what Java 5 offers us right now. I'm sure we can cobble together something that performs well! -Tal Tim Peierls wrote: Did you read my subsequent e-mail that talked about opening an issue to make this more robust? There is currently no standard concurrent map with weak keys, although MapMaker in Google Collections provides this and much more. An effort to put something like this into Java 7 is under way, but there's no telling whether it will actually happen. Wrapping a WeakHashMap with synchronization is likely to be a performance bottleneck: every request has to grab a global lock. --tim On Wed, Apr 8, 2009 at 2:06 PM, Tal Liron tal.li...@threecrickets.com wrote: Hmm. I disagree that this has nothing to do with the Application. For example, if an Application is unloaded, this cached information will remain in the static field. In fact, there is no mechanism in place right now clean this cache, and in dynamic environments (possibly OSGi) it may accumulate cruft. Not a huge problem, but this is the stuff memory leaks are made of... Here's a thought: can we use a synchronized WeakHashMap here? That way, the AnnotationInfo would be discarded when the class is unloaded. -Tal Jerome Louvel wrote: Hi all, Beautiful! This new solution is available in SVN trunk. Thanks Dave for the report and Tim for the clever fix! Best regards, Jerome Louvel -- Restlet ~ Founder and Lead developer ~ http://www.restlet.org/ http://www.restlet.org Noelios Technologies ~ Co-founder ~ http://www.noelios.com http://www.noelios.com _ De : tpeie...@gmail.com [mailto:tpeie...@gmail.com] De la part de Tim Peierls Envoyé : mercredi 8 avril 2009 00:23 À : discuss@restlet.tigris.org Objet : Re: ServerResource is currently incompatible with OSGi Why involve Context at all? The AnnotationInfo associated with a Class? extends UniformResource does not depend on Context. You could just add a method to AnnotationUtils: public static AnnotationInfo getAnnotationDescriptor(Class? extends UniformResource resourceClass) { AnnotationInfo result = cache.get(resourceClass); if (result == null) { result = computeAnnotationDescriptor(resourceClass); // use code from existing getAnnotationDescriptors for this AnnotationInfo prev = cache.putIfAbsent(resourceClass, result); if (prev != null) result = prev; } return result; } private static final ConcurrentMapClass? extends Resource, AnnotationInfo cache = new ConcurrentHashMapClass? extends Resource, AnnotationInfo(); Then you don't need
Re: post in putUser Bookmark throws error
Hello, this may be because the UserResource does not handle POST requests. Did you try to rename UserResource#storeRepresentation to UserResource#acceptRepresentation? Best regards, Thierry Boileau Hi, I changed the Bookmark example C:\restlet-1.1.4\src\org.restlet.example\org\restlet\example\book\rest\ch7\ApplicationTest.java from Put to Post in putUser method as shown below: public static void putUser(String userName, String password, String fullName, String email) { final Form form = new Form(); form.add(user[password], password); form.add(user[full_name], fullName); form.add(user[email], email); final Response resp = new Client(Protocol.HTTP).post( getUserUri(userName), form.getWebRepresentation()); System.out.println(resp.getStatus()); } But now when I'm trying to add user, it throws error Internal Server Error (500) - The server encountered an unexpected condition which prevented it from fulfilling the request I'm using stable restlet 1.1.7. Can you please tell me if its a bug or what I'm doing wrong??? Thanks! -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=1733294 -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=1742110
RE: Annotations and Restlet's future
Hi Tal, Again, if there is no annotation declared on a ServerResource subclass, there is nearly no cost for testing for the presence of those annotations. Hence, it is not really necessary to call setAnnotated(false). I don't want to add a new annotation for this. The fact that a class is a resource is based on the class hierarchy (extending ServerResource), no need to mark it with an additional annotation IMO. Regarding other annotations, I don't want to go further on the JAX-RS road. I really don't see the issue of calling a setter method to turn off conditional processing, otherwise we risk using annotations as the programming language. Best regards, Jerome Louvel -- Restlet ~ Founder and Lead developer ~ http://www.restlet.org/ http://www.restlet.org Noelios Technologies ~ Co-founder ~ http://www.noelios.com/ http://www.noelios.com _ De : Tal Liron [mailto:tal.li...@threecrickets.com] Envoyé : dimanche 12 avril 2009 22:08 À : discuss@restlet.tigris.org Objet : Re: Annotations and Restlet's future Hi Jerome, How about instead of calling setAnnotated(false), there would be an annotation to turn annotation on? Since this doesn't seem like behavior you'd want to turn on or off during the life of the resource instance, it seems like it should be defined at the class level, not in the instance. Makes sense? Maybe something like this: @Resource class ArticleResource extends ServerResource { @Get(txt) ... } The @Resource tag could also support parameters defining general characteristics of the resource. Perhaps enabling conditional mode, etc. Maybe it can even be a separate tag, such as @ConditionalResource. What I'm hoping is that if this tag is not present, annotated mode would be off, which is what I think should be the default. -Tal Jerome Louvel wrote: Hi all, I haven't fully digested all this feed-back, but it helps tremendously! Just to clarify a few points: * Rob correctly guessed my thoughts, annotations should be a fully optional feature * I like to have this feature turned on by default because it lowers the barrier of entry for new users. For experienced Restlet developers, it's easy enough to override the doInit() method and call setAnnotated(false). * Non-annotated resources shouldn't impose any significant performance hit, even if the annotated flag is turned on (annotation detection is done only once) * No additional annotation is expected in Restlet 1.2, we should stick with the current 5 public annotations * Exceptions are no rethrown for annotated methods Best regards, Jerome Louvel -- Restlet ~ Founder and Lead developer ~ http://www.restlet.org/ http://www.restlet.org Noelios Technologies ~ Co-founder ~ http://www.noelios.com http://www.noelios.com _ De : Rémi Dewitte [mailto:remidewi...@gmail.com] Envoyé : vendredi 10 avril 2009 08:58 À : discuss@restlet.tigris.org Objet : Re: Annotations and Restlet's future Hello, I thank you all to clear my mind about annotations. Annotations are probably good to get started with a hello world or minimize the amount of code you would write. But you lose some compilation checks and moreover developing further more complex resources will require to understand how it works (routing/switch logic) and which methods will not be called because of the use of annotations. If I want to search for resources class will I have to search for @Resource as well ? How far are we from annotated Restlets ? Would it be possible to have ServerResource free of annotation logic and an AnnotatedServerResource subclass removing the need for isAnnotated ? Cheers, Rémi On Thu, Apr 9, 2009 at 17:47, Rob Heittman rob.heitt...@solertium.com wrote: GWT 1.5/1.6 is happy with annotations at compile time ... but if the implementation needs to examine them at runtime via reflection, GWT doesn't have that capability. GWT getClass() emulation doesn't have getAnnotations() ... or much of anything else. There's no reflection in the Javascript room. Restlet 1.2's current incarnation is fine with me ... annotations optional. But I agree that the non-annotation and annotation approach should use the same vowels and consonants in the same order whenever possible :-) This helps us bears of very little brain. On Thu, Apr 9, 2009 at 7:06 AM, Tim Peierls t...@peierls.net wrote: On Thu, Apr 9, 2009 at 4:57 AM, Rob Heittman rob.heitt...@solertium.com wrote: ...my only *strong* requirement, that the annotation based solution must remain a voluntary choice and not the only way to get things done. It should remain possible to achieve whatever annotations can achieve in a non-annotation way. This allows the basic API outline to work in places where annotations are not available or work differently enough to cause friction (pre-1.5 JVM backports, GWT, API ports to other languages, Scala ...) It is OK with me if the
Re: Restlet and maven
Hello Rémi, what kind of files are thinking about? package.html, overview.html files? Best regards, Thierry Boileau Hello, There is an issue with the maven build. Resources files (not java files) in src/ are not in the final jar. Rémi 2009/4/8 Rémi Dewitte r...@gide.net mailto:r...@gide.net Hi ! Thanks all for your answers. I was not really worried about building the project with ant or maven. I use maven to build most of my projects and I want to test them with last updates. As maven.restlet.org http://maven.restlet.org is not being updated everyday ;). Cheers, Rémi On Tue, Apr 7, 2009 at 17:02, Davide Angelocola davide.angeloc...@gmail.com mailto:davide.angeloc...@gmail.com wrote: Hi Rémi,   assuming you've installed maven in the PATH you must run the following command in trunk/modules: mvn install using netbeans is even easier, just install the maven plugin and open the modules project. Then build the project. Best Regards, Davide Angelocola 2009/4/7 Rémi Dewitte r...@gide.net mailto:r...@gide.net Hello, I know there is some ongoing work about maven and restlet. If I checkout the trunk and build it, how do I install the new artifacts into my local m2 repository ? Thanks, Rémi -- -- Davide Angelocola -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=1742259
RE: Try to get Redirector working in GAE
Hi Mikhael, I have decided to remove ServletContextAdapter altogether from SVN trunk and adjusted SpringServerServlet to work like ServerServlet. The only thing missing is the redirection from the Context's logger to the Servlet's logger, but the ServletLogger class could be used for this purpose later on. Still, I don't understand why you got this classnotfound exception in the first place. Did you deploy the org.restlet.ext.servlet.jar as well? Because org.restlet.gae.jar embeds its own version of ServerServlet (in org.restlet.util) and ServletLogger (in org.restlet.engine.servlet) which isn't used by the Spring extension. Best regards, Jerome Louvel -- Restlet ~ Founder and Lead developer ~ http://www.restlet.org/ http://www.restlet.org Noelios Technologies ~ Co-founder ~ http://www.noelios.com http://www.noelios.com _ De : Mikhail Spirydonau [mailto:spirydo...@gmail.com] Envoyé : mercredi 15 avril 2009 02:43 À : discuss@restlet.tigris.org Objet : Re: Try to get Redirector working in GAE It is all quite obvious, line 94 in SpringServerServlet makes use of ServletContextAdapter which in turn uses ServletLogger. Strangely though as this is the only use of ServletContextAdapter in the entire Restlet+extensions codebase. Reverted to parentContext.createChildContext() used in the base ServerServlet class and voila - works as a charm both locally and on the server. Once again, have sources for org.restlet.ext.spring.jar working on GAE and for ServerResource as opposed to just Resource. Can post them up if there is interest. And apologies for spamming this list up. Best regards, Mikhail 2009/4/15 Mikhail Spirydonau spirydo...@gmail.com OK, I just realised that the error is actually thrown in SpringServerServlet.createApplication() line 94. There is no mentioning of ServletLogger anywhere in it, neither it was there before and the only thing I changed is the package it extends ServerServlet from. You can clearly see from the stack trace it is using the GAE port's org.restlet.util.ServerServlet. Anyone to help with this oddity out? Could it be GAE itself not posting all the stack traces into the Logs? Best regards, Mikhail 2009/4/15 Mikhail Spirydonau spirydo...@gmail.com Hi Jerome, I tried updated version of org.restlet.gae.jar. It worked fine on a local dev server. Having deployed it onto server got the following: java.lang.NoClassDefFoundError: org/restlet/engine/servlet/ServletLogger at org.restlet.ext.spring.SpringServerServlet.createApplication(SpringServerServlet.java:94) at org.restlet.util.ServerServlet.getApplication(ServerServlet.java:718) at org.restlet.util.ServerServlet.init(ServerServlet.java:869) at javax.servlet.GenericServlet.init(GenericServlet.java:211) cut Caused by: java.lang.ClassNotFoundException: org.restlet.engine.servlet.ServletLogger at com.google.apphosting.runtime.security.UserClassLoader.logFailedLoad(UserClassLoader.java:810) at com.google.apphosting.runtime.security.UserClassLoader.findClass(UserClassLoader.java:372) at java.lang.ClassLoader.loadClass(Unknown Source) at com.google.apphosting.runtime.security.UserClassLoader.loadClassImpl(UserClassLoader.java:434) at com.google.apphosting.runtime.security.UserClassLoader.loadClass(UserClassLoader.java:380) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClassInternal(Unknown Source) I recall I saw someone from Google (http://groups.google.com/group/google-appengine-java/msg/c8dc407d77e5562d) trying to start Restlet application up by getting rid of ServletLogger. Later in the same thread you said it is fixed in org.restlet.gae.jar. May I be using wrong version or getting confused somewhere? Is the source for the gae port available from some branch to have a look at? Thanks. Best regards, Mikhail P.S. I have corrected org.restlet.ext.spring.jar to work with ServerResource and gae port. If anyone interested I can share sources somehow. 2009/4/14 Jerome Louvel jerome.lou...@noelios.com Hi Ken, Sorry, this is a regression due to packages refactoring, I've uploaded a new JAR on the wiki page: http://wiki.restlet.org/docs_1.2/13-restlet/252-restlet.html Best regards, Jerome Louvel -- Restlet ~ Founder and Lead developer ~ http://www.restlet.org Noelios Technologies ~ Co-founder ~ http://www.noelios.com -Message d'origine- De : Ken Huang [mailto:ken_...@hotmail.com] Envoy� : mardi 14 avril 2009 06:06 � : discuss@restlet.tigris.org Objet : Try to get Redirector working in GAE I try to redirect my request from my GAE application to another server, I found it might work with Redirector.MODE_DISPACTHER, Here is the example code I used: GWT client code: � � � � � � � � � � � �final Client client = new Client(Protocol.HTTP); � � � � � � � � � � � �Form form = new Form(); � � � � � � � � � � �
RE: restlet as a jax-rs implementation
Hi Philippe, To complete Stephan's answer, the ServerServlet is a Restlet specific class that is leveraged by our JAX-RS implementation. It also works with classic Restlet application hence it follows our own convention. BTW, the parameter name you want to use in your web.xml is org.restlet.application and not org.restlet.attribute.application! Best regards, Jerome Louvel -- Restlet ~ Founder and Lead developer ~ http://www.restlet.org Noelios Technologies ~ Co-founder ~ http://www.noelios.com -Message d'origine- De : stephan.ko...@web.de [mailto:stephan.ko...@web.de] Envoyé : mercredi 15 avril 2009 09:30 À : discuss@restlet.tigris.org Objet : Re: restlet as a jax-rs implementation Hi Philippe, is prefix also the @Path on your root resource class? Than you have to use only /* as url-pattern. To your first question I can't answer, because of my missing time other ones worked on the JAX-RS extension. best regards Stephan Hi I have an existing jax-rs application and would like to use restlet as an implementation. My web.xml currently looks like this: servlet servlet-nameRestletServlet/servlet-name servlet-classcom.noelios.restlet.ext.servlet.ServerServlet/servlet-class init-param param-nameorg.restlet.attribute.application/param-name param-valuecom.acme.MyApplication/param-value /init-param /servlet servlet-mapping servlet-nameRestletServlet/servlet-name url-pattern/prefix/*/url-pattern /servlet-mapping com.acme.MyApplication is a suclass of javax.ws.rs.core.Application. So here's my first question, why is the init parameter called org.restlet.attribute.application and not javax.ws.rs.Application like spec says? Second the servlet is not mapped to the context path but a subpath. This does not seem to work out of the box, I'm getting 404s. Is there some way this has to be configured like in RESTeasy? -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=17231 44 -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=1742564
RE: Re: Google AppEngine and Restlet
Hi Remi, As long as the extension only relies on GAE's white listed JRE classes, it will work without any modification (example: the FreeMarker extension). Your dream can come true already :-) In the recent version of org.restlet.gae.jar, the packages are the same as in org.restlet.jar so it should be easy to leverage Restlet extensions that are compatible with GAE. As a result, it should be possible to deploy existing Restlet applications in GAE without any modification, as long as their are compatible with GAE's environment of course. Best regards, Jerome Louvel -- Restlet ~ Founder and Lead developer ~ http://www.restlet.org/ http://www.restlet.org Noelios Technologies ~ Co-founder ~ http://www.noelios.com/ http://www.noelios.com _ De : remidewi...@gmail.com [mailto:remidewi...@gmail.com] De la part de Rémi Dewitte Envoyé : mercredi 15 avril 2009 23:02 À : discuss@restlet.tigris.org Objet : Re: Re: Google AppEngine and Restlet Jérôme, As far as I understand, we can't reuse Restlet extensions made for org.restlet.* with org.restlet.gae.* classes, can we ? I have thought at a time that GAE would be a deployment option for our restlet applications. With the gae copy, we may not reuse an application as straitforward as I may have dreamed. I see Restlet extensible enough not to have to copy the full code base. Would that dream have been possible with 1.1 with the API and Engine separation ? Why should not we support this scenario ;) ? Thanks, Rémi On Wed, Apr 15, 2009 at 22:29, Jerome Louvel jerome.lou...@noelios.com wrote: Hi Richy, Thanks for sharing your experience! When I did the adaptation of Restlet to GAE (resulting in the new org.restlet.gae.jar available in recent snapshots), I took the source code and had to remove many classes that didn't compile due to the lack of sockets and SSL support (mainly the internal connectors). I'm surprised that the org.restlet.jar works despite this and I'm not sure if we should support this usage scenario. In addition, org.restlet.gae.jar includes the ServerServlet, the JavaMail and the JDK's Net connectors. In the future, it will leverage other GAE APIs. Regarding FreeMarker, the ContextTemplateLoader I just added to SVN trunk will probably help simplifying its usage in GAE with Restlet. Let me know if you have a chance to test it. Best regards, Jerome Louvel -- Restlet ~ Founder and Lead developer ~ http://www.restlet.org Noelios Technologies ~ Co-founder ~ http://www.noelios.com -Message d'origine- De : webp...@tigris.org [mailto:webp...@tigris.org] Envoyé : samedi 11 avril 2009 14:49 À : discuss@restlet.tigris.org Objet : RE: Re: Google AppEngine and Restlet After a bit of experimentation I have managed to get a Restlet/Freemarker stack running on GAE. The basic steps I took were : 1. Modify ServletConverter and ServletContextAdapter as detailed below. Basically this means replacing the calls to new ServletLogger with Logger.getLogger e.g. in the ServletConverter constructor do something like... super(new Context(Logger.getLogger(ServletConverter.class.getName(; 2. Add org.freemarker.jar, org.restlet.jar, org.restlet.ext.servlet.jar and org.restlet.ext.freemarker.jar to the WEB-INF/lib of your google app project and add to the build path. 3. Follow usual setup for getting Restlet working in a Servlet environment. Folow the HelloWorld tutorial in the getting started docs - it should work fine locally (even without doing step 1. However, you'll need to replace these calls in order to get it to run in the real GAE) 4. Freemarker was a little more tricky, but not much. Create a freemarker configuration that uses the class template loader and put this in the Restlet Application context attributes. 5. Make sure your templates are somewhere on the class path. 6. Use the TemplateRepresentation along with your freemarker config from the context attributes 7. Make sure it works locally and upload to the app engine. Hopefully I'll get a chance to write this up properly over easter, but it wasn't too bad and looks promising so far. Cheers, Richy http://wiredupandfiredup.com -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447 http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=1648 5 dsMessageId=16485 97 -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447 http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=1732 294 dsMessageId=1732294 -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=1742703
RE: Managing a JPA/Hibernate session
Hi Matt, There has been a recent discussion on this topic in this list. Some changes were made in SVN trunk so that ConnectorService callback methods are systematically called after sending representations/responses. You basically have to provide a custom ConnectorService that intercepts those calls to update your EntityManager accordingly. Also, as this piece of code seems rather generic, there might be an opportunity to provide a specific Restlet extension for this... Feel free to contribute one or to enter a RFE. Best regards, Jerome Louvel -- Restlet ~ Founder and Lead developer ~ http://www.restlet.org Noelios Technologies ~ Co-founder ~ http://www.noelios.com -Message d'origine- De : webp...@tigris.org [mailto:webp...@tigris.org] Envoyé : mercredi 15 avril 2009 19:50 À : discuss@restlet.tigris.org Objet : RE: Managing a JPA/Hibernate session Hi Could anyone give me some advice how I could implement such a Filter or ConnectorService for hibernate? The main problem is: How can I get the EntityManager that I created in the Filter at some other point? Now I'm using auto-generated JPA Controller classes form NetBeans but this leads to lots of problems when accessing data when the EntityManager has already been closed. Thanks for any Help Matt -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=17305 94 -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=1742765
RE: Restlet 1.2 M2, Simple, and HTTPS
Hi Matt, Could you enter a bug report for this? http://www.restlet.org/community/issues Best regards, Jerome Louvel -- Restlet ~ Founder and Lead developer ~ http://www.restlet.org Noelios Technologies ~ Co-founder ~ http://www.noelios.com -Message d'origine- De : MattyJ [mailto:mjwat...@gmail.com] Envoyé : jeudi 16 avril 2009 06:11 À : discuss@restlet.tigris.org Objet : Restlet 1.2 M2, Simple, and HTTPS Hi there, The application I'm building uses the simpleframework. This morning I upgraded from Restlet M1 to M2 which also included a new version of simple 4.1.9. (It was 3.1.3) Prior to the upgrade HTTPS was working fine now for some reason when ever I try and access any https url it seems to hang indefinitely. I've explicitly removed all of the certificates exceptions I've been using for development and have attempted to re-add the certificate back but to no available. I've tried putting in lots of breakpoints to see whats go on but I'm still not having much joy. I rolled back the changes to M1 and 3.1.3 and it's all working fine again. Does anyone else have this issue? Or could you provide any suggestions as to what I might need to do? Thanks, Matt -- View this message in context: http://n2.nabble.com/Restlet-1.2-M2%2C-Simple%2C-and-HTTPS-tp2641814p2641814 .html Sent from the Restlet Discuss mailing list archive at Nabble.com. -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=17389 17 -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=1742808
Re: Restlet and maven
Hello Thierry, I am thinking of META-INF/services/* for client helpers for example. Have you encountered any issue with my patch ? I have included all files in src/ except .java and package.html but we could be more specific. Just have to change the include content. Cheers, Rémi On Thu, Apr 16, 2009 at 09:39, Thierry Boileau thierry.boil...@noelios.comwrote: Hello Rémi, what kind of files are thinking about? package.html, overview.html files? Best regards, Thierry Boileau Hello, There is an issue with the maven build. Resources files (not java files) in src/ are not in the final jar. Rémi 2009/4/8 Rémi Dewitte r...@gide.net mailto:r...@gide.net Hi ! Thanks all for your answers. I was not really worried about building the project with ant or maven. I use maven to build most of my projects and I want to test them with last updates. As maven.restlet.org http://maven.restlet.org is not being updated everyday ;). Cheers, Rémi On Tue, Apr 7, 2009 at 17:02, Davide Angelocola davide.angeloc...@gmail.com mailto:davide.angeloc...@gmail.com wrote: Hi Rémi,   assuming you've installed maven in the PATH you must run the following command in trunk/modules: mvn install using netbeans is even easier, just install the maven plugin and open the modules project. Then build the project. Best Regards, Davide Angelocola 2009/4/7 Rémi Dewitte r...@gide.net mailto:r...@gide.net Hello, I know there is some ongoing work about maven and restlet. If I checkout the trunk and build it, how do I install the new artifacts into my local m2 repository ? Thanks, Rémi -- -- Davide Angelocola -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=1742259 -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=1742499
Re: Restlet 1.2 M2, Simple, and HTTPS
Hi MattyJ, I've faced the same problem before using Restlet M1 and i discovered the cause that is i was using Grizzly connector, removing the latter and working with Simple solved my problem. However some of my friends who were facing the same prob, did the opposite to get over it (i.e. they used grizzly instead of simple). So i suggested you swap and test different connectors separately and observe if that solves it or not ... Wish this helps a lil' Hi there, The application I'm building uses the simpleframework. This morning I upgraded from Restlet M1 to M2 which also included a new version of simple 4.1.9. (It was 3.1.3) Prior to the upgrade HTTPS was working fine now for some reason when ever I try and access any https url it seems to hang indefinitely. I've explicitly removed all of the certificates exceptions I've been using for development and have attempted to re-add the certificate back but to no available. I've tried putting in lots of breakpoints to see whats go on but I'm still not having much joy. I rolled back the changes to M1 and 3.1.3 and it's all working fine again. Does anyone else have this issue? Or could you provide any suggestions as to what I might need to do? Thanks, Matt -- View this message in context: http://n2.nabble.com/Restlet-1.2-M2%2C-Simple%2C-and-HTTPS-tp2641814p2642197.html Sent from the Restlet Discuss mailing list archive at Nabble.com. -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=1742328
Re: Restlet and maven
Jérôme, I had to disable test and example module to have mvn install work. Apparently it does work as I expect :). Rémi On Thu, Apr 16, 2009 at 11:28, Jerome Louvel jerome.lou...@noelios.comwrote: Thanks Remi, fix applied to SVN trunk! Cheers, Jerome -- *De :* remidewi...@gmail.com [mailto:remidewi...@gmail.com] *De la part de * Rémi Dewitte *Envoyé :* jeudi 16 avril 2009 09:17 *À :* discuss@restlet.tigris.org *Objet :* Re: Restlet and maven Here is a fix ! Rémi 2009/4/15 Rémi Dewitte remidewi...@gmail.com I will try something as soon as possible ! Rémi On Wed, Apr 15, 2009 at 23:19, Jerome Louvel jerome.lou...@noelios.comwrote: Hi Rémi, In our code organization, resources are part of the Java source directory (contrary to Maven's default layout). Could you suggest a fix? Best regards, Jerome Louvel -- Restlet ~ Founder and Lead developer ~ http://www.restlet.org Noelios Technologies ~ Co-founder ~ http://www.noelios.com -- *De :* remidewi...@gmail.com [mailto:remidewi...@gmail.com] *De la part de* Rémi Dewitte *Envoyé :* jeudi 9 avril 2009 17:18 *À :* discuss@restlet.tigris.org *Objet :* Re: Restlet and maven Hello, There is an issue with the maven build. Resources files (not java files) in src/ are not in the final jar. Rémi 2009/4/8 Rémi Dewitte r...@gide.net Hi ! Thanks all for your answers. I was not really worried about building the project with ant or maven. I use maven to build most of my projects and I want to test them with last updates. As maven.restlet.org is not being updated everyday ;). Cheers, Rémi On Tue, Apr 7, 2009 at 17:02, Davide Angelocola davide.angeloc...@gmail.com wrote: Hi Rémi, assuming you've installed maven in the PATH you must run the following command in trunk/modules: mvn install using netbeans is even easier, just install the maven plugin and open the modules project. Then build the project. Best Regards, Davide Angelocola 2009/4/7 Rémi Dewitte r...@gide.net Hello, I know there is some ongoing work about maven and restlet. If I checkout the trunk and build it, how do I install the new artifacts into my local m2 repository ? Thanks, Rémi -- -- Davide Angelocola -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=1744247
RE: Re: Google AppEngine and Restlet
Hi Zsolt, Restlet/GWT should definitely work with GAE. From a GAE point of view, everything will look like compiled Javascript files served statically by your Restlet/GAE application. On the server-side, you can definitely use Restlet instead of GWT-RPC. The GwtShellServletWrapper is even included in the org.restlet.gae.jar file. http://www.restlet.org/documentation/snapshot/gae/org/restlet/util/GwtShellS ervletWrapper.html Let us know if you encounter any difficulty. Best regards, Jerome Louvel -- Restlet ~ Founder and Lead developer ~ http://www.restlet.org Noelios Technologies ~ Co-founder ~ http://www.noelios.com -Message d'origine- De : Zsolt Kovacs [mailto:zs.m...@gmail.com] Envoyé : jeudi 16 avril 2009 13:11 À : discuss@restlet.tigris.org Objet : RE: Re: Google AppEngine and Restlet Hi Jerome, In the ligth of this, willl the Restlet GWT extension work on GAE? I am learning GEA and GWT and before I start to investigate, I would appreciate your feedback. Regard, Zsolt Hi Remi, As long as the extension only relies on GAE's white listed JRE classes, it will work without any modification (example: the FreeMarker extension). Your dream can come true already :-) In the recent version of org.restlet.gae.jar, the packages are the same as in org.restlet.jar so it should be easy to leverage Restlet extensions that are compatible with GAE. As a result, it should be possible to deploy existing Restlet applications in GAE without any modification, as long as their are compatible with GAE's environment of course. Best regards, Jerome Louvel -- Restlet ~ Founder and Lead developer ~ http://www.restlet.org/ http://www.restlet.org Noelios Technologies ~ Co-founder ~ http://www.noelios.com/ http://www.noelios.com -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=17453 49 -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=1746449
Re: FreeMarker Template Loading
Jerome, Thanks, this works as expected with one exception. The getLastModified(Object templateSource) returns a NullPointerException all the time for me as the getModificationDate() from the Representation (templateSource) is always null. I overrode the class and that method and it works as expected. Should I make a ticket for this too or is this e-mail sufficient? Thanks, Dustin Jerome Louvel wrote: Hi Dustin, Thanks for reporting this issue. I have just added a ContextTemplateLoader class to FreeMarker extension that will allow you to achieve the same result as the Configuration#setServletContextForTemplateLoading() method. It is checked in SVN trunk and will be available in the next snapshot. Please test and let me know if it works as expected. Best regards, Jerome Louvel -- Restlet ~ Founder and Lead developer ~ http://www.restlet.org Noelios Technologies ~ Co-founder ~ http://www.noelios.com -Message d'origine- De : Dustin N. Jenkins [mailto:dustin.jenk...@nrc-cnrc.gc.ca] Envoyé : jeudi 9 avril 2009 23:10 À : discuss@restlet.tigris.org Objet : FreeMarker Template Loading Hello all, I'm running JDK 1.6 with Restlet 1.2 and the included FreeMarker all being served from a Tomcat 6 container. My FreeMarker templates are in the web content root under the directory freemarker-templates. I used to cast the context to a ServletContextAdapter before 1.2, and was able to tell my FreeMarker Configuration to obtain my Templates from the ServletContext, but that's not true anymore. Is there a way to get the ServletContext now? I am able to use this: getContext().getClientDispatcher().get(war:///freemarker-templates/ + templateName).getEntity(); and wrap it in a TemplateRepresentation, but my #include myHeader.ftl files within my templates no longer work as they're relative URLs. So which way is better? Is there a better third option? Thank you! Dustin -- Dustin N. Jenkins | Tel/Tél: 250.363.3101 | dustin.jenk...@nrc-cnrc.gc.ca facsimile/télécopieur: (250) 363-0045 National Research Council Canada | 5071 West Saanich Rd, Victoria BC. V9E 2E7 Conseil national de recherches Canada | 5071, ch. West Saanich, Victoria (C.-B) V9E 2E7 Government of Canada | Gouvernement du Canada -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=1754277