Re: Restlet and Large PUT requests
Hi, I would look at Chunked Transfer as described in the HTTP spec. Does anyone know if Restlet supports this? Regards Donald. Stephan Koops stephan.ko...@we b.de To Sent by: discuss@restlet.tigris.org stephan.ko...@web cc .de Subject Re: Restlet and Large PUT requests 08/04/09 02:17 AM Please respond to discuss disc...@restlet. tigris.org Hi, because it seems to me, you get no answer until now, here a possibility: You use the representation, and write into or write from its InputStream / Reader. best regards Stephan webp...@tigris.org schrieb: Greetings, I am new to Restlet and am not sure how to solve this problem, or if Restlet is capable of doing what I am after: I need to be able to generate a PUT request that has a large (500mb+) amount of text. The text its self is generated on the fly (not from a file on disk). I then need to be able to have a Restlet server that accepts this large PUT request without having to read the entire request into memory first (I currently plan on streaming it back out to a physical file). Anyone have any ideas on how to do the above using the Restlet client/server libraries? -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=1545862 -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=1579466 ** Any personal or sensitive information contained in this email and attachments must be handled in accordance with the Victorian Information Privacy Act 2000, the Health Records Act 2001 or the Privacy Act 1988 (Commonwealth), as applicable. This email, including all attachments, is confidential. If you are not the intended recipient, you must not disclose, distribute, copy or use the information contained in this email or attachments. Any confidentiality or privilege is not waived or lost because this email has been sent to you in error. If you have received it in error, please let us know by reply email, delete it from your system and destroy any copies. ** -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=1606982
Re: Resource factories
Hi Tai, I had a look at your classes and I agree with the others; static variables are a bad idea. I suggest that you turn all these static methods into properties. Even if dependency injection is difficult (or impossible) to do with resources in the current Restlet architecture, it is still a better design. It offers great flexibility without tying you down to one way of doing things. It is then possible for a developer to trivially extend the class and provide values in the default constructor. public ExampleJavaScriptResource extends org.restlet.ext.script.ScriptResource { public ExampleJavaScriptResource(Context context, Request request, Response response) { setExtension(js); setDefaultName(execute); setSourceViewable(true); // ... etc. } } // Route requests to appropriate Resources router.attach(/javascript/${scriptname}, ExampleJavaScriptResource.class); I understand that this is not the whole answer, but it gives developers options. Your proposal limits developers to one way of configuring ScriptResource classes and thats it. Developers will find many and varied ways to configure Resources in Restlet. We have our own way, but I would not impose that on others. Furthermore, we may change it in the future. Regards Donald. Tal Liron tal.li...@threec rickets.com To discuss@restlet.tigris.org 24/03/09 12:32 PM cc Subject Please respond to Re: Resource factories discuss disc...@restlet. tigris.org Small addendum: Instead of checking out svn, I think the development documentation may be good enough for reference: http://www.restlet.org/documentation/snapshot/ext/index.html?org/restlet/ext/script/package-summary.html -Tal ** Any personal or sensitive information contained in this email and attachments must be handled in accordance with the Victorian Information Privacy Act 2000, the Health Records Act 2001 or the Privacy Act 1988 (Commonwealth), as applicable. This email, including all attachments, is confidential. If you are not the intended recipient, you must not disclose, distribute, copy or use the information contained in this email or attachments. Any confidentiality or privilege is not waived or lost because this email has been sent to you in error. If you have received it in error, please let us know by reply email, delete it from your system and destroy any copies. ** -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=1410856
Accept: application/json
Hi all, I want to set the Accept request header but I am frustrated in my attempts. When I try to set the headers in the request the HttpConverter informs me: Addition of the standard header Accept is not allowed. Please use the Restlet API instead. ... but I cannot find where in the Restlet API that I can set the Accept header. Could someone please point me to the appropriate place in the documentation. Regards Donald. ** Any personal or sensitive information contained in this email and attachments must be handled in accordance with the Victorian Information Privacy Act 2000, the Health Records Act 2001 or the Privacy Act 1988 (Commonwealth), as applicable. This email, including all attachments, is confidential. If you are not the intended recipient, you must not disclose, distribute, copy or use the information contained in this email or attachments. Any confidentiality or privilege is not waived or lost because this email has been sent to you in error. If you have received it in error, please let us know by reply email, delete it from your system and destroy any copies. ** -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=1345839
Re: Restlet 1.1.3
Thanks Thierry, I have that source but unfortunately it does not include the ant build script. The readme states that the souce is provided so that developers can associate class files with source files while debugging. I suspect that whatever builds the zip file only includes some file patterns and that does not include build.xml. There may be other files associated with the build of which I am unaware. Regards Donald. Thierry Boileau thierry.boileau@ noelios.com To discuss@restlet.tigris.org 27/02/09 07:24 PM cc Subject Please respond to Re: Restlet 1.1.3 discuss disc...@restlet. tigris.org Hello Donald, Is it possible to make a download of Restlet 1.1.3 available that includes all the source code? Well, if you download the zip file or the installer for Windows (from this page http://www.restlet.org/downloads/), you get all the sources in the src directory. best regards, Thierry Boileau Hi Thierry, Is it possible to make a download of Restlet 1.1.3 available that includes all the source code? I have been unable to connect to the SVN site from work. I cannot (or don't know how to) set up a proxy for the svn client we are using. I would like the source because we are using a backport of Restlet to JDK 1.4. We are currently using Restlet 1.1.1 which we have backported ourselves. Thanks Donald. ** Any personal or sensitive information contained in this email and attachments must be handled in accordance with the Victorian Information Privacy Act 2000, the Health Records Act 2001 or the Privacy Act 1988 (Commonwealth), as applicable. This email, including all attachments, is confidential. If you are not the intended recipient, you must not disclose, distribute, copy or use the information contained in this email or attachments. Any confidentiality or privilege is not waived or lost because this email has been sent to you in error. If you have received it in error, please let us know by reply email, delete it from your system and destroy any copies. ** -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=1236155 -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=1237474 ** Any personal or sensitive information contained in this email and attachments must be handled in accordance with the Victorian Information Privacy Act 2000, the Health Records Act 2001 or the Privacy Act 1988 (Commonwealth), as applicable. This email, including all attachments, is confidential. If you are not the intended recipient, you must not disclose, distribute, copy or use the information contained in this email or attachments. Any confidentiality or privilege is not waived or lost because this email has been sent to you in error. If you have received it in error, please let us know by reply email, delete it from your system and destroy any copies. ** -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=1259365
PUT weirdness
Hi all, We are trying to PUT a JSON representation from an Ajax client to a restlet web service. The entity body that we recieve on the server has a null appended to it. Anyone know why are we getting the null? Regards Donald. This is being submitted by the Ajax client. PUT Request Headers Host: localhost:9082 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9.0.6) Gecko/2009011913 Firefox/3.0.6 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive X-Qooxdoo-Response-Type: application/json Pragma: no-cache Cache-Control: no-cache Content-Type: application/json; charset=UTF-8 Referer: http://localhost:9082/RATClient/qooxdoo-0.8-sdk/application/inputform/source/index.html Content-Length: 153 entity-body {meta:{method:PUT,tunnel:null},form:{ffName:,ffType:null,ffVariables:null,ffFunction:,ffMinSize:,ffMaxSize:,ffReturn:}} In the server side java code we call ... this.getRequest().getEntity().getText(); and get ... { meta: { method:PUT, tunnel:null }, form: { ffName:, ffType:null, ffVariables:null, ffFunction:, ffMinSize:, ffMaxSize:, ffReturn: } }: null Where does the : null come from? ** Any personal or sensitive information contained in this email and attachments must be handled in accordance with the Victorian Information Privacy Act 2000, the Health Records Act 2001 or the Privacy Act 1988 (Commonwealth), as applicable. This email, including all attachments, is confidential. If you are not the intended recipient, you must not disclose, distribute, copy or use the information contained in this email or attachments. Any confidentiality or privilege is not waived or lost because this email has been sent to you in error. If you have received it in error, please let us know by reply email, delete it from your system and destroy any copies. ** -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=1137798
Re: PUT weirdness
Hi again, Found the problem. getLogger().log(Level.INFO, submitted json=(( + json + ))); outputs the following: submitted json=((...some valid JSON text...)): null Conclusion: java.util.logging.Logger.log(Level level, String msg) adds the : null How helpful of it. Regards Donald. Donald S Strong donald.str...@tr ansport.vic.gov.a To udiscuss@restlet.tigris.org cc 11/02/09 05:34 PM Subject PUT weirdness Please respond to discuss disc...@restlet. tigris.org Hi all, We are trying to PUT a JSON representation from an Ajax client to a restlet web service. The entity body that we recieve on the server has a null appended to it. Anyone know why are we getting the null? Regards Donald. ** Any personal or sensitive information contained in this email and attachments must be handled in accordance with the Victorian Information Privacy Act 2000, the Health Records Act 2001 or the Privacy Act 1988 (Commonwealth), as applicable. This email, including all attachments, is confidential. If you are not the intended recipient, you must not disclose, distribute, copy or use the information contained in this email or attachments. Any confidentiality or privilege is not waived or lost because this email has been sent to you in error. If you have received it in error, please let us know by reply email, delete it from your system and destroy any copies. ** -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=1137904
Re: Returning data after PUT/POST
Hi Jean-Philippe, If I want to add a resource named car I perform a PUT on a url like http://localhost/myapp/car/ instead of http://localhost/myapp/car/15. I agree with Rhett, use POST and then GET. POST http://localhost/myapp/car creates the car object with a new ID and redirects to the URI GET http://localhost/myapp/car/15 returns the car object with ID 15 I've also noticed that to return a list of some data such as car the typical method is to implement a second resource cars. Perhaps its a matter of taste but I would think it would be simpler for the client user to assume if you do not enter an ID or other search parameter into the URI then it implies a catch all. Would not this be simpler? What are the realistic benefits to actually creating another resource cars? A single car and a list of cars are logicaly different resources; the structures they return are quite different. A list of cars will probably contain many URIs, each refering to a single car. eg. cars bodystyle=coupe car name=Bob's car refid=/myapp/car/15 / car name=Bert's car refid=/myapp/car/16 / car name=Ernie's car refid=/myapp/car/132 / /cars You may have other resources that also refer to the car URIs. GET http://localhost/myapp/vehicles returns a list of all bike, car and truck objects. Lastly, is there a standard way to simplify creating resources so that performing GET on http://localhost/myapp/car/bodystyle/coupe doesn't require implementing a separate resource from http://localhost/myapp/car? Instead the /bodystyle/coupe part of the URI just becomes a search parameter of the car resource? You can use the same resource implementation if it takes parameters. Theoretically these are different resources, but in practice they can use the same implementation class. GET http://localhost/myapp/cars returns a list of all car objects GET http://localhost/myapp/cars?bodystyle=coupe returns all car objects with body style coupe GET http://localhost/myapp/cars?color=blue returns all blue car objects Regards Donald. ** Any personal or sensitive information contained in this email and attachments must be handled in accordance with the Victorian Information Privacy Act 2000, the Health Records Act 2001 or the Privacy Act 1988 (Commonwealth), as applicable. This email, including all attachments, is confidential. If you are not the intended recipient, you must not disclose, distribute, copy or use the information contained in this email or attachments. Any confidentiality or privilege is not waived or lost because this email has been sent to you in error. If you have received it in error, please let us know by reply email, delete it from your system and destroy any copies. ** -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=1040074