瀏覽代碼

first commit

mpierse 6 年之前
父節點
當前提交
c70c26933f
共有 3 個文件被更改,包括 50 次插入5 次删除
  1. 13
    3
      Client/Client.iml
  2. 23
    0
      Client/pom.xml
  3. 14
    2
      Client/src/main/java/YouAreEll.java

+ 13
- 3
Client/Client.iml 查看文件

@@ -1,16 +1,26 @@
1 1
 <?xml version="1.0" encoding="UTF-8"?>
2 2
 <module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
3
-  <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_5">
3
+  <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
4 4
     <output url="file://$MODULE_DIR$/target/classes" />
5 5
     <output-test url="file://$MODULE_DIR$/target/test-classes" />
6 6
     <content url="file://$MODULE_DIR$">
7 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 8
       <excludeFolder url="file://$MODULE_DIR$/target" />
11 9
     </content>
12 10
     <orderEntry type="inheritedJdk" />
13 11
     <orderEntry type="sourceFolder" forTests="false" />
12
+    <orderEntry type="library" name="Maven: com.mashape.unirest:unirest-java:1.4.9" level="project" />
13
+    <orderEntry type="library" name="Maven: org.apache.httpcomponents:httpclient:4.5.2" level="project" />
14
+    <orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore:4.4.4" level="project" />
15
+    <orderEntry type="library" name="Maven: commons-logging:commons-logging:1.2" level="project" />
16
+    <orderEntry type="library" name="Maven: commons-codec:commons-codec:1.9" level="project" />
17
+    <orderEntry type="library" name="Maven: org.apache.httpcomponents:httpasyncclient:4.1.1" level="project" />
18
+    <orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore-nio:4.4.4" level="project" />
19
+    <orderEntry type="library" name="Maven: org.apache.httpcomponents:httpmime:4.5.2" level="project" />
20
+    <orderEntry type="library" name="Maven: org.json:json:20160212" level="project" />
21
+    <orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.11" level="project" />
22
+    <orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
23
+    <orderEntry type="library" scope="TEST" name="Maven: commons-io:commons-io:2.4" level="project" />
14 24
     <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.8.6" level="project" />
15 25
     <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.8.0" level="project" />
16 26
     <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.8.6" level="project" />

+ 23
- 0
Client/pom.xml 查看文件

@@ -10,6 +10,29 @@
10 10
     <modelVersion>4.0.0</modelVersion>
11 11
 
12 12
     <artifactId>Client</artifactId>
13
+    <properties>
14
+        <maven.compiler.source>1.8</maven.compiler.source>
15
+        <maven.compiler.target>1.8</maven.compiler.target>
16
+    </properties>
17
+   <dependencies>
18
+    <dependency>
19
+        <groupId>com.mashape.unirest</groupId>
20
+        <artifactId>unirest-java</artifactId>
21
+        <version>1.4.9</version>
22
+    </dependency>
23
+       <dependency>
24
+           <groupId>junit</groupId>
25
+           <artifactId>junit</artifactId>
26
+           <version>4.11</version>
27
+           <scope>test</scope>
28
+       </dependency>
29
+       <dependency>
30
+           <groupId>commons-io</groupId>
31
+           <artifactId>commons-io</artifactId>
32
+           <version>2.4</version>
33
+           <scope>test</scope>
34
+       </dependency>
35
+   </dependencies>
13 36
 
14 37
 
15 38
 </project>

+ 14
- 2
Client/src/main/java/YouAreEll.java 查看文件

@@ -1,3 +1,8 @@
1
+import com.fasterxml.jackson.databind.JsonNode;
2
+import com.mashape.unirest.http.HttpResponse;
3
+import com.mashape.unirest.http.Unirest;
4
+import com.mashape.unirest.http.exceptions.UnirestException;
5
+
1 6
 public class YouAreEll {
2 7
 
3 8
     YouAreEll() {
@@ -17,7 +22,14 @@ public class YouAreEll {
17 22
         return MakeURLCall("/messages", "GET", "");
18 23
     }
19 24
 
20
-    public String MakeURLCall(String mainurl, String method, String jpayload) {
21
-        return "nada";
25
+    public String MakeURLCall(String mainurl, String method, String jpayload) throws UnirestException {
26
+        mainurl = "http://zipcode.rocks:8085"+mainurl;
27
+        HttpResponse<JsonNode> jsonResponse = Unirest.post(mainurl)
28
+               // .header("accept", "application/json")
29
+                .queryString("apiKey", "123")
30
+                .field("parameter", "value")
31
+                .field("foo", "bar")
32
+                .asJson();
33
+        return jsonResponse;
22 34
     }
23 35
 }