like body option in php what is used in java? -
the body option used control body of entity enclosing request (e.g., put, post, patch). in php used this
$client->request('post', '/post', ['body' => $stream]);
but want use in java http://crawler.ankiti.com having json
{ "data": [ { "url": "http:\/\/crawler.ankiti.com\/?module=server&do=test", "method": "post", "options": { "body": "post body test 1" }, "target": "wo" }, { "url": "http:\/\/crawler.ankiti.com\/?module=server&do=test", "method": "post", "target": "wo", "options": { "body": "post body test 1", "form_params": { "name": "abhay", "surname": "aggarwal" }, "headers": { "login": "abhay", "password": "patparganj405" } } }, { "url": "http:\/\/crawler.ankiti.com\/?module=server&do=test", "method": "post", "target": "wo", "options": { "multipart": [ { "name": "file text", "path": "\/test\/file.txt" }, { "name": "file image", "path": "\/test\/file.jpg" } ] } } ], "errors": "", "meta": "" }
i want post string in body request present in json of url.
you can use httpservlet , follow procedure this.
response.setcontenttype("application/json"); // printwriter object response write required json object output stream printwriter out = response.getwriter(); // assuming json object **jsonobject**, perform following, return json object out.print(jsonobject); out.flush();
hope helps
Comments
Post a Comment