Package com.restfb

Examples of com.restfb.DefaultJsonMapper


                        } else {
                            return (HttpURLConnection) url.openConnection();
                        }
                    }
                },
                new DefaultJsonMapper(),
                version);
    }
View Full Code Here


                            } else {
                                return (HttpURLConnection) url.openConnection();
                            }
                        }
                    },
                    new DefaultJsonMapper());
        }
View Full Code Here

    // Make the API call
    JsonObject results = facebookClient.fetchObjects(ids, JsonObject.class);

    // Pull out JSON data by key and map each type by hand.
    JsonMapper jsonMapper = new DefaultJsonMapper();
    User user = jsonMapper.toJavaObject(results.getString("btaylor"), User.class);
    Url url = jsonMapper.toJavaObject(results.getString("http://www.imdb.com/title/tt0117500/"), Url.class);

    out.println("User is " + user);
    out.println("URL is " + url);
  }
View Full Code Here

public class EndpointBuilderTest {
   
    @Test
    public void version1Test() {
        FakeWebRequestor wr = new FakeWebRequestor();
        DefaultFacebookClient client = new DefaultFacebookClient("12345", wr, new DefaultJsonMapper(), Version.VERSION_1_0);
        String respstring = client.fetchObject("/me", String.class);
        assertEquals("https://graph.facebook.com/v1.0/me?access_token=12345&format=json", respstring);
    }
View Full Code Here

    }
   
    @Test
    public void version2Test() {
        FakeWebRequestor wr = new FakeWebRequestor();
        DefaultFacebookClient client = new DefaultFacebookClient("12345", wr, new DefaultJsonMapper(), Version.VERSION_2_0);
        String respstring = client.fetchObject("/me", String.class);
        assertEquals("https://graph.facebook.com/v2.0/me?access_token=12345&format=json", respstring);
    }
View Full Code Here

    }
   
    @Test
    public void version21Test() {
        FakeWebRequestor wr = new FakeWebRequestor();
        DefaultFacebookClient client = new DefaultFacebookClient("12345", wr, new DefaultJsonMapper(), Version.VERSION_2_1);
        String respstring = client.fetchObject("/me", String.class);
        assertEquals("https://graph.facebook.com/v2.1/me?access_token=12345&format=json", respstring);
    }
View Full Code Here

    }
   
    @Test
    public void unversionedTest() {
        FakeWebRequestor wr = new FakeWebRequestor();
        DefaultFacebookClient client = new DefaultFacebookClient("12345", wr, new DefaultJsonMapper(), Version.UNVERSIONED);
        String respstring = client.fetchObject("/me", String.class);
        assertEquals("https://graph.facebook.com/me?access_token=12345&format=json", respstring);
    }
View Full Code Here

    }
   
    @Test
    public void unversionedNoVersionTest() {
        FakeWebRequestor wr = new FakeWebRequestor();
        DefaultFacebookClient client = new DefaultFacebookClient("12345", wr, new DefaultJsonMapper());
        String respstring = client.fetchObject("/me", String.class);
        assertEquals("https://graph.facebook.com/me?access_token=12345&format=json", respstring);
    }
View Full Code Here

  private static FacebookClient createFixedResponseFacebookClient(String pathToJson) throws IOException {
    WebRequestor wr = new ClasspathWebRequestor(JSON_RESOURCES_PREFIX + pathToJson);
    String jsonBody = wr.executeGet(null).getBody();
    Assert.assertTrue("path to json not found:" + JSON_RESOURCES_PREFIX + pathToJson,
      (jsonBody != null) && (jsonBody.length() > 0));
    return new DefaultFacebookClient(null, wr, new DefaultJsonMapper());
  }
View Full Code Here

    // Make the API call
    JsonObject results = facebookClient.fetchObjects(ids, JsonObject.class);

    // Pull out JSON data by key and map each type by hand.
    JsonMapper jsonMapper = new DefaultJsonMapper();
    User user = jsonMapper.toJavaObject(results.getString("btaylor"), User.class);
    Url url = jsonMapper.toJavaObject(results.getString("http://www.imdb.com/title/tt0117500/"), Url.class);

    out.println("User is " + user);
    out.println("URL is " + url);
  }
View Full Code Here

TOP

Related Classes of com.restfb.DefaultJsonMapper

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.