Ver código fonte

finished part 1:

Eric Barnaba 6 anos atrás
pai
commit
eb37a7f0ef
1 arquivos alterados com 11 adições e 19 exclusões
  1. 11
    19
      Client/src/main/java/YouAreEll.java

+ 11
- 19
Client/src/main/java/YouAreEll.java Ver arquivo

@@ -1,12 +1,7 @@
1 1
 import com.fasterxml.jackson.core.JsonProcessingException;
2
-import com.fasterxml.jackson.databind.ObjectMapper;
3
-import org.apache.http.client.fluent.Form;
4 2
 import org.apache.http.client.fluent.Request;
5 3
 import org.apache.http.entity.ContentType;
6
-import org.apache.http.entity.StringEntity;
7
-
8 4
 import java.io.IOException;
9
-import java.io.UnsupportedEncodingException;
10 5
 
11 6
 public class YouAreEll {
12 7
 
@@ -18,19 +13,17 @@ public class YouAreEll {
18 13
     public static void main(String[] args) {
19 14
 
20 15
         YouAreEll urlhandler = new YouAreEll();
21
-//        Id stinkyPete = new Id("Stinky Pete", "StinkyPete");
22
-//        Message testMessage = new Message("EricBarnaba","JoeHendricks415", "Chicken on a BISCUIT");
23
-//        try {
24
-//            String json = mapper.writeValueAsString(testMessage);
25
-//            urlhandler.MakeURLCall("/ids/EricBarnaba/messages", "POST", json );
26
-//            //System.out.println(json);
27
-//        }
28
-//        catch(JsonProcessingException jpe){
29
-//            System.out.println(jpe.getMessage());
30
-//        }
16
+        Id stinkyPete = new Id("Stinky Pete", "StinkyPete");
17
+        try {
18
+            String json = Mapper.mapper.writeValueAsString(stinkyPete);
19
+            urlhandler.MakeURLCall("/ids", "PUT", json );
20
+        }
21
+        catch(JsonProcessingException jpe){
22
+            System.out.println(jpe.getMessage());
23
+        }
31 24
 
32
-        System.out.println(urlhandler.get_ids());
33
-        System.out.println(urlhandler.get_messages());
25
+//        System.out.println(urlhandler.get_ids());
26
+//        System.out.println(urlhandler.get_messages());
34 27
     }
35 28
 
36 29
     public String get_ids() {
@@ -66,8 +59,7 @@ public class YouAreEll {
66 59
 
67 60
         else if (method.equals("PUT")){
68 61
             try {
69
-                System.out.println(jpayload);
70
-                Request.Put(url)
62
+                return Request.Put(url)
71 63
                         .useExpectContinue().bodyString(jpayload, ContentType.APPLICATION_JSON)
72 64
                         .execute().returnContent().asString();
73 65
             }