Examples of writeValueAsString()


Examples of com.cloudera.api.ApiObjectMapper.writeValueAsString()

    return type.cast(res);
  }

  static String objectToJson(Object object) throws IOException {
    ApiObjectMapper objectMapper = new ApiObjectMapper();
    return objectMapper.writeValueAsString(object);
  }

  static <T> T jsonToObject(String text, Class<T> type)
      throws IOException {
    ApiObjectMapper objectMapper = new ApiObjectMapper();
View Full Code Here

Examples of com.dotcms.repackage.org.codehaus.jackson.map.ObjectMapper.writeValueAsString()

      }

      Map<String,Object> m = new HashMap<String, Object>();
      m.put("items", items);
      m.put("numRows", tagAPI.getFilteredTags(termFilter, hostFilter, globalTagsFilter, sort, 0, 0).size());
      String s = mapper.writeValueAsString(m);
      response.setContentType("text/plain");
      response.getWriter().write(s);
      response.getWriter().flush();
      response.getWriter().close();
View Full Code Here

Examples of com.fasterxml.jackson.databind.ObjectMapper.writeValueAsString()

   *
   * @throws java.io.IOException If something goes wrong
   */
  public static String jsonFixture(String fixtureClasspath) throws IOException {
    ObjectMapper om = new ObjectMapper();
    return om.writeValueAsString(om.readValue(fixture(fixtureClasspath), JsonNode.class));
  }

  /**
   * @param fixtureClasspath The classpath (can be in other JARs)
   *
 
View Full Code Here

Examples of com.fasterxml.jackson.databind.ObjectMapper.writeValueAsString()

    assertNotNull(socketSupport);

    SimpleTestRequest req = new SimpleTestRequest();
    ObjectMapper objectMapper = new ObjectMapper();

    String content = objectMapper.writeValueAsString(req);

    Map<String, String> headers = new HashMap<String, String>();
    headers.put("type", "SimpleTestRequest");
    MindRpcMessageHolder holder = new MindRpcMessageHolder(headers, content);
    clientRequestChannel.send(MessageBuilder.withPayload(holder).build());
View Full Code Here

Examples of com.fasterxml.jackson.databind.ObjectMapper.writeValueAsString()

    }

    public boolean savePreferences(String username, Map<String, Object> preferences) {
        try {
            ObjectMapper m = new ObjectMapper();
            final String body = m.writeValueAsString(preferences);
            api.path(resource.savePreferences(username)).body(new ApiRequest() {
                public String toJson() {
                    return body;
                }
            }).expect(Http.Status.NO_CONTENT).execute();
View Full Code Here

Examples of com.fasterxml.jackson.databind.ObjectMapper.writeValueAsString()

  //

  public String marshal(T object, boolean formatted) throws JsonProcessingException, IOException {
    ObjectMapper mapper = JsonHelper.buildObjectMapper(null, formatted);

    return mapper.writeValueAsString(object);
  }

  // public void marshal(T object, boolean formatted, OutputStream outputStream) throws XMLStreamException,
  // JAXBException, TransformerException, JSONException {
  // Configuration writeConfig = new Configuration(xmlNamespaceToJsonPrefix);
View Full Code Here

Examples of com.fasterxml.jackson.databind.ObjectMapper.writeValueAsString()

                                   "\"stddev\":5.0}");

        final ObjectMapper fullMapper = new ObjectMapper().registerModule(
                new MetricsModule(TimeUnit.SECONDS, TimeUnit.MILLISECONDS, true, MetricFilter.ALL));

        assertThat(fullMapper.writeValueAsString(histogram))
                .isEqualTo("{" +
                                   "\"count\":1," +
                                   "\"max\":2," +
                                   "\"mean\":3.0," +
                                   "\"min\":4," +
View Full Code Here

Examples of com.fasterxml.jackson.databind.ObjectMapper.writeValueAsString()

                                   "\"rate_units\":\"calls/second\"}");

        final ObjectMapper fullMapper = new ObjectMapper().registerModule(
                new MetricsModule(TimeUnit.SECONDS, TimeUnit.MILLISECONDS, true, MetricFilter.ALL));

        assertThat(fullMapper.writeValueAsString(timer))
                .isEqualTo("{" +
                                   "\"count\":1," +
                                   "\"max\":100.0," +
                                   "\"mean\":200.0," +
                                   "\"min\":300.0," +
View Full Code Here

Examples of com.fasterxml.jackson.databind.ObjectWriter.writeValueAsString()

        FilterProvider filters = new SimpleFilterProvider().addFilter("Filter properties from the PathController GET",
            SimpleBeanPropertyFilter.serializeAllExcept(ignorableFieldNames));
           
        ObjectWriter writer = objectMapper.writer(filters);

        return writer.writeValueAsString(jqReturn);
    }

    @RequestMapping(value = "/api/path", method = RequestMethod.POST)
    public
    @ResponseBody
View Full Code Here

Examples of com.fasterxml.jackson.databind.ObjectWriter.writeValueAsString()

        }

        ObjectMapper objectMapper = new ObjectMapper();
        ObjectWriter writer = objectMapper.writer();

        return writer.writeValueAsString(pathOverrideService.getPath(pathId));
    }
   
    @RequestMapping(value = "/api/path/test", method = RequestMethod.GET)
    public @ResponseBody String testPath(@RequestParam String url, @RequestParam String profileIdentifier,
                                         @RequestParam Integer requestType) throws Exception {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.