redesign swing UI to support new index creator mechanism

git-svn-id: https://osmand.googlecode.com/svn/trunk@510 e29c36b1-1cfa-d876-8d93-3434fc2bb7b8
This commit is contained in:
Victor Shcherb 2010-09-19 10:42:45 +00:00
parent ce36617681
commit dc8352bfac

View file

@ -37,11 +37,6 @@ public class DownloaderIndexFromGoogleCode {
// IndexConstants.TRANSPORT_TABLE_VERSION + "" }); //$NON-NLS-1$ // IndexConstants.TRANSPORT_TABLE_VERSION + "" }); //$NON-NLS-1$
// System.out.println(indexFiles); // System.out.println(indexFiles);
// deleteFileFromGoogleDownloads("Bahrain_0.trans.odb", "vics001", "kfvth85");
deleteFileFromGoogleDownloads("Bahrain_0.trans.odb", "vics001", "cH5mK8aA5kd3");
} }
private static Map<String, String> getContent(String[] ext, String[] version) { private static Map<String, String> getContent(String[] ext, String[] version) {
@ -109,17 +104,16 @@ public class DownloaderIndexFromGoogleCode {
// that method doesn't work !!! // that method doesn't work !!!
public static String deleteFileFromGoogleDownloads(String fileName, String userName, String password) throws IOException { public static String deleteFileFromGoogleDownloads(String fileName, String token, String pagegen, String cookie) throws IOException {
// prepare data // prepare data
String urlText = "http://code.google.com/p/osmand/downloads/delete.do?name="+fileName; String urlText = "http://code.google.com/p/osmand/downloads/delete.do?name="+fileName; //$NON-NLS-1$
System.out.println(urlText); System.out.println(urlText);
StringBuilder requestBody = new StringBuilder(); StringBuilder requestBody = new StringBuilder();
requestBody. requestBody.
append("token=cc4e4cffba19a6107d2161f85c71631f"). append("token=").append(token). //$NON-NLS-1$
// append("token=").append(Base64.encode(token.getBytes("UTF-8"))). append("&pagegen=").append(pagegen). //$NON-NLS-1$
append("&pagegen=1283283182175778"). append("&filename=").append(fileName). //$NON-NLS-1$
append("&filename=").append(fileName). append("&delete=Delete+download"); //$NON-NLS-1$
append("&delete=Delete+download");
System.out.println(requestBody); System.out.println(requestBody);
// getting url // getting url
@ -127,11 +121,11 @@ public class DownloaderIndexFromGoogleCode {
HttpURLConnection connection = (HttpURLConnection) url.openConnection(); HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setConnectTimeout(15000); connection.setConnectTimeout(15000);
connection.setRequestMethod("POST"); connection.setRequestMethod("POST"); //$NON-NLS-1$
// String token = userName + ":" + password; //$NON-NLS-1$ // String token = userName + ":" + password; //$NON-NLS-1$
// connection.addRequestProperty("Authorization", "Basic " + Base64.encode(token.getBytes("UTF-8"))); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ // connection.addRequestProperty("Authorization", "Basic " + Base64.encode(token.getBytes("UTF-8"))); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); //$NON-NLS-1$//$NON-NLS-2$
connection.setRequestProperty("Content-Length", requestBody.length()+""); connection.setRequestProperty("Content-Length", requestBody.length()+""); //$NON-NLS-1$ //$NON-NLS-2$
connection.setDoInput(true); connection.setDoInput(true);
connection.setDoOutput(true); connection.setDoOutput(true);