Kaynağa Gözat

finished part 1:

Eric Barnaba 6 yıl önce
ebeveyn
işleme
eb37a7f0ef
1 değiştirilmiş dosya ile 11 ekleme ve 19 silme
  1. 11
    19
      Client/src/main/java/YouAreEll.java

+ 11
- 19
Client/src/main/java/YouAreEll.java Dosyayı Görüntüle

1
 import com.fasterxml.jackson.core.JsonProcessingException;
1
 import com.fasterxml.jackson.core.JsonProcessingException;
2
-import com.fasterxml.jackson.databind.ObjectMapper;
3
-import org.apache.http.client.fluent.Form;
4
 import org.apache.http.client.fluent.Request;
2
 import org.apache.http.client.fluent.Request;
5
 import org.apache.http.entity.ContentType;
3
 import org.apache.http.entity.ContentType;
6
-import org.apache.http.entity.StringEntity;
7
-
8
 import java.io.IOException;
4
 import java.io.IOException;
9
-import java.io.UnsupportedEncodingException;
10
 
5
 
11
 public class YouAreEll {
6
 public class YouAreEll {
12
 
7
 
18
     public static void main(String[] args) {
13
     public static void main(String[] args) {
19
 
14
 
20
         YouAreEll urlhandler = new YouAreEll();
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
     public String get_ids() {
29
     public String get_ids() {
66
 
59
 
67
         else if (method.equals("PUT")){
60
         else if (method.equals("PUT")){
68
             try {
61
             try {
69
-                System.out.println(jpayload);
70
-                Request.Put(url)
62
+                return Request.Put(url)
71
                         .useExpectContinue().bodyString(jpayload, ContentType.APPLICATION_JSON)
63
                         .useExpectContinue().bodyString(jpayload, ContentType.APPLICATION_JSON)
72
                         .execute().returnContent().asString();
64
                         .execute().returnContent().asString();
73
             }
65
             }