Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>As I mentioned in <a href="https://stackoverflow.com/questions/165720/how-to-debug-restful-services#166269">this thread</a> I tend to use <a href="http://jersey.java.net/" rel="nofollow noreferrer">Jersey</a> which implements JAX-RS and comes with a nice REST client. The nice thing is if you implement your RESTful resources using JAX-RS then the Jersey client can reuse the entity providers such as for JAXB/XML/JSON/Atom and so forth - so you can reuse the same objects on the server side as you use on the client side unit test.</p> <p>For example <a href="http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-rest/src/test/java/org/apache/camel/rest/resources/EndpointsTest.java?revision=700513&amp;view=markup" rel="nofollow noreferrer">here is a unit test case</a> from the <a href="http://activemq.apache.org/camel/" rel="nofollow noreferrer">Apache Camel project</a> which looks up XML payloads from a RESTful resource (using the JAXB object Endpoints). The resource(uri) method is defined in <a href="http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-rest/src/test/java/org/apache/camel/rest/resources/TestSupport.java?revision=700513&amp;view=markup" rel="nofollow noreferrer">this base class</a> which just uses the Jersey client API.</p> <p>e.g. </p> <pre><code> clientConfig = new DefaultClientConfig(); client = Client.create(clientConfig); resource = client.resource("http://localhost:8080"); // lets get the XML as a String String text = resource("foo").accept("application/xml").get(String.class); </code></pre> <p>BTW I hope that future version of JAX-RS add a nice client side API along the lines of the one in Jersey</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload