#2 J-N000

開啟中
J-N000 請求將 11 次程式碼提交從 J-N000/YouAreEll:master 合併至 master

二進制
.DS_Store 查看文件


+ 22
- 22
.gitignore 查看文件

@@ -1,25 +1,25 @@
1
-# Compiled class file
2
-*.class
1
+/target/
2
+!.mvn/wrapper/maven-wrapper.jar
3 3
 
4
-# intellij
5
-.idea/
4
+### STS ###
5
+.apt_generated
6
+.classpath
7
+.factorypath
8
+.project
9
+.settings
10
+.springBeans
11
+.sts4-cache
6 12
 
7
-# Log file
8
-*.log
13
+### IntelliJ IDEA ###
14
+.idea
15
+*.iws
16
+*.iml
17
+*.ipr
9 18
 
10
-# BlueJ files
11
-*.ctxt
12
-
13
-# Mobile Tools for Java (J2ME)
14
-.mtj.tmp/
15
-
16
-# Package Files #
17
-*.jar
18
-*.war
19
-*.ear
20
-*.zip
21
-*.tar.gz
22
-*.rar
23
-
24
-# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
25
-hs_err_pid*
19
+### NetBeans ###
20
+/nbproject/private/
21
+/build/
22
+/nbbuild/
23
+/dist/
24
+/nbdist/
25
+/.nb-gradle/

+ 1
- 1
.idea/vcs.xml 查看文件

@@ -1,6 +1,6 @@
1 1
 <?xml version="1.0" encoding="UTF-8"?>
2 2
 <project version="4">
3 3
   <component name="VcsDirectoryMappings">
4
-    <mapping directory="$PROJECT_DIR$" vcs="Git" />
4
+    <mapping directory="" vcs="Git" />
5 5
   </component>
6 6
 </project>

二進制
.mvn/wrapper/maven-wrapper.jar 查看文件


+ 1
- 0
.mvn/wrapper/maven-wrapper.properties 查看文件

@@ -0,0 +1 @@
1
+distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.3/apache-maven-3.5.3-bin.zip

二進制
Client/.DS_Store 查看文件


+ 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>

二進制
Client/src/.DS_Store 查看文件


二進制
Client/src/main/.DS_Store 查看文件


+ 8
- 0
Client/src/main/java/App.java 查看文件

@@ -0,0 +1,8 @@
1
+import client.SimpleShell;
2
+
3
+public class App {
4
+    public static void main(String[] args) {
5
+        SimpleShell app = new SimpleShell();
6
+        app.start();
7
+    }
8
+}

+ 0
- 124
Client/src/main/java/SimpleShell.java 查看文件

@@ -1,124 +0,0 @@
1
-import java.io.BufferedReader;
2
-import java.io.IOException;
3
-import java.io.InputStream;
4
-import java.io.InputStreamReader;
5
-import java.util.ArrayList;
6
-import java.util.List;
7
-
8
-public class SimpleShell {
9
-
10
-
11
-    public static void prettyPrint(String output) {
12
-        // yep, make an effort to format things nicely, eh?
13
-        System.out.println(output);
14
-    }
15
-    public static void main(String[] args) throws java.io.IOException {
16
-
17
-        YouAreEll webber = new YouAreEll();
18
-        String commandLine;
19
-        BufferedReader console = new BufferedReader
20
-                (new InputStreamReader(System.in));
21
-
22
-        ProcessBuilder pb = new ProcessBuilder();
23
-        List<String> history = new ArrayList<String>();
24
-        int index = 0;
25
-        //we break out with <ctrl c>
26
-        while (true) {
27
-            //read what the user enters
28
-            System.out.println("cmd? ");
29
-            commandLine = console.readLine();
30
-
31
-            //input parsed into array of strings(command and arguments)
32
-            String[] commands = commandLine.split(" ");
33
-            List<String> list = new ArrayList<String>();
34
-
35
-            //if the user entered a return, just loop again
36
-            if (commandLine.equals(""))
37
-                continue;
38
-            if (commandLine.equals("exit")) {
39
-                System.out.println("bye!");
40
-                break;
41
-            }
42
-
43
-            //loop through to see if parsing worked
44
-            for (int i = 0; i < commands.length; i++) {
45
-                //System.out.println(commands[i]); //***check to see if parsing/split worked***
46
-                list.add(commands[i]);
47
-
48
-            }
49
-            System.out.print(list); //***check to see if list was added correctly***
50
-            history.addAll(list);
51
-            try {
52
-                //display history of shell with index
53
-                if (list.get(list.size() - 1).equals("history")) {
54
-                    for (String s : history)
55
-                        System.out.println((index++) + " " + s);
56
-                    continue;
57
-                }
58
-
59
-                // Specific Commands.
60
-
61
-                // ids
62
-                if (list.contains("ids")) {
63
-                    String results = webber.get_ids();
64
-                    SimpleShell.prettyPrint(results);
65
-                    continue;
66
-                }
67
-
68
-                // messages
69
-                if (list.contains("messages")) {
70
-                    String results = webber.get_messages();
71
-                    SimpleShell.prettyPrint(results);
72
-                    continue;
73
-                }
74
-                // you need to add a bunch more.
75
-
76
-                //!! command returns the last command in history
77
-                if (list.get(list.size() - 1).equals("!!")) {
78
-                    pb.command(history.get(history.size() - 2));
79
-
80
-                }//!<integer value i> command
81
-                else if (list.get(list.size() - 1).charAt(0) == '!') {
82
-                    int b = Character.getNumericValue(list.get(list.size() - 1).charAt(1));
83
-                    if (b <= history.size())//check if integer entered isn't bigger than history size
84
-                        pb.command(history.get(b));
85
-                } else {
86
-                    pb.command(list);
87
-                }
88
-
89
-                // wait, wait, what curiousness is this?
90
-                Process process = pb.start();
91
-
92
-                //obtain the input stream
93
-                InputStream is = process.getInputStream();
94
-                InputStreamReader isr = new InputStreamReader(is);
95
-                BufferedReader br = new BufferedReader(isr);
96
-
97
-                //read output of the process
98
-                String line;
99
-                while ((line = br.readLine()) != null)
100
-                    System.out.println(line);
101
-                br.close();
102
-
103
-
104
-            }
105
-
106
-            //catch ioexception, output appropriate message, resume waiting for input
107
-            catch (IOException e) {
108
-                System.out.println("Input Error, Please try again!");
109
-            }
110
-            // So what, do you suppose, is the meaning of this comment?
111
-            /** The steps are:
112
-             * 1. parse the input to obtain the command and any parameters
113
-             * 2. create a ProcessBuilder object
114
-             * 3. start the process
115
-             * 4. obtain the output stream
116
-             * 5. output the contents returned by the command
117
-             */
118
-
119
-        }
120
-
121
-
122
-    }
123
-
124
-}

+ 0
- 23
Client/src/main/java/YouAreEll.java 查看文件

@@ -1,23 +0,0 @@
1
-public class YouAreEll {
2
-
3
-    YouAreEll() {
4
-    }
5
-
6
-    public static void main(String[] args) {
7
-        YouAreEll urlhandler = new YouAreEll();
8
-        System.out.println(urlhandler.MakeURLCall("/ids", "GET", ""));
9
-        System.out.println(urlhandler.MakeURLCall("/messages", "GET", ""));
10
-    }
11
-
12
-    public String get_ids() {
13
-        return MakeURLCall("/ids", "GET", "");
14
-    }
15
-
16
-    public String get_messages() {
17
-        return MakeURLCall("/messages", "GET", "");
18
-    }
19
-
20
-    public String MakeURLCall(String mainurl, String method, String jpayload) {
21
-        return "nada";
22
-    }
23
-}

+ 52
- 0
Client/src/main/java/access/YouAreEll.java 查看文件

@@ -0,0 +1,52 @@
1
+package access;
2
+
3
+import okhttp3.*;
4
+
5
+public class YouAreEll {
6
+    private static final MediaType JSON = MediaType.parse("application/json; charset=utf-8");
7
+    private OkHttpClient ok = new OkHttpClient();
8
+
9
+    public YouAreEll() {
10
+    }
11
+
12
+    public String get_ids() {
13
+        return MakeURLCall("/ids", "GET", "");
14
+    }
15
+    public String get_user_id(String url) { return MakeURLCall(url, "GET", ""); }
16
+    public String post_ids(String jpayload) { return MakeURLCall("/ids", "POST", jpayload); }
17
+    public String put_ids(String jpayload){ return MakeURLCall("/ids", "PUT", jpayload); }
18
+
19
+    public String get_messages(String url) { return MakeURLCall(url, "GET", ""); }
20
+    public String post_messages(String url, String jpayload) { return MakeURLCall(url, "POST", jpayload); }
21
+
22
+    private String MakeURLCall(String mainurl, String method, String jpayload) {
23
+        String serverUrl = "http://zipcode.rocks:8085";
24
+        Request okRequest;
25
+        Response talkBack;
26
+        RequestBody okBody = RequestBody.create(JSON, jpayload);
27
+        try {
28
+            switch(method) {
29
+                case "PUT":
30
+                    okRequest = new Request.Builder().url(serverUrl + mainurl).put(okBody).build();
31
+                    break;
32
+                case "POST":
33
+                    okRequest = new Request.Builder().url(serverUrl + mainurl).post(okBody).build();
34
+                    break;
35
+                case "GET":
36
+                    okRequest = new Request.Builder().url(serverUrl + mainurl).build();
37
+                    break;
38
+                default:
39
+                    okRequest = null;
40
+                    break;
41
+            }
42
+            talkBack = ok.newCall(okRequest).execute();
43
+            return talkBack.body().string()
44
+                    .replaceAll("\\\\", "")
45
+                    .replaceAll("\"", "");
46
+        }
47
+        catch (Exception e) {
48
+            System.out.println(e.getMessage());
49
+        }
50
+        return "";
51
+    }
52
+}

+ 76
- 0
Client/src/main/java/client/SimpleShell.java 查看文件

@@ -0,0 +1,76 @@
1
+package client;
2
+
3
+import client.view.IO;
4
+import client.view.ResponseListener;
5
+import controller.IdController;
6
+import controller.MessageController;
7
+
8
+import java.io.IOException;
9
+import java.util.ArrayList;
10
+import java.util.List;
11
+import java.util.regex.Matcher;
12
+import java.util.regex.Pattern;
13
+
14
+public class SimpleShell {
15
+    private IO io;
16
+    private IdController idController;
17
+    private MessageController messageController;
18
+    private Pattern regex;
19
+    private List<String> history;
20
+    private List<String> list;
21
+    private String commandLine;
22
+
23
+    public SimpleShell(){
24
+        idController = new IdController();
25
+        messageController = new MessageController();
26
+        regex = Pattern.compile("[^\\s\"']+|\"([^\"]*)\"|'([^']*)'");
27
+        history = new ArrayList<>();
28
+        io = new IO();
29
+    }
30
+    public void start() {
31
+        Thread listener = new Thread(new ResponseListener());
32
+        listener.start();
33
+        while (true) {
34
+            try {
35
+                getInput();
36
+
37
+                if (commandLine.equals("")) continue;
38
+                else if (commandLine.equals("exit")) {
39
+                    io.print("bye!");
40
+                    listener.interrupt();
41
+                    break;
42
+                }
43
+                history.addAll(list);
44
+                commandRouter();
45
+            }
46
+            catch (IOException e) {
47
+                io.print("Input Error, Please try again!");
48
+            }
49
+        }
50
+    }
51
+    private void getInput() throws IOException {
52
+        commandLine = io.input("cmd?");
53
+        list = listMaker(commandLine, regex);
54
+    }
55
+    private List<String> listMaker(String input, Pattern p) {
56
+        List<String> result = new ArrayList<>();
57
+        Matcher m = p.matcher(input);
58
+        while (m.find()) {
59
+            result.add(m.group());
60
+        }
61
+        return result;
62
+    }
63
+    private void commandRouter() throws IOException {
64
+        if (list.get(list.size() - 1).equals("history")) {
65
+            io.printHistory(history);
66
+        }
67
+        //TODO: CALLING CONTROLLERS
68
+        if (list.contains("ids")) {
69
+            io.prettyPrint(idController.route(list));
70
+        }
71
+        else if (list.contains("messages") || list.contains("send")) {
72
+            io.prettyPrint(messageController.route(list));
73
+        }
74
+        //TODO: CALLING CONTROLLERS
75
+    }
76
+}

+ 38
- 0
Client/src/main/java/client/view/IO.java 查看文件

@@ -0,0 +1,38 @@
1
+package client.view;
2
+
3
+import java.io.BufferedReader;
4
+import java.io.IOException;
5
+import java.io.InputStreamReader;
6
+import java.util.List;
7
+
8
+public class IO {
9
+    private BufferedReader console;
10
+
11
+    public IO() {
12
+        console = new BufferedReader(new InputStreamReader(System.in));
13
+    }
14
+
15
+    public void prettyPrintMessage(String msg) {
16
+        String[] out = msg.replaceAll("}", "").split(",");
17
+        print(out[out.length - 1].replace(":", ": "));
18
+    }
19
+
20
+    public void prettyPrint(String msg) {
21
+        //do some formatting
22
+        print(msg);
23
+    }
24
+
25
+    public void print(String msg) {
26
+        System.out.println(msg);
27
+    }
28
+
29
+    public void printHistory(List<String> history) {
30
+        print("History:");
31
+        history.forEach(this::print);
32
+    }
33
+
34
+    public String input(String msg) throws IOException {
35
+        print(msg);
36
+        return console.readLine();
37
+    }
38
+}

+ 51
- 0
Client/src/main/java/client/view/ResponseListener.java 查看文件

@@ -0,0 +1,51 @@
1
+package client.view;
2
+
3
+import access.YouAreEll;
4
+
5
+public class ResponseListener implements Runnable {
6
+    private IO io;
7
+    private YouAreEll access;
8
+    private String messages;
9
+    private String lastResponse;
10
+
11
+    public ResponseListener() {
12
+        io = new IO();
13
+        access = new YouAreEll();
14
+    }
15
+    public void run() {
16
+        messages = access.get_messages("/messages");
17
+        lastResponse = messages;
18
+        io.print("hello from thread, above while loop");
19
+        try {
20
+            while (true) {
21
+                if (Thread.interrupted()) throw new InterruptedException();
22
+                else Thread.sleep(2000);
23
+                messageHandler();
24
+            }
25
+        } catch (InterruptedException e) {
26
+            io.print("Thread end");
27
+        }
28
+    }
29
+    private void messageHandler() {
30
+        messages = access.get_messages("/messages");
31
+
32
+        if (isPM() && isNewMessage()) {
33
+            io.print("PM!!!");
34
+            newMessage();
35
+        } else if (isNewMessage()) {
36
+            newMessage();
37
+        }
38
+        lastResponse = messages;
39
+    }
40
+    private void newMessage() {
41
+        io.prettyPrintMessage(messages.split(",\\{")[0]);
42
+    }
43
+    private boolean isNewMessage() {
44
+        return !messages.split(",")[1]
45
+                        .equals(lastResponse.split(",")[1]);
46
+    }
47
+    private boolean isPM() {
48
+        String m = messages.split(",")[3];
49
+        return m.equals("toid:jard");
50
+    }
51
+}

+ 8
- 0
Client/src/main/java/controller/Controller.java 查看文件

@@ -0,0 +1,8 @@
1
+package controller;
2
+
3
+import java.io.IOException;
4
+import java.util.List;
5
+
6
+public interface Controller {
7
+    String route(List<String> commands) throws IOException;
8
+}

