@Override public IPayload requestFetchPayload(Map<String, String> branchHeads) { Payload payload = null; StringBuffer branchBuffer = new StringBuffer(); /* * Create a string to send to the geogit server in the form of: * BRANCH_NAME:UUID,... */ for (String branchName : branchHeads.keySet()) { branchBuffer.append(branchName + ":" + branchHeads.get(branchName) + ","); } String branches = branchBuffer.toString(); /* * remote the last ',' */ if (branches.length() > 0) { branches = branches.substring(0, branches.length() - 1); } /* * Use the http client to communicate with the server geogit */ DefaultHttpClient httpclient = new DefaultHttpClient(); try { HttpGet httpget = new HttpGet(location + "?branches=" + branches); HttpResponse response = httpclient.execute(httpget); HttpEntity entity = response.getEntity(); /* * The NetworkIO class knows how to translate an input stream of bytes into a payload * that GeoGit understands. */ payload = NetworkIO.receivePayload(entity.getContent()); } catch (Exception e) { e.printStackTrace(); } finally { httpclient.getConnectionManager().shutdown(); } return payload; }
private void NetworkIOSetup() { netIO = new NetworkIO(socket); netIO.setup(); }