ModeShape/modeshape — pull request #542 by rhauch (2012-10-01 13:38:16+00:00)
Title: MODE-1646 REST client can now be used to talk to 3.x and 2.x servers 

Because of the improvements/changes in the RESTful API in 3.0, using the REST client required using slightly different URLs to talk to 3.x vs 2.x servers. The reason is that the REST client still uses the older REST API, and the URL for the older API is different on 3.x servers.

Although it was not feasible to transparently and automatically discover the correct URL given the actual server the client talks to, it was possible to add a new method that does this. There is now a "validate(Server):Server" method on the IRestClient interface, and this method can be used to validate a Server instance with a normal URL (that is, excluding the API version qualifier) based upon the actual server. The method returns a new Server instance that should be used for all subsequent communications.

Note that clients that don't take advantage of this new method can still work, as long as the URL ends with "/v1" for 3.x servers.