+ 39
- 0
Client/src/main/java/controller/IdController.java 查看文件

@@ -0,0 +1,39 @@
1
+package controller;
2
+
3
+import access.YouAreEll;
4
+import com.fasterxml.jackson.databind.ObjectMapper;
5
+import model.Id;
6
+
7
+import java.io.IOException;
8
+import java.util.List;
9
+
10
+public class IdController implements Controller {
11
+    private YouAreEll access = new YouAreEll();
12
+    private ObjectMapper om = new ObjectMapper();
13
+    private List<String> commands;
14
+    private Id id;
15
+    //--------------------------------------------------------------------------------------
16
+    //master routing
17
+    @Override
18
+    public String route(List<String> commands) throws IOException {
19
+        this.commands = commands;
20
+
21
+        if (commands.size() == 1) return listAll();
22
+        else return postId();
23
+    }
24
+    //--------------------------------------------------------------------------------------
25
+    //access methods
26
+    private String listAll() {
27
+        return access.get_ids();
28
+    }
29
+    private String postId() throws IOException {
30
+        id = new Id(commands.get(1), commands.get(2));
31
+        String idHash = access.get_user_id("/ids/" + id.getGithub());
32
+
33
+        if (!idHash.equals("")) {
34
+            id.setUserid(idHash);
35
+            return access.put_ids(om.writeValueAsString(id));
36
+        }
37
+        else return access.post_ids(om.writeValueAsString(id));
38
+    }
39
+}

+ 58
- 0
Client/src/main/java/controller/MessageController.java 查看文件

@@ -0,0 +1,58 @@
1
+package controller;
2
+
3
+import access.YouAreEll;
4
+import com.fasterxml.jackson.databind.ObjectMapper;
5
+import model.Message;
6
+import java.io.IOException;
7
+import java.util.List;
8
+
9
+public class MessageController implements Controller {
10
+    private YouAreEll access = new YouAreEll();
11
+    private ObjectMapper om = new ObjectMapper();
12
+    private List<String> commands;
13
+    private Message message;
14
+    //--------------------------------------------------------------------------------------
15
+    //master routing
16
+    @Override
17
+    public String route(List<String> commands) throws IOException {
18
+        this.commands = commands;
19
+        switch(commands.get(0)) {
20
+            case "send":
21
+                return routeSendMessages();
22
+            case "messages":
23
+                return routeGetMessages();
24
+            default:
25
+                return "";
26
+        }
27
+    }
28
+    //--------------------------------------------------------------------------------------
29
+    //sub routing
30
+    private String routeGetMessages() {
31
+        switch(commands.size()) {
32
+            case 1:
33
+                return listLastTwenty("");
34
+            case 2:
35
+                return listLastTwenty("/ids/" + commands.get(1));
36
+            default:
37
+                return "";
38
+        }
39
+    }
40
+    private String routeSendMessages() throws IOException {
41
+        switch(commands.size()) {
42
+            case 3:
43
+                message = new Message(commands.get(1), commands.get(2), "");
44
+                break;
45
+            case 5:
46
+                message = new Message(commands.get(1), commands.get(2), commands.get(4));
47
+        }
48
+        return sendMessage("/ids/" + message.getFromid() + "/messages");
49
+    }
50
+    //--------------------------------------------------------------------------------------
51
+    //access methods
52
+    private String listLastTwenty(String name) {
53
+        return access.get_messages(name + "/messages");
54
+    }
55
+    private String sendMessage(String url) throws IOException {
56
+        return access.post_messages(url, om.writeValueAsString(message));
57
+    }
58
+}

+ 22
- 0
Client/src/main/java/model/Id.java 查看文件

