Commit dcb55a82 authored by Benoit Lavenier's avatar Benoit Lavenier

[enh] remote network : allow to post peer document as a text document

parent b01e13cb
......@@ -51,4 +51,6 @@ public interface NetworkRemoteService extends Service {
WebsocketClientEndpoint addPeerListener(Peer peer, WebsocketClientEndpoint.MessageListener listener, boolean autoReconnect);
String postPeering(Peer peer, NetworkPeering peering);
String postPeering(Peer peer, String peeringDocument);
}
......@@ -176,22 +176,26 @@ public class NetworkRemoteServiceImpl extends BaseRemoteServiceImpl implements N
@Override
public String postPeering(Peer peer, NetworkPeering peering) {
Preconditions.checkNotNull(peer);
Preconditions.checkNotNull(peering);
return postPeering(peer, peering.toString());
}
@Override
public String postPeering(Peer peer, String peeringDocument) {
Preconditions.checkNotNull(peer);
Preconditions.checkNotNull(peeringDocument);
// http post /tx/process
HttpPost httpPost = new HttpPost(getPath(peer, URL_PEERING_PEERS));
String document = peering.toString();
if (log.isDebugEnabled()) {
log.debug(String.format(
"Will send peering document: \n------\n%s------",
document));
peeringDocument));
}
List<NameValuePair> urlParameters = new ArrayList<NameValuePair>();
urlParameters.add(new BasicNameValuePair("peer", document));
urlParameters.add(new BasicNameValuePair("peer", peeringDocument));
try {
httpPost.setEntity(new UrlEncodedFormEntity(urlParameters));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment