Subversion Repositories SmartDukaan

Rev

Rev 9967 | Rev 9969 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 9967 Rev 9968
Line 22... Line 22...
22
import inventory.FlipkartInventoryItem;
22
import inventory.FlipkartInventoryItem;
23
 
23
 
24
import java.io.BufferedReader;
24
import java.io.BufferedReader;
25
import java.io.IOException;
25
import java.io.IOException;
26
import java.io.InputStreamReader;
26
import java.io.InputStreamReader;
-
 
27
import java.io.UnsupportedEncodingException;
27
import java.util.ArrayList;
28
import java.util.ArrayList;
28
import java.util.HashMap;
29
import java.util.HashMap;
29
import java.util.List;
30
import java.util.List;
30
import java.util.Map;
31
import java.util.Map;
31
import java.util.Map.Entry;
32
import java.util.Map.Entry;
Line 179... Line 180...
179
				jsonRequest.append(",");	
180
				jsonRequest.append(",");	
180
			}
181
			}
181
			i++;
182
			i++;
182
			if(i%10==0 || i==flipkartItemsInventoryMap.entrySet().size()){
183
			if(i%10==0 || i==flipkartItemsInventoryMap.entrySet().size()){
183
				jsonRequest.append("]}");
184
				jsonRequest.append("]}");
-
 
185
				StringEntity input = null;
-
 
186
				try {
184
				StringEntity input = new StringEntity(jsonRequest.toString());
187
					input = new StringEntity(jsonRequest.toString());
-
 
188
				} catch (UnsupportedEncodingException e) {
-
 
189
					// TODO Auto-generated catch block
-
 
190
					e.printStackTrace();
-
 
191
				}
185
				input.setContentType("application/json");
192
				input.setContentType("application/json");
186
				System.out.println("Json input " + jsonRequest.toString());
193
				System.out.println("Json input " + jsonRequest.toString());
187
				httppost.setEntity(input);
194
				httppost.setEntity(input);
-
 
195
				HttpResponse response = null;
-
 
196
				try {
188
				HttpResponse response = httpclient.execute(httppost);
197
					response = httpclient.execute(httppost);
-
 
198
				} catch (IOException e) {
-
 
199
					// TODO Auto-generated catch block
-
 
200
					e.printStackTrace();
-
 
201
				}
-
 
202
				BufferedReader rd;
-
 
203
				try {
189
				BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
204
					rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
-
 
205
				} catch (IllegalStateException e) {
-
 
206
					// TODO Auto-generated catch block
-
 
207
					e.printStackTrace();
-
 
208
				} catch (IOException e) {
-
 
209
					// TODO Auto-generated catch block
-
 
210
					e.printStackTrace();
-
 
211
				}
190
				String line;
212
				String line;
191
				while ((line = rd.readLine()) != null) {
213
				while ((line = rd.readLine()) != null) {
192
					System.out.println("Response " + line);
214
					System.out.println("Response " + line);
193
				}
215
				}
194
			}
216
			}