0
Ich habe eine Locke Anfrage wie unterConverting curl Anfrage an Java
curl --header "Content-Type: application/json" -X POST http://192.168.10.33:2003/jobs --data '{"path": "./examples/target/scala-2.10/mist_examples_2.10-0.0.2.jar", "className": "SimpleContext$", "parameters": {"digits": [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]}, "externalId": "12345678", "namespace": "foo"}'
ich es java konvertieren wollen, so mache ich so etwas wie
Client client= Client.create();
WebResource resource = client.resource("http://192.168.10.33:2003/jobs");
String response = resource.type(MediaType.APPLICATION_JSON_TYPE).post(/*not sure what to do here*/);
so wie kann ich über curl Karte Anfrage an Java?
Mögliches Duplikat [ROTATION Anfrage HTTP-Request-Java Konvertieren] (http://stackoverflow.com/questions/18636567/converting-curl-request-to-http-request-java) – Erik
@Erik denke ich, es ist nicht vollständig ähnlich wie du sagst. Ich benutze 'WebResource' hier, was sie nicht zu tun scheinen. Wir müssen 'WebResource' verwenden, da es überall in der Software verwendet wird. – eatSleepCode
Mögliches Duplikat von [HTTP POST mit JSON in Java] (http://stackoverflow.com/questions/7181534/http-post-using-json-in-java) – Joe