use of com.jd.httpservice.converters.JsonResponseConverter in project jdchain-core by blockchain-jd-com.
the class ParticipantInactive method update.
public WebResponse update() throws Exception {
String url = (secure ? "https://" : "http://") + host + ":" + port + "/management/delegate/updateparticipant";
HttpPost httpPost = new HttpPost(url);
List<BasicNameValuePair> params = new ArrayList<BasicNameValuePair>();
params.add(new BasicNameValuePair("ledgerHash", ledger));
params.add(new BasicNameValuePair("consensusHost", consensusHost));
params.add(new BasicNameValuePair("consensusPort", consensusPort + ""));
params.add(new BasicNameValuePair("consensusStorage", consensusStorage + ""));
params.add(new BasicNameValuePair("consensusSecure", consensusSecure + ""));
params.add(new BasicNameValuePair("shutdown", shutdown + ""));
httpPost.setEntity(new UrlEncodedFormEntity(params, "UTF-8"));
ServiceEndpoint endpoint = new ServiceEndpoint(host, port, secure);
if (secure) {
GmSSLProvider.enableGMSupport(participant.getSSLSecurity().getProtocol());
endpoint.setSslSecurity(participant.getSSLSecurity());
} else {
endpoint.setSslSecurity(new SSLSecurity());
}
HttpResponse response = ServiceConnectionManager.buildHttpClient(endpoint).execute(httpPost);
return (WebResponse) new JsonResponseConverter(WebResponse.class).getResponse(null, response.getEntity().getContent(), null);
}
use of com.jd.httpservice.converters.JsonResponseConverter in project jdchain-core by blockchain-jd-com.
the class ParticipantInactive method active.
public WebResponse active() throws Exception {
String url = (secure ? "https://" : "http://") + host + ":" + port + "/management/delegate/activeparticipant";
HttpPost httpPost = new HttpPost(url);
List<BasicNameValuePair> params = new ArrayList<BasicNameValuePair>();
params.add(new BasicNameValuePair("ledgerHash", ledger));
params.add(new BasicNameValuePair("consensusHost", host));
params.add(new BasicNameValuePair("consensusPort", consensusPort + ""));
params.add(new BasicNameValuePair("consensusStorage", consensusStorage));
params.add(new BasicNameValuePair("consensusSecure", consensusSecure + ""));
params.add(new BasicNameValuePair("remoteManageHost", synHost));
params.add(new BasicNameValuePair("remoteManagePort", synPort + ""));
params.add(new BasicNameValuePair("remoteManageSecure", synSecure + ""));
params.add(new BasicNameValuePair("shutdown", shutdown + ""));
httpPost.setEntity(new UrlEncodedFormEntity(params, "UTF-8"));
ServiceEndpoint endpoint = new ServiceEndpoint(host, port, secure);
if (secure) {
GmSSLProvider.enableGMSupport(participant.getSSLSecurity().getProtocol());
endpoint.setSslSecurity(participant.getSSLSecurity());
} else {
endpoint.setSslSecurity(new SSLSecurity());
}
HttpResponse response = ServiceConnectionManager.buildHttpClient(endpoint).execute(httpPost);
return (WebResponse) new JsonResponseConverter(WebResponse.class).getResponse(null, response.getEntity().getContent(), null);
}
Aggregations