Package smartrics.rest.client

Examples of smartrics.rest.client.RestClientImpl.execute()


        RestRequest req = new RestRequest();
        req.setBody("name=n&data=d1");
        req.setResource("/resources/");
        req.setMethod(Method.Post);
        req.addHeader("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8");
        RestResponse res = c.execute("http://localhost:8765", req);
        System.out.println("=======>\n" + res + "\n<=======");
    }

    public static void postXml(String[] args) {
        RestClient c = new RestClientImpl(new HttpClient());
View Full Code Here


        RestRequest req = new RestRequest();

        req.setBody("<resource><name>n</name><data>d1</data></resource>");
        req.setResource("/resources/");
        req.setMethod(Method.Post);
        RestResponse res = c.execute("http://localhost:8765", req);
        System.out.println("=======>\n" + res + "\n<=======");

        String loc = res.getHeader("Location").get(0).getValue();
        req.setResource(loc + ".json");
        req.setMethod(Method.Get);
View Full Code Here

        System.out.println("=======>\n" + res + "\n<=======");

        String loc = res.getHeader("Location").get(0).getValue();
        req.setResource(loc + ".json");
        req.setMethod(Method.Get);
        res = c.execute("http://localhost:8765", req);
        System.out.println("=======>\n" + res + "\n<=======");

        req.setMethod(Method.Put);
        req.setBody("<resource><name>another name</name><data>another data</data></resource>");
        res = c.execute("http://localhost:8765", req);
View Full Code Here

        res = c.execute("http://localhost:8765", req);
        System.out.println("=======>\n" + res + "\n<=======");

        req.setMethod(Method.Put);
        req.setBody("<resource><name>another name</name><data>another data</data></resource>");
        res = c.execute("http://localhost:8765", req);
        System.out.println("=======>\n" + res + "\n<=======");

        req.setResource("/resources/");
        req.setMethod(Method.Get);
        res = c.execute("http://localhost:8765", req);
View Full Code Here

        res = c.execute("http://localhost:8765", req);
        System.out.println("=======>\n" + res + "\n<=======");

        req.setResource("/resources/");
        req.setMethod(Method.Get);
        res = c.execute("http://localhost:8765", req);
        System.out.println("=======>\n" + res + "\n<=======");

        req.setMethod(Method.Delete);
        req.setResource(loc);
        res = c.execute("http://localhost:8765", req);
View Full Code Here

        res = c.execute("http://localhost:8765", req);
        System.out.println("=======>\n" + res + "\n<=======");

        req.setMethod(Method.Delete);
        req.setResource(loc);
        res = c.execute("http://localhost:8765", req);
        System.out.println("=======>\n" + res + "\n<=======");
    }

}
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.