Hey all, I am wondering if anyone has given thought to using REST / XPath as querying mechanism. That way you could have a URL that actually maps to a collection of records (objects, really) that meet a certain criteria and that are sorted a certain way. Mike Pence
I''ve seen that approach in the Java world. You have to be wary using it though, it opens you up to the possiblity of XPath Injection attacks. Similar to SQL Injection attacks in principle, not as potentially damaging though. -Steve http://www.stevelongdo.com On 1/20/06, Mike Pence <mike.pence@gmail.com> wrote:> > Hey all, > > I am wondering if anyone has given thought to using REST / XPath as > querying mechanism. That way you could have a URL that actually maps > to a collection of records (objects, really) that meet a certain > criteria and that are sorted a certain way. > > Mike Pence > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060120/6bc3abdc/attachment.html
Any Java projects doing this that spring to mind? On 1/20/06, Steve Longdo <steve.longdo@gmail.com> wrote:> I''ve seen that approach in the Java world. You have to be wary using it > though, it opens you up to the possiblity of XPath Injection attacks. > Similar to SQL Injection attacks in principle, not as potentially damaging > though. > > -Steve > http://www.stevelongdo.com > > > On 1/20/06, Mike Pence < mike.pence@gmail.com> wrote: > > > > Hey all, > > > > I am wondering if anyone has given thought to using REST / XPath as > > querying mechanism. That way you could have a URL that actually maps > > to a collection of records (objects, really) that meet a certain > > criteria and that are sorted a certain way. > > > > Mike Pence > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >
PMD - http://pmd.sf.net - does something like this in that you can query a source file''s Abstract Syntax Tree using XPath. Like this to get all fields with the name "foo": //FieldDeclaration[@Image=''foo''] It''s a bit esoteric - PMD is a Java static analysis tool - but, it seems to fit the question... Yours, Tom P.S. Disclaimer: I''m the PMD lead guy.> -----Original Message----- > From: rails-bounces@lists.rubyonrails.org > [mailto:rails-bounces@lists.rubyonrails.org] On Behalf Of Mike Pence > Sent: Friday, January 20, 2006 3:52 PM > To: rails@lists.rubyonrails.org > Subject: Re: [Rails] REST API''s and querying a graph of objects > > > Any Java projects doing this that spring to mind? > > On 1/20/06, Steve Longdo <steve.longdo@gmail.com> wrote: > > I''ve seen that approach in the Java world. You have to be > wary using > > it though, it opens you up to the possiblity of XPath Injection > > attacks. Similar to SQL Injection attacks in principle, not as > > potentially damaging though. > > > > -Steve > > http://www.stevelongdo.com > > > > > > On 1/20/06, Mike Pence < mike.pence@gmail.com> wrote: > > > > > > Hey all, > > > > > > I am wondering if anyone has given thought to using REST > / XPath as > > > querying mechanism. That way you could have a URL that > actually maps > > > to a collection of records (objects, really) that meet a certain > > > criteria and that are sorted a certain way. > > > > > > Mike Pence > > > _______________________________________________ > > > Rails mailing list > > > Rails@lists.rubyonrails.org > > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/> rails >
Thibaut Barrère
2006-Jan-20 23:31 UTC
[Rails] REST API''s and querying a graph of objects
> Any Java projects doing this that spring to mind?Hi Mike I''ve been using JXPath ( http://jakarta.apache.org/commons/jxpath/ ) for that purpose two years ago. --Thibaut ==================== The org.apache.commons.jxpath package defines a simple interpreter of an expression language called XPath. JXPath applies *XPath* expressions to graphs of objects of all kinds: JavaBeans, Maps, Servlet contexts, DOM etc, including mixtures thereof. Consider this example: Address address = (Address)JXPathContext.newContext(vendor). getValue("locations[address/zipCode=''90210'']/address"); This XPath expression is equvalent to the following Java code: Address address = null; Collection locations = vendor.getLocations(); Iterator it = locations.iterator(); while (it.hasNext()){ Location location = (Location)it.next(); String zipCode = location.getAddress().getZipCode(); if (zipCode.equals("90210")){ address = location.getAddress(); break; } } -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060120/6bd391c0/attachment.html