-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathQRHttpClient.java
More file actions
76 lines (76 loc) · 2.4 KB
/
QRHttpClient.java
File metadata and controls
76 lines (76 loc) · 2.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
package com.tutorial.http;
//
//import java.io.BufferedReader;
//import java.io.DataOutputStream;
//import java.io.InputStreamReader;
//import java.io.UnsupportedEncodingException;
//import java.net.HttpURLConnection;
//import java.net.URL;
//import java.net.URLEncoder;
//import java.util.*;
//import org.json.simple.JSONObject;
//import org.json.simple.JSONArray;
//import org.json.simple.parser.ParseException;
//import org.json.simple.parser.JSONParser;
//
public class QRHttpClient {
//
// public static void main(String[] args) {
// // TODO Auto-generated method stub
// try{
// URL url = new URL("https://axperienceapp.azurewebsites.net/api/question");
// HttpURLConnection con = (HttpURLConnection) url.openConnection();
// con.setRequestMethod("GET");
// con.setRequestProperty("Content-Type", "application/json");
//
// BufferedReader in = new BufferedReader(
// new InputStreamReader(con.getInputStream()));
// String inputLine;
// StringBuffer content = new StringBuffer();
// while ((inputLine = in.readLine()) != null) {
// content.append(inputLine);
// }
// JSONParser parser = new JSONParser();
// Object obj = parser.parse(content.toString());
// JSONArray array = (JSONArray)obj;
//
// //create ObjectMapper instance
//// ObjectMapper objectMapper = new ObjectMapper();
//// System.out.println(q.CategoryName);
//// in.close();
//// out.flush();
//// out.close();
// }
// catch(Exception ex){
// ex.printStackTrace();
// }
//
// }
//
// public interface Quiz{
// public String QuestionId = "";
// public String CategoryName = "";
// public String ImageUrl = "";
// public String Text = "";
// }
//
// public static class ParameterStringBuilder {
// public static String getParamsString(Map<String, String> params)
// throws UnsupportedEncodingException{
// StringBuilder result = new StringBuilder();
//
// for (Map.Entry<String, String> entry : params.entrySet()) {
// result.append(URLEncoder.encode(entry.getKey(), "UTF-8"));
// result.append("=");
// result.append(URLEncoder.encode(entry.getValue(), "UTF-8"));
// result.append("&");
// }
//
// String resultString = result.toString();
// return resultString.length() > 0
// ? resultString.substring(0, resultString.length() - 1)
// : resultString;
// }
// }
//
}