Ledger Nano X - The secure hardware wallet
SHARE
TWEET

Untitled

a guest Jul 28th, 2014 18 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.         public static void main(String[] args) {
  2.  
  3.                 final Map<String, String> namespacePrefixMapper = new HashMap<String, String>();
  4.                 namespacePrefixMapper.put("http://www.w3.org/2001/XMLSchema-instance", "xsi");
  5.                  
  6.                 final MoxyJsonConfig moxyJsonConfig = new MoxyJsonConfig()
  7.                             .setNamespacePrefixMapper(namespacePrefixMapper)
  8.                             .setNamespaceSeparator(':');
  9.                  
  10.                 final ContextResolver<MoxyJsonConfig> jsonConfigResolver = moxyJsonConfig.resolver();
  11.                
  12.                 Client client = ClientBuilder.newBuilder()
  13.                                 .register(MoxyJsonFeature.class)
  14.                                 .register(jsonConfigResolver)
  15.                                 .build();
  16.                 // Creating WebTarget step by step. Could do all at once, but just examining different ways to assemble one.
  17.                 String uri = "http://census.soe.com/get/ps2:v2/character/5428010618020694593";
  18.                 WebTarget target = client.target(uri);
  19.                 Invocation.Builder invocationBuilder = target.path(uri).request(MediaType.APPLICATION_JSON);
  20.                 String tryString = target.path(uri).request().get(String.class);
  21.                 System.out.println(tryString);
  22.                 Response response = invocationBuilder.get();
  23.                 // Only in here for debug purposes
  24.                 System.out.println(response.getDate().toString());
  25.                 MOXyJsonProvider moxyResponse = response.readEntity(MOXyJsonProvider.class);
  26.                 //String stringResponse = response.readEntity(String.class);
  27.                 moxyResponse.setIncludeRoot(true);
  28.                 String jsonString = moxyResponse.toString();
  29.                 System.out.println(jsonString);
  30.         }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top