1 2 3 4 5 6 7 8 9 10 11 12 13 | <bean class="org.apache.wink.spring.Registrar"> <property name="classes"> <set value-type="java.lang.Class"> <value>org.openengine.example.TransactionResource</value> </set> </property> <property name="instances"> <set> <ref bean="resources.TransactionResource"/> <ref bean="providers.myprovider"/> </set> </property> </bean> |
1 2 3 4 5 6 7 8 | // create the rest client instance RestClient client = new RestClient(); // create the resource instance to interact with Resource resource = client.resource("http://localhost:8080/HelloWorld"); // perform a GET on the resource. The resource will be returned as plain text String response = resource.accept("text/plain").get(String.class); |
1 2 3 4 5 6 7 8 9 10 | // create the rest client instance RestClient client = new RestClient(); // create the resource instance to interact with Resource resource = client.resource("http://localhost:8080 "); // issue the request String response = resource.contentType("text/plain"). accept("text/plain"). post(String.class, "foo"); |
1 2 3 4 5 6 7 8 9 10 11 | // create the rest client instance RestClient client = new RestClient(); // create the resource instance to interact with Resource resource = client.resource("http://services.co"); AtomEntry request = getAtomEntry(); // issue the request AtomEntry response = resource.contentType("application/atom+xml"). accept("application/atom+xml"). post(AtomEntry.class, request); |
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |