|
@@ -20,9 +20,10 @@ public class YouAreEll {
|
20
|
20
|
ObjectMapper mapper = new ObjectMapper();
|
21
|
21
|
YouAreEll urlhandler = new YouAreEll();
|
22
|
22
|
// Id ericB = new Id("EricB", "EricBarnaba");
|
|
23
|
+// Message testMessage = new Message("EricBarnaba", "Now that I've made contact with the world it's time for dinner!");
|
23
|
24
|
// try {
|
24
|
|
-// String json = mapper.writeValueAsString(ericB);
|
25
|
|
-// urlhandler.MakeURLCall("/ids", "POST", json );
|
|
25
|
+// String json = mapper.writeValueAsString(testMessage);
|
|
26
|
+// urlhandler.MakeURLCall("/ids/EricBarnaba/messages", "POST", json );
|
26
|
27
|
// //System.out.println(json);
|
27
|
28
|
// }
|
28
|
29
|
// catch(JsonProcessingException jpe){
|
|
@@ -46,8 +47,7 @@ public class YouAreEll {
|
46
|
47
|
|
47
|
48
|
if(method.equals("GET")){
|
48
|
49
|
try{
|
49
|
|
- System.out.println(Request.Get(url)
|
50
|
|
- .execute().returnContent());
|
|
50
|
+ return Request.Get(url).execute().returnContent().asString();
|
51
|
51
|
}
|
52
|
52
|
catch(IOException ioe){
|
53
|
53
|
System.out.println(ioe.getMessage());
|
|
@@ -56,22 +56,26 @@ public class YouAreEll {
|
56
|
56
|
}
|
57
|
57
|
else if (method.equals("POST")){
|
58
|
58
|
try {
|
59
|
|
- //StringEntity json = new StringEntity(jpayload);
|
60
|
|
- System.out.println(jpayload);
|
61
|
|
- Request.Post(url)
|
62
|
|
- .useExpectContinue().bodyString(jpayload, ContentType.DEFAULT_TEXT)
|
63
|
|
- .execute().returnContent();
|
|
59
|
+ return Request.Post(url)
|
|
60
|
+ .bodyString(jpayload, ContentType.APPLICATION_JSON)
|
|
61
|
+ .execute().returnContent().asString();
|
64
|
62
|
}
|
65
|
63
|
catch(IOException ioe){
|
66
|
64
|
System.out.println(ioe.getMessage());
|
67
|
65
|
}
|
68
|
|
-
|
69
|
|
-
|
70
|
66
|
}
|
71
|
|
- else if (method.equals("PUT")){
|
72
|
67
|
|
|
68
|
+ else if (method.equals("PUT")){
|
|
69
|
+ try {
|
|
70
|
+ System.out.println(jpayload);
|
|
71
|
+ Request.Put(url)
|
|
72
|
+ .useExpectContinue().bodyString(jpayload, ContentType.APPLICATION_JSON)
|
|
73
|
+ .execute().returnContent().asString();
|
|
74
|
+ }
|
|
75
|
+ catch(IOException ioe){
|
|
76
|
+ System.out.println(ioe.getMessage());
|
|
77
|
+ }
|
73
|
78
|
}
|
74
|
|
-
|
75
|
79
|
return "nada";
|
76
|
80
|
}
|
77
|
81
|
}
|