Re: Form parsing doesn't work
Hello Paul, as far as I know, multi part foms are not supported yet: http://restlet.tigris.org/issues/show_bug.cgi?id=71 best regards, Thierry Boileau I have a bit of code that processes a multipart/form-data form. I'm sending a test request using curl, e.g.: curl -v -F from=paul%40lucasmail.org http://localhost:8182/foo; I have code that parses the form that starts off with: final MediaType mediaType = request.getEntity().getMediaType(); final Form form = MediaType.APPLICATION_WWW_FORM.equals( mediaType, true ) || MediaType.MULTIPART_FORM_DATA.equals( mediaType, true ) ? request.getEntityAsForm() : request.getResourceRef().getQueryAsForm(); The form data isn't parsed correctly: the one and only name is the boundary string. The FormReader class doesn't seem to handle multipart/form-data. I'm using an older Restlet version (1.0.9), but I tried upgrading to 1.1.2 and it makes no difference. How to I parse multipart/form-data forms correctly? (Preferably using 1.0.9.) - Paul -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=1188665 -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=1190662
RE: Form parsing doesn't work
Hi Thierry, In Paul's case (server-side parsing), there is a workaround which is to use the FileUpload extension: http://www.restlet.org/documentation/snapshot/ext/org/restlet/ext/fileupload/RestletFileUpload.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 : Thierry Boileau [mailto:thierry.boil...@noelios.com] Envoye : jeudi 19 fevrier 2009 09:08 A : discuss@restlet.tigris.org Objet : Re: Form parsing doesn't work Hello Paul, as far as I know, multi part foms are not supported yet: http://restlet.tigris.org/issues/show_bug.cgi?id=71 best regards, Thierry Boileau I have a bit of code that processes a multipart/form-data form. I'm sending a test request using curl, e.g.: curl -v -F from=paul%40lucasmail.org http://localhost:8182/foo; I have code that parses the form that starts off with: final MediaType mediaType = request.getEntity().getMediaType(); final Form form = MediaType.APPLICATION_WWW_FORM.equals( mediaType, true ) || MediaType.MULTIPART_FORM_DATA.equals( mediaType, true ) ? request.getEntityAsForm() : request.getResourceRef().getQueryAsForm(); The form data isn't parsed correctly: the one and only name is the boundary string. The FormReader class doesn't seem to handle multipart/form-data. I'm using an older Restlet version (1.0.9), but I tried upgrading to 1.1.2 and it makes no difference. How to I parse multipart/form-data forms correctly? (Preferably using 1.0.9.) - Paul -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=1188665 -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=1190662 -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=1190683
Re: Are there news about Restlet: Official Developer's Guide to RESTful Web Applications in Java ?
Hi all, I know that you are very busy now (mailing lists and milestones show it :-) ) but are there any news about the official restlet book??? I am currently developing the software of my PhD thesis using Restlet and It could be great to take a glance to it for having a complete reference (avoiding look to source code ;-) ). Best regards and thanks for your hard work on Restlet! Sergio. -- Department of Computing Sciences School of Computer Engineering University Rey Juan Carlos -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=1191416
Re: Re: problem with restlet-gwt
I was never able to reproduce the issue -- don't know about Thierry. If your web.xml has NOT been overwritten (refresh your resources in the IDE to check that it still contains the GwtShellServletWrapper), it happens for you consistently and you are able to do a web conference, feel free to email me personally so I can get eyes on the problem. On Wed, Feb 18, 2009 at 5:39 PM, blackh...@collab.net wrote: I am having the same problem. Does any one know of the solution? Hi all, I hope to find time this week. best regards, Thierry Boileau I very, very seldom use Windows, but Jerome and Thierry do, so I'm sure he's used the sample there -- I think he updated it most recently. I think I see what you are asking -- you need to use both Restlet and RPC in the same application. I don't have an example of that right at hand; I use Restlet so I don't have to use RPC at all ... but I do understand and I know that it can be set up. If you are running under Eclipse, it is possible for the web.xml to be overwritten and Eclipse doesn't know about it without you doing an explicit Refresh on the file -- but you probably tried this already. Is your web.xml exactly as it came from the example, or have you modified it in any way? When we run the gwtshell under eclipse, I saw that it starts a tomcat instance. It also deploys the restlet resources there in order they to be found by the gwt engine? My question is does the gwt shell behave as a web container and deploy the resources (in the server folder) within it as we had created a web project and put the restlet based application classes within it? Yes, that is how the hosted mode works. If I start the restlet TestServer component as a standaolne application and then run the shell again it complains of an already used address and so the server side should work well even if I can not see the TestServer's sytem.out statements in the console. If the standalone uses the same port as hosted mode, you can't run them both at once. I think hosted mode defaults to . I read several books on gwt (gwt in practice and Pro web 2.0 with gwt ... and so on) and I have seen different solutions but noone clearly refers to this particular integration with rest. It is very new -- not likely to be in the books yet! Can You please help me? Trying :-) Thierry here may also have some ideas. - Rob -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=1188476 -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=1191713
RE: Re: Re: problem with restlet-gwt
I had this problem too. The issue is that the web.xml in the zip file is not updated with restlet's GWTSheelWrapper. This is how I resolved it. 1) Downloading the zip file 2) Import to eclipse 3) update the SimpleExample.launch with your GWT home directory. 4) Update the web.xml at the following location RestletGWTSimpleExample folder\tomcat\webapps\ROOT\WEB-INF The contents of the file have to be as follows ?xml version=1.0 encoding=UTF-8? web-app servlet servlet-nameadapter/servlet-name servlet-class com.noelios.restlet.ext.gwt.GwtShellServletWrapper /servlet-class init-param param-nameorg.restlet.application/param-name param-value org.restlet.example.gwt.server.TestServerApplication /param-value /init-param init-param param-namemodule/param-name param-value org.restlet.example.gwt.SimpleExample /param-value /init-param /servlet servlet-mapping servlet-nameadapter/servlet-name url-pattern/*/url-pattern /servlet-mapping /web-app 5)run the example by running SimpleExample.launch -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=1194652
How to get HttpClientHelper to follow redirects?
Hi there, I've been trying to get HttpClientHelper to automatically follow redirects, but can't for the life of me get it to work. At the moment I'm using HttpClientHelper.getHelpedParameters() and trying to set the 'followRedirects' parameter to 'true' that way. Would it be possible for someone to provide brief example code showing the correct method? It would be much appreciated! cheers, Nick -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=1193306
Warning and SocketException when using 1.1.2, built-in server, and FreeMarker
Hello all, When I start up my app, and make the first request to it, I'm seeing this in my console: Feb 19, 2009 10:37:40 PM com.noelios.restlet.http.StreamServerCall complete WARNING: Unable to shutdown server socket java.net.SocketException: Socket is not connected at sun.nio.ch.SocketChannelImpl.shutdown(Native Method) at sun.nio.ch.SocketChannelImpl.shutdownInput(SocketChannelImpl.java:583) at sun.nio.ch.SocketAdaptor.shutdownInput(SocketAdaptor.java:360) at com.noelios.restlet.http.StreamServerCall.complete(StreamServerCall.java:102) at com.noelios.restlet.http.HttpServerConverter.commit(HttpServerConverter.java:414) at com.noelios.restlet.http.HttpServerHelper.handle(HttpServerHelper.java:148) at com.noelios.restlet.http.StreamServerHelper$ConnectionHandler.run(StreamServerHelper.java:86) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:417) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:269) at java.util.concurrent.FutureTask.run(FutureTask.java:123) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675) at java.lang.Thread.run(Thread.java:613) I've confirmed that this only occurs when using the built-in server and returning a TemplateRepresentation. When I return a StringRepresentation the warning does not occur. When I switch to Jetty the warning does not occur. And again, this only occurs for the first request. Subsequent requests do not cause a warning to occur. Here's the Groovy test case I've got it boiled down to: class HelloNameRestlet extends Restlet { public void handle(Request request, Response response) { def data = [name:world] response.entity = new TemplateRepresentation('hello_name.txt.fm', new Configuration(), data, MediaType.TEXT_PLAIN) } } new Server(Protocol.HTTP, 3000, new HelloNameRestlet()).start() Not sure if it matters, but I'm running my tests on an Intel Mac running OS X 10.5.6 and all updates. I've duplicated this issue with Java 1.5/32 and 1.6/64, and with Groovy 1.5.6 and 1.6.0. I'm thinking this might be pointing to a minor bug somewhere, but I couldn't begin to pinpoint where. I'm hoping someone else can! Thanks, Avi -- Avi Flax » Lead Technologist » Partner » Arc90 » http://arc90.com -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=1196234
Re: Warning and SocketException when using 1.1.2, built-in server, and FreeMarker
Avi, I found the same issue the other day and have reported a bug. http://restlet.tigris.org/issues/show_bug.cgi?id=71 Paul On Thu, Feb 19, 2009 at 7:54 PM, Avi Flax a...@arc90.com wrote: Hello all, When I start up my app, and make the first request to it, I'm seeing this in my console: Feb 19, 2009 10:37:40 PM com.noelios.restlet.http.StreamServerCall complete WARNING: Unable to shutdown server socket java.net.SocketException: Socket is not connected at sun.nio.ch.SocketChannelImpl.shutdown(Native Method) at sun.nio.ch.SocketChannelImpl.shutdownInput(SocketChannelImpl.java:583) at sun.nio.ch.SocketAdaptor.shutdownInput(SocketAdaptor.java:360) at com.noelios.restlet.http.StreamServerCall.complete(StreamServerCall.java:102) at com.noelios.restlet.http.HttpServerConverter.commit(HttpServerConverter.java:414) at com.noelios.restlet.http.HttpServerHelper.handle(HttpServerHelper.java:148) at com.noelios.restlet.http.StreamServerHelper$ConnectionHandler.run(StreamServerHelper.java:86) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:417) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:269) at java.util.concurrent.FutureTask.run(FutureTask.java:123) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675) at java.lang.Thread.run(Thread.java:613) I've confirmed that this only occurs when using the built-in server and returning a TemplateRepresentation. When I return a StringRepresentation the warning does not occur. When I switch to Jetty the warning does not occur. And again, this only occurs for the first request. Subsequent requests do not cause a warning to occur. Here's the Groovy test case I've got it boiled down to: class HelloNameRestlet extends Restlet { public void handle(Request request, Response response) { def data = [name:world] response.entity = new TemplateRepresentation('hello_name.txt.fm', new Configuration(), data, MediaType.TEXT_PLAIN) } } new Server(Protocol.HTTP, 3000, new HelloNameRestlet()).start() Not sure if it matters, but I'm running my tests on an Intel Mac running OS X 10.5.6 and all updates. I've duplicated this issue with Java 1.5/32 and 1.6/64, and with Groovy 1.5.6 and 1.6.0. I'm thinking this might be pointing to a minor bug somewhere, but I couldn't begin to pinpoint where. I'm hoping someone else can! Thanks, Avi -- Avi Flax » Lead Technologist » Partner » Arc90 » http://arc90.com -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=1196234 -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=1196249
Time to live for classpath references
Hello, I'm using the CLAP protocol to get static content such as JavaScript delivered. I'd like to have those expire way down in the future since I use URLs that encode the file version and some of the JS libraries I use create quite a few hits to the server. I'm using Restlet 1.1.2 with the Restlet engine. I've tried a number of things, but nothing seems to work. What I am currently doing is this: public static void main(String[] args) throws Exception { Component component = new Component(); component.getServers().add(Protocol.HTTP, configuration.getHttpPort()); component.getClients().add(Protocol.CLAP).getContext().getParameters().add(timeToLive,604800); component.getDefaultHost().attach(new Pronto()); component.start(); } and in createRoot() I have a Router to which I attach a directory like this: router.attach(/javascript, new Directory(getContext(), LocalReference.createClapReference(LocalReference.CLAP_THREAD, /javascript))); I can't see any relevant header in the responses, though -- somehow setting the parameter doesn't seem to have any impact. Am I missing something? BTW: the Server header says Noelios-Restlet-Engine/1.1..2, which I suppose has a dot too many. Regards, Peter -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=1196339
Deploy Restlet GWT extension to Tomcat
I am having problems deploying my application on tomcat. I am using the Restlet GWT extension and while the application works on the hosted mode, it doesn't work when I deploy it on Tomcat. My Application file (snippet) --- ... @Override public synchronized Restlet createRoot() { Router router = new Router(getContext()); router.attach(/items,ItemsResource.class); router.attach(/items/{itemName}, ItemResource.class); return router; } ... On the client, --- grid.addRecordClickHandler(new RecordClickHandler() { public void onRecordClick(RecordClickEvent event) { final Client client = new Client(Protocol.HTTP); client.get(http://localhost:8080/CaseManager/items;, new Callback(){ @Override public void onEvent(Request request, Response response) { try{ com.google.gwt.user.client.Window.alert( response.getEntity().getText() ); } catch(Exception e){ e.printStackTrace(); } } }); } }); - My web.xml when deployed on tomcat is ?xml version=1.0 encoding=UTF-8? web-app display-nameTest servlet/display-name context-param param-nameorg.restlet.application/param-name param-value com.test.server.FirstResourceApplication /param-value /context-param !-- Restlet adapter -- servlet servlet-nameServerServlet/servlet-name servlet-class org.restlet.ext.servlet.ServerServlet /servlet-class /servlet !-- Catch all requests -- servlet-mapping servlet-nameServerServlet/servlet-name url-pattern/items/url-pattern /servlet-mapping servlet-mapping servlet-nameServerServlet/servlet-name url-pattern/items/*/url-pattern /servlet-mapping welcome-file-list welcome-fileCaseManager.html/welcome-file /welcome-file-list /web-app When I access the URL http://localhost:8080/CaseManager/CaseManager.html the call in the client fails with a 404 error. Feb 19, 2009 5:26:38 PM org.apache.catalina.core.ApplicationContext log INFO: ServerServlet: [Noelios Restlet Engine] - Attaching application: com.testapp.server.firstresourceapplicat...@dec8b3 to URI: /CaseManager/items Feb 19, 2009 5:26:38 PM org.restlet.engine.LogFilter afterHandle INFO: 2009-02-1917:26:38127.0.0.1 - 127.0.0.1 8080GET /CaseManager/items - 404 330 - 31 http://localhost:8080 Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; InfoPath.1; .NET CLR 2.0.50727) - Feb 19, 2009 5:26:42 PM org.restlet.engine.LogFilter afterHandle INFO: 2009-02-1917:26:42127.0.0.1 - 127.0.0.1 8080GET /CaseManager/items - 404 330 - 0 http://localhost:8080 Noelios-Restlet-Engine/1.2.m1 http://localhost:8080/CaseManager/782D6C746CFC4EFC288789EE2C72C8F3.cache.html From this it looks like the request is going to FirstResourceApplication, but its unable to find the appropriate router. I know that the issue is in the web.xml (as that's the only thing that changed between the hosted mode and the tomcat deplopyment). Has anyone faced this issue?? -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=1194885