#6 still working on it

Отворено
sambhutani жели да споји 1 комит(е) из sambhutani/YouAreEll:master у master
3 измењених фајлова са 58 додато и 34 уклоњено
  1. 0
    18
      Client/Client.iml
  2. 58
    1
      Client/src/main/java/YouAreEll.java
  3. 0
    15
      YouAreEll.iml

+ 0
- 18
Client/Client.iml Прегледај датотеку

@@ -1,18 +0,0 @@
1
-<?xml version="1.0" encoding="UTF-8"?>
2
-<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
3
-  <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_5">
4
-    <output url="file://$MODULE_DIR$/target/classes" />
5
-    <output-test url="file://$MODULE_DIR$/target/test-classes" />
6
-    <content url="file://$MODULE_DIR$">
7
-      <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
8
-      <sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
9
-      <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
10
-      <excludeFolder url="file://$MODULE_DIR$/target" />
11
-    </content>
12
-    <orderEntry type="inheritedJdk" />
13
-    <orderEntry type="sourceFolder" forTests="false" />
14
-    <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.8.6" level="project" />
15
-    <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.8.0" level="project" />
16
-    <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.8.6" level="project" />
17
-  </component>
18
-</module>

+ 58
- 1
Client/src/main/java/YouAreEll.java Прегледај датотеку

@@ -1,3 +1,13 @@
1
+import java.io.IOException;
2
+import java.net.HttpURLConnection;
3
+import java.net.MalformedURLException;
4
+import java.net.ProtocolException;
5
+import java.net.URL;
6
+import java.io.BufferedReader;
7
+import java.io.InputStreamReader;
8
+
9
+
10
+
1 11
 public class YouAreEll {
2 12
 
3 13
     YouAreEll() {
@@ -13,11 +23,58 @@ public class YouAreEll {
13 23
         return MakeURLCall("/ids", "GET", "");
14 24
     }
15 25
 
26
+
16 27
     public String get_messages() {
17 28
         return MakeURLCall("/messages", "GET", "");
18 29
     }
19 30
 
20 31
     public String MakeURLCall(String mainurl, String method, String jpayload) {
21
-        return "nada";
32
+        String output= null;
33
+        String methodUrl="http://zipcode.rocks:8085" + mainurl;
34
+        URL obj = null;
35
+        try {
36
+            obj = new URL(methodUrl);
37
+        } catch (MalformedURLException e) {
38
+            e.printStackTrace();
39
+        }
40
+        HttpURLConnection con = null;
41
+        try {
42
+            con = (HttpURLConnection) obj.openConnection();
43
+        } catch (IOException e) {
44
+            e.printStackTrace();
45
+        }
46
+        try {
47
+            con.setRequestMethod(method);
48
+        } catch (ProtocolException e) {
49
+            e.printStackTrace();
50
+        }
51
+
52
+        try {
53
+            int responseCode = con.getResponseCode();
54
+            //System.out.println(responseCode);
55
+        } catch (IOException e) {
56
+            e.printStackTrace();
57
+        }
58
+
59
+        BufferedReader br = null;
60
+        try {
61
+            br = new BufferedReader(new InputStreamReader(con.getInputStream()));
62
+            StringBuilder sb = new StringBuilder();
63
+            String line;
64
+            while ((line = br.readLine()) != null) {
65
+                sb.append(line+"\n");
66
+            }
67
+            br.close();
68
+           output =  sb.toString();
69
+        } catch (IOException e) {
70
+            e.printStackTrace();
71
+        }
72
+
73
+        return output;
22 74
     }
75
+
76
+
77
+
78
+
79
+
23 80
 }

+ 0
- 15
YouAreEll.iml Прегледај датотеку

@@ -1,15 +0,0 @@
1
-<?xml version="1.0" encoding="UTF-8"?>
2
-<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
3
-  <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_5">
4
-    <output url="file://$MODULE_DIR$/target/classes" />
5
-    <output-test url="file://$MODULE_DIR$/target/test-classes" />
6
-    <content url="file://$MODULE_DIR$">
7
-      <excludeFolder url="file://$MODULE_DIR$/target" />
8
-    </content>
9
-    <orderEntry type="inheritedJdk" />
10
-    <orderEntry type="sourceFolder" forTests="false" />
11
-    <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.8.6" level="project" />
12
-    <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.8.0" level="project" />
13
-    <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.8.6" level="project" />
14
-  </component>
15
-</module>