@@ -0,0 +1,22 @@
1
+package model;
2
+
3
+public class Id {
4
+    String userid = "_";
5
+    private String name;
6
+    private String github;
7
+
8
+    public Id(String name, String github) {
9
+        this.name = name;
10
+        this.github = github;
11
+    }
12
+    public String getUserid() { return userid; }
13
+    public void setUserid(String userid) { this.userid = userid; }
14
+    public String getName() { return name; }
15
+    public void setName(String name) {
16
+        this.name = name;
17
+    }
18
+    public String getGithub() { return github; }
19
+    public void setGithub(String github) {
20
+        this.github = github;
21
+    }
22
+}

+ 34
- 0
Client/src/main/java/model/Message.java 查看文件

@@ -0,0 +1,34 @@
1
+package model;
2
+
3
+public class Message {
4
+    private String sequence = "_";
5
+    private String timestamp = "_";
6
+    private String fromid;
7
+    private String message;
8
+    private String toid;
9
+
10
+    public Message(String fromid, String message, String toid) {
11
+        this.fromid = fromid;
12
+        this.message = message;
13
+        this.toid = toid;
14
+    }
15
+
16
+    public String getFromid() {
17
+        return fromid;
18
+    }
19
+    public void setFromid(String fromid) {
20
+        this.fromid = fromid;
21
+    }
22
+    public String getToid() {
23
+        return toid;
24
+    }
25
+    public void setToid(String toid) {
26
+        this.toid = toid;
27
+    }
28
+    public String getMessage() {
29
+        return message;
30
+    }
31
+    public void setMessage(String message) {
32
+        this.message = message;
33
+    }
34
+}

+ 2
- 2
README.md 查看文件

@@ -4,7 +4,7 @@
4 4
 
5 5
 
6 6
 ### The Point
7
-* You are to write a command interpreter using the provided `SimpleShell` class.
7
+* You are to write a command interpreter using the provided `view.SimpleShell` class.
8 8
 * You're going to create a way
9 9
 	* for commands to be typed into your shell,
10 10
 	* to read the typed commands and arguments,
@@ -162,7 +162,7 @@ and send it as the body of a POST request to  `http://zipcode.rocks:8085/ids/xt0
162 162
 
163 163
 ## Part Two
164 164
 
165
-What's that ProcessBuilder stuff about? In the SimpleShell class, take a look. How can that be used
165
+What's that ProcessBuilder stuff about? In the view.SimpleShell class, take a look. How can that be used
166 166
 as a pattern to use threads to make the API calls and wait for the response? Maybe launch a new thread on every request?
167 167
 
168 168
 ## Part Three

+ 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>

+ 22
- 1
pom.xml 查看文件

@@ -5,18 +5,39 @@
5 5
     <modelVersion>4.0.0</modelVersion>
6 6
 
7 7
     <groupId>com.zipcoder.ZipChat</groupId>
8
-    <artifactId>YouAreEll</artifactId>
8
+    <artifactId>access.YouAreEll</artifactId>
9 9
     <packaging>pom</packaging>
10 10
     <version>1.0-SNAPSHOT</version>
11 11
     <modules>
12 12
         <module>Client</module>
13 13
     </modules>
14 14
 
15
+    <build>
16
+    <plugins>
17
+        <plugin>
18
+            <groupId>org.apache.maven.plugins</groupId>
19
+            <artifactId>maven-compiler-plugin</artifactId>
20
+            <configuration>
21
+                <source>1.8</source>
22
+                <target>1.8</target>
23
+            </configuration>
24
+        </plugin>
25
+    </plugins>
26
+    </build>
27
+
15 28
     <dependencies>
16 29
         <dependency>
17 30
             <groupId>com.fasterxml.jackson.core</groupId>
18 31
             <artifactId>jackson-databind</artifactId>
19 32
             <version>2.8.6</version>
20 33
         </dependency>
34
+
35
+        <!-- https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp -->
36
+        <dependency>
37
+            <groupId>com.squareup.okhttp3</groupId>
38
+            <artifactId>okhttp</artifactId>
39
+            <version>3.10.0</version>
40
+        </dependency>
41
+
21 42
     </dependencies>
22 43
 </project>