| Line 18... |
Line 18... |
| 18 |
import com.google.gson.Gson;
|
18 |
import com.google.gson.Gson;
|
| 19 |
|
19 |
|
| 20 |
public class CatalogUploderToGAE implements Serializable {
|
20 |
public class CatalogUploderToGAE implements Serializable {
|
| 21 |
private static final long serialVersionUID = -326425176723602170L;
|
21 |
private static final long serialVersionUID = -326425176723602170L;
|
| 22 |
private static final String NAME_KEY = "name";
|
22 |
private static final String NAME_KEY = "name";
|
| 23 |
private static final String ID_KEY = "id";
|
23 |
private static final String ID_KEY = "id_long";
|
| 24 |
private static final String CATALOG_ID_KEY = "catalog_id";
|
24 |
private static final String CATALOG_ID_KEY = "catalog_id_long";
|
| 25 |
private static final String BRAND_KEY = "brand";
|
25 |
private static final String BRAND_KEY = "brand";
|
| 26 |
private static final String COLOR_KEY = "color";
|
26 |
private static final String COLOR_KEY = "color";
|
| 27 |
|
27 |
|
| 28 |
private static ResourceBundle properties = ResourceBundle.getBundle(CatalogUploderToGAE.class.getName());
|
28 |
private static ResourceBundle properties = ResourceBundle.getBundle(CatalogUploderToGAE.class.getName());
|
| 29 |
private static String googleAppUrl = properties.getString("googleappurl");
|
29 |
private static String googleAppUrl = properties.getString("googleappurl");
|
| Line 63... |
Line 63... |
| 63 |
URL url = new URL("http://" + googleAppUrl + "/upload-catalog-items");
|
63 |
URL url = new URL("http://" + googleAppUrl + "/upload-catalog-items");
|
| 64 |
URLConnection conn = url.openConnection();
|
64 |
URLConnection conn = url.openConnection();
|
| 65 |
conn.setDoOutput(true);
|
65 |
conn.setDoOutput(true);
|
| 66 |
OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
|
66 |
OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
|
| 67 |
String data = URLEncoder.encode("data", "UTF-8") + "=" + URLEncoder.encode(postData.toString(), "UTF-8");
|
67 |
String data = URLEncoder.encode("data", "UTF-8") + "=" + URLEncoder.encode(postData.toString(), "UTF-8");
|
| 68 |
System.out.println(data);
|
- |
|
| 69 |
wr.write(data);
|
68 |
wr.write(data);
|
| 70 |
wr.close();
|
69 |
wr.close();
|
| 71 |
|
70 |
|
| 72 |
conn.getInputStream().close();
|
71 |
conn.getInputStream().close();
|
| 73 |
} catch (Exception e) {
|
72 |
} catch (Exception e) {
|