Re: Trailing slashes in dir names in Restlet's Maven repo
Hi Aron, Thierry has just deployed a new version of our Web site based on Restlet 2.0. The trailing slashes are now correctly displayed for our Maven repository! Best regards, Jerome Louvel -- Restlet ~ Founder and Lead developer ~ http://www.restlet.org Noelios Technologies ~ Co-founder ~ http://www.noelios.com Jerome Louvel a écrit : Hi Aron, Thanks for this report. This is fine regarding addition of Restlet to this MVN repo browser site. Regarding the missing trailing slash, I've just fixed it in SVN trunk. This also speeds up navigation as it prevents one extra client redirection from happening! This is checked in SVN trunk and will take a bit more time to be propagated in our production environment. 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 : Aron Roberts [mailto:a...@socrates.berkeley.edu] Envoyé : mercredi 27 mai 2009 00:57 À : discuss@restlet.tigris.org Objet : Trailing slashes in dir names in Restlet's Maven repo A trivial note regarding the Web view of Restlet's Maven repository: There appears to be a widely-followed convention for directory/index pages of Maven repositories on the Web, to include trailing slashes after directory names - at least per a quick check of several of the sites listed here, including Apache and Java.net: http://www.mvnbrowser.com/repositories.html#REPO1 There's a handy, if informal, third-party Maven repository browser at http://www.mvnbrowser.com/index.html that screen-scrapes those directory/index pages at periodic intervals to maintain a searchable directory of Maven-accessible JAR files and (possibly) other relevant project artifacts. After nominating the Restlet Maven repository for addition to this browser, at first-run, their HTML scraper code ran up against this minuscule difference, and thus wasn't able to initially index its files, as per the correspondence below. While they'll almost certainly work around this minor issue, this is to nonetheless mention it. FYI, Aron P.S. to Jerome: I realize that I didn't ask permission beforehand to submit Restlet's Maven repository to this third-party repository browser. While my intent in doing so was to further publicize Restlet, as well as to make it easier for developers using Maven to build Restlet-related projects, please let me know if you'd prefer that the repository not be included. Thanks! --- From: MvnBrowser i...@mvnbrowser.com To: Aron Roberts a...@socrates.berkeley.edu Subject: Re: Suggested addition to Maven repositories list Date: Tue, 26 May 2009 17:55:24 +0200 Hi Aron, Thanks for the tip. I tried adding the repository to our database. However, our current HTML scraper is unable to read the content. It's a minor difference but the listing of directories is a bit different from other repositories. The links that point to directories usually end with a slash but not at this site. I'll have to see how I can work around this. regards, Erwin On May 19, 2009, at 8:14 PM, Aron Roberts wrote: Hi, A suggested addition to your Maven repositories list: http://maven.restlet.org A composite description of the Restlet framework, available through this repository, by cribbing from the project's wiki: Restlet is a lightweight, comprehensive REST framework for Java that has been under active development since 2006. It supports all REST concepts (Resource, Representation, Connector, Component, etc.) and is suitable for both client and server Web applications. Restlet supports major Web standards like HTTP, SMTP, XML, JSON, WADL, and Atom. Many extensions are also available to integrate with Servlet, Spring, Jetty, Grizzly, Simple, JAXB, JAX-RS, JiBX, Velocity, or FreeMarker. A GWT port is also available. FYI, Aron Roberts Information Services and Technology . Warren Hall, 2195 Hearst University of California, Berkeley, CA 94720-4876 USA a...@socrates.berkeley.edu . +1 510-642-5974 . fax 510-643-5385 http://purl.org/net/aron -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=23545 25 -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2357438 -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2361177
RE: from the org.restlet.data.Request, get the HttpServletRequest
thanks Jerome, that was perfect! I'm using the latest Version 2.0 Milestone 3 . ;-) -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2361226
Dynamic restlet/routing discovery
Hi All, Firstly, as a user of the restlet toolkit for over a year now I'd like to say a big thanks to the authors for developing such a complete and useful implementation. You've saved me many a late night :-) I have been involved in developing a product which is used to manage social networking data (using opensocial) which uses Jini to locate the services it needs to service requests for customers. The product has been developed for over a year now and the combination of restlet service invocation and dynamic service discovery and routing means we can add new services, and remove old ones on the fly without impact, or having to bring the system down. When we started developing the product, due to a lack of time, and other requirements we used most of our own code to do things which restlet now does out of the box. In moving forward we would like to develop an extension to the restlet architecture which is more aligned with the way restlet has been developed. We indend to make the toolkit freely available, and we also intend to provide hooks into rio for dynamic service SLA management. Best regards, --Jools -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2361213
Can I use Jetty and/or Tomcat with Restlet?
I hope this is server agnostic. Is there a recommended server that I should use? -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2361147
JDBC Connection Singleton and Concurrency
Hi In order to connect to a MySQL Database I use the singleton pattern to get a Connection Object. I'm wondering if there will be any concurrency problems with that if I have several hundred requests per minute. Is there some sort of best practice for database connection? I've heard about connection pools but I'm not quite sure when and how to use it. thx in advance Jean LEMARC -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2361122
RE: Re: Re: Last-Modified Header
Hi Rob, Actually, we did try to facilitate this use case in Restlet 2.0. We introduced the RepresentationInfo class, subclass of Variant and parent of Representation. It contains two properties, modificationDate and tag, necessary for conditional processing. In ServerResource, there are also getInfo() and getInfo(Variant) methods which return RepresentationInfo instances. By default, it calls get() and get(Variant) methods, so it is really an optional optimization. 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 : Rob Heittman [mailto:rob.heitt...@solertium.com] Envoyé : mercredi 10 juin 2009 19:23 À : discuss@restlet.tigris.org Objet : Re: Re: Re: Last-Modified Header I can't imagine how the framework would be able to figure that out on its own without being able to examine the Representation ... chicken, egg, chicken, egg. Still, I understand the concern if Representations are expensive to generate. I wonder if the conditional logic fetches the entity body if the last modified date has not changed. If it doesn't (and it probably shouldn't) then you could just craft a Representation subclass in which the expensive stuff only happens when the entity body is actually read -- the headers should be enough to tell the engine how to handle the conditional GET. ** disclaimer ** I really don't know if that approach works, but I think it ought to. - Rob On Wed, Jun 10, 2009 at 1:11 PM, Sherif Ahmed sherifah...@hotmail.com wrote: Cool, This works as you indicate. However implementing this way has a downside. Would be nice that the framework could take care of sending a 304 even without having to get a concrete Representation which has a date set. The idea is to avoid creating a Representation if the Resource has not changed and Restlet could send a 304 directly thus avoiding the cost that may be associated with building a Representation. -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447 http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2361 007 dsMessageId=2361007 -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2361273
RE: JDBC Connection Singleton and Concurrency
Hi Jean, Usage of connection pools sounds like a good idea in your case. Have a look at this project: http://commons.apache.org/dbcp/ 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é : jeudi 11 juin 2009 02:56 À : discuss@restlet.tigris.org Objet : JDBC Connection Singleton and Concurrency Hi In order to connect to a MySQL Database I use the singleton pattern to get a Connection Object. I'm wondering if there will be any concurrency problems with that if I have several hundred requests per minute. Is there some sort of best practice for database connection? I've heard about connection pools but I'm not quite sure when and how to use it. thx in advance Jean LEMARC -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=23611 22 -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2361274
RE: Can I use Jetty and/or Tomcat with Restlet?
Hi there, No special recommendation. We just leverage the Servlet API so any recent Servlet container should work. 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é : jeudi 11 juin 2009 05:35 À : discuss@restlet.tigris.org Objet : Can I use Jetty and/or Tomcat with Restlet? I hope this is server agnostic. Is there a recommended server that I should use? -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=23611 47 -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2361270
Re: Re: Re: Last-Modified Header
Excellent. I missed that one in the mix of ServerResource newness! I'll try it out on some expensive Representations and publish a benchmark. On Thu, Jun 11, 2009 at 9:23 AM, Jerome Louvel jerome.lou...@noelios.comwrote: Hi Rob, Actually, we did try to facilitate this use case in Restlet 2.0. We introduced the RepresentationInfo class, subclass of Variant and parent of Representation. It contains two properties, “modificationDate” and “tag”, necessary for conditional processing. In ServerResource, there are also getInfo() and getInfo(Variant) methods which return RepresentationInfo instances. By default, it calls get() and get(Variant) methods, so it is really an optional optimization. Best regards, Jerome Louvel -- Restlet ~ Founder and Lead developer ~ http://www.restlet.org Noelios Technologies ~ Co-founder ~ http://www.noelios.com *De :* Rob Heittman [mailto:rob.heitt...@solertium.com] *Envoyé :* mercredi 10 juin 2009 19:23 *À :* discuss@restlet.tigris.org *Objet :* Re: Re: Re: Last-Modified Header I can't imagine how the framework would be able to figure that out on its own without being able to examine the Representation ... chicken, egg, chicken, egg. Still, I understand the concern if Representations are expensive to generate. I wonder if the conditional logic fetches the entity body if the last modified date has not changed. If it doesn't (and it probably shouldn't) then you could just craft a Representation subclass in which the expensive stuff only happens when the entity body is actually read -- the headers should be enough to tell the engine how to handle the conditional GET. ** disclaimer ** I really don't know if that approach works, but I think it ought to. - Rob On Wed, Jun 10, 2009 at 1:11 PM, Sherif Ahmed sherifah...@hotmail.com wrote: Cool, This works as you indicate. However implementing this way has a downside. Would be nice that the framework could take care of sending a 304 even without having to get a concrete Representation which has a date set. The idea is to avoid creating a Representation if the Resource has not changed and Restlet could send a 304 directly thus avoiding the cost that may be associated with building a Representation. -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2361007 -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2361296
RE: Re: Re: Last-Modified Header
Cool! This class definitely needs more tests and feed-back to be as perfect as possible when 2.0 RC1 goes out. Cheers, Jerome De : Rob Heittman [mailto:rob.heitt...@solertium.com] Envoyé : jeudi 11 juin 2009 16:06 À : discuss@restlet.tigris.org Objet : Re: Re: Re: Last-Modified Header Excellent. I missed that one in the mix of ServerResource newness! I'll try it out on some expensive Representations and publish a benchmark. On Thu, Jun 11, 2009 at 9:23 AM, Jerome Louvel jerome.lou...@noelios.com wrote: Hi Rob, Actually, we did try to facilitate this use case in Restlet 2.0. We introduced the RepresentationInfo class, subclass of Variant and parent of Representation. It contains two properties, modificationDate and tag, necessary for conditional processing. In ServerResource, there are also getInfo() and getInfo(Variant) methods which return RepresentationInfo instances. By default, it calls get() and get(Variant) methods, so it is really an optional optimization. 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: Rob Heittman [mailto:rob.heitt...@solertium.com] Envoy頺 mercredi 10 juin 2009 19:23 : discuss@restlet.tigris.org Objet: Re: Re: Re: Last-Modified Header I can't imagine how the framework would be able to figure that out on its own without being able to examine the Representation ... chicken, egg, chicken, egg. Still, I understand the concern if Representations are expensive to generate. I wonder if the conditional logic fetches the entity body if the last modified date has not changed. If it doesn't (and it probably shouldn't) then you could just craft a Representation subclass in which the expensive stuff only happens when the entity body is actually read -- the headers should be enough to tell the engine how to handle the conditional GET. ** disclaimer ** I really don't know if that approach works, but I think it ought to. - Rob On Wed, Jun 10, 2009 at 1:11 PM, Sherif Ahmed sherifah...@hotmail.com wrote: Cool, This works as you indicate. However implementing this way has a downside. Would be nice that the framework could take care of sending a 304 even without having to get a concrete Representation which has a date set. The idea is to avoid creating a Representation if the Resource has not changed and Restlet could send a 304 directly thus avoiding the cost that may be associated with building a Representation. -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447 http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2361007 dsMessageId=2361007 -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2361307
2.0m3 and content negotiation
Hello, what's the status of the content negotiation bug in 2.0m3? is this fixed in current snapshot? I'm still getting application/octet-stream for all media types other than xml with code like this: @Get public Representation represent() throws ResourceException { // Build and return representation here } Thanks -- Fabián Mandelbaum IS Engineer -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2361317
Restlet with a large dataset
Hello, I have a large dataset (a few millions of rows). I am very interesting for the use of restlet framework on my large dataset. Is it possible to transfer a large response by streaming without having memory problems on the server side ? That means, in my case, to be able to make streaming from the ResulSet coming from the database to the output by using the JSON or XML representation. Thanks a lot, J-Christophe -- Jean-Christophe Malapert CNES/DCT/PS/TVI 18, Av. Edouard Belin 31400 Toulouse Cedex 9 France Tel : (+33/0)5 61 28 14 45 -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2361314
Restlet with a large dataset
Hello, I have a large dataset (a few millions of rows). I am very interesting for the use of restlet framework on my large dataset. Is it possible to transfer a large response by streaming without having memory problems on the server side ? That means, in my case, to be able to make streaming from the ResulSet coming from the database to the output by using the representation. Do you have an example somewhere ? Thanks a lot, J-christophe -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2361309
RE: 2.0m3 and content negotiation
Hi Fabian, This one has just been fixed in SVN trunk but there more issues pending. 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 : Fabian Mandelbaum [mailto:fmandelb...@gmail.com] Envoyé : jeudi 11 juin 2009 17:05 À : discuss@restlet.tigris.org Objet : 2.0m3 and content negotiation Hello, what's the status of the content negotiation bug in 2.0m3? is this fixed in current snapshot? I'm still getting application/octet-stream for all media types other than xml with code like this: @Get public Representation represent() throws ResourceException { // Build and return representation here } Thanks -- Fabián Mandelbaum IS Engineer -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2361317 -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2361347
Re: Restlet with a large dataset
Hi Jean-Christophe, You should be able to keep the memory usage small if you write to the OutputStream directly, using an OutputRepresentation: return new OutputRepresentation(MediaType.APPLICATION_XML) { @Override public void write(OutputStream out) throws IOException { /* ... */ } }; I'd avoid DomRepresentation for a large set, simply because of the memory usage of the DOM model. Instead, writing the XML fragments by hand as you iterate through the ResultSet would probably work better in this case. Best wishes, Bruno. Jean-Christophe Malapert wrote: Hello, I have a large dataset (a few millions of rows). I am very interesting for the use of restlet framework on my large dataset. Is it possible to transfer a large response by streaming without having memory problems on the server side ? That means, in my case, to be able to make streaming from the ResulSet coming from the database to the output by using the JSON or XML representation. Thanks a lot, J-Christophe -- Jean-Christophe Malapert CNES/DCT/PS/TVI 18, Av. Edouard Belin 31400 Toulouse Cedex 9 France Tel : (+33/0)5 61 28 14 45 -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2361314 -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2361350
Trouble Getting Query Parameters
I'm new to Restlet and I'm having trouble accessing the query parameters in my ServerResource. I'm using a URI comparable to: http://localhost:8080/myapp/zipcodes/{zip}/locations/{location}/users/{user}?callback=someCallbackFunction The client is written in EXT.js and is expecting me to wrap the json object in a function with a name the 'callback' query parameter specifies. I can't for the life of me understand what I'm doing wrong in trying to access this query parameter. My application class is similar to this: package com.myapp.applications; import org.restlet.Application; import org.restlet.Context; import org.restlet.Restlet; import org.restlet.routing.Router; import com.myapp.resources.ZipsLocsUsersResource; public class MyApplication extends Application { public MyApplication() { } public MyApplication(Context context) { super(context); } @Override public Restlet createRoot() { // Create a router Restlet that routes each call to a Router router = new Router(getContext()); router.attach(/myapp/zipcodes/{zip}/locations/{location}/users/{user}, ZipsLocsUsersResource.class); return router; } } And my ServerResource class is similar to this: package com.myapp.resources; import org.restlet.data.Form; import org.restlet.data.Parameter; import org.restlet.data.Reference; import org.restlet.data.Request; import org.restlet.representation.Representation; import org.restlet.representation.StringRepresentation; import org.restlet.resource.Get; import org.restlet.resource.ServerResource; import com.myapp.representation.JsonRepresentation; public class ZipsLocsUsersResource extends ServerResource { private String zip; private String location; private String user; private String callback; @Get public Representation represent() { this.zip = (String) getRequest().getAttributes().get(zip); this.location = (String) getRequest().getAttributes().get(location); this.user = (String) getRequest().getAttributes().get(user); Form form = getRequest().getResourceRef().getQueryAsForm(); this.callback = form.getFirstValue(callback); String jsonString = {user:\ + this.user + \, loc: \ + this.location + \, zip:\ + this.zip + \}; if (this.callback != null) { jsonString = this.callback + ( + jsonString + ); } Representation result = new JsonRepresentation(jsonString); return result; } } When I run with a debugger, my form always ends up being empty... and when I dig through the request I can't find the parameters anywhere. I am wanting this parameter to be optional. I'm not sure if I'm setting my application up wrong, or if I'm trying to get the parameters the wrong way? This is on a GET request, and everywhere I look, folks seem to not be able to access the query parameters until they try the getRequest().getResourceRef().getQueryAsForm() way of doing it. Thanks in advance for your help! Regards, Andrew -- View this message in context: http://n2.nabble.com/Trouble-Getting-Query-Parameters-tp3063239p3063239.html Sent from the Restlet Discuss mailing list archive at Nabble.com. -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2361378
Re: Trouble Getting Query Parameters
I'm starting to understand what may be going on... when EXT.js makes the request for my URI, the query string looks like this: ?_dc=1244741620627callback=stcCallback1001 And the org.restlet.engine.util.FormReader is not able to parse the parameters. Here's the error: 06/11/2009 11:33:40.640 [http-0.0.0.0-8080-1] [STDERR] [ERROR] Jun 11, 2009 11:33:40 AM org.restlet.engine.util.FormReader addParameters WARNING: Unable to parse a form parameter. Skipping the remaining parameters. java.io.IOException: Empty parameter name detected. Please check your form data at org.restlet.engine.util.FormReader.readNextParameter(FormReader.java:239) at org.restlet.engine.util.FormReader.addParameters(FormReader.java:132) at org.restlet.engine.util.FormUtils.parse(FormUtils.java:302) at org.restlet.data.Form.init(Form.java:137) at org.restlet.data.Form.init(Form.java:121) at org.restlet.data.Form.init(Form.java:94) at org.restlet.data.Reference.getQueryAsForm(Reference.java:1375) I'm not sure how to get around this... Maybe my best option is to try and modify what EXT.js is appending on my URI when it makes the request? Any thoughts? Thanks in advance for your help! ~ Andrew -- View this message in context: http://n2.nabble.com/Trouble-Getting-Query-Parameters-tp3063239p3063444.html Sent from the Restlet Discuss mailing list archive at Nabble.com. -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2361391
Re: Trouble Getting Query Parameters
I just did a test with curl both with and without that initial ampersand in there... yes, that ampersand is causing the parsing problem. Since this is EXT.js creating this, I guess I'll have to figure out a way to change it or something. Should the FormReader be able to handle an initial ampersand? Is that a bug, and if so, should I file it? Thanks for your help! -- View this message in context: http://n2.nabble.com/Trouble-Getting-Query-Parameters-tp3063239p3063559.html Sent from the Restlet Discuss mailing list archive at Nabble.com. -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2361395