Package org.codehaus.jackson.map

Examples of org.codehaus.jackson.map.ObjectMapper.writeValue()


            for(VirtualHost vhost : vhosts)
            {
                vhostList.add(Collections.singletonMap("name", vhost.getName()));
            }
            mapper.writeValue(writer, vhostList);
        }
        else
        {
            LinkedHashMap<String, Object> vhostObject = new LinkedHashMap<String, Object>();
            String vhostName = request.getPathInfo().substring(1);
View Full Code Here


                {
                    vhostObject.put("name", vhost.getName());
                    break;
                }
            }
            mapper.writeValue(writer, vhostObject);
        }
    }


    protected void doPut(final HttpServletRequest request, final HttpServletResponse response)
View Full Code Here

        }

        final PrintWriter writer = response.getWriter();
        ObjectMapper mapper = new ObjectMapper();
        mapper.configure(SerializationConfig.Feature.INDENT_OUTPUT, true);
        mapper.writeValue(writer, logRecords);

        response.setStatus(HttpServletResponse.SC_OK);

    }
View Full Code Here

                    throw new TransformationException(e);
                }
            } else {
                ObjectMapper mapper = JacksonHelper.createObjectMapper(source.getClass());
                try {
                    mapper.writeValue(sink, source);
                } catch (Throwable e) {
                    throw new TransformationException(e);
                }
            }
        }
View Full Code Here

    ObjectMapper mapper = new ObjectMapper();
    SerializationConfig serializationConfig = mapper.getSerializationConfig();
    serializationConfig.set(SerializationConfig.Feature.INDENT_OUTPUT, true);

    StringWriter sw = new StringWriter();
    mapper.writeValue(sw, object);

    return sw.toString();
  }

  public static HelixDataAccessor getClusterDataAccessor(ZkClient zkClient, String clusterName) {
View Full Code Here

          SerializationConfig serializationConfig = mapper.getSerializationConfig();
          serializationConfig.set(SerializationConfig.Feature.INDENT_OUTPUT, true);

          StringWriter sw = new StringWriter();
          try {
            mapper.writeValue(sw, record);
            logger.info(sw.toString());
          } catch (Exception e) {
            logger
                .warn(
                    "Exception during serialization in ZKPathDataDumpTask.checkAndDump. This can mostly be ignored",
View Full Code Here

    // System.out.println(result);
    ObjectMapper mapper = new ObjectMapper();

    // ByteArrayOutputStream baos = new ByteArrayOutputStream();
    StringWriter sw = new StringWriter();
    mapper.writeValue(sw, result);
    // System.out.println(sw.toString());

    ZNRecord zn = mapper.readValue(new StringReader(sw.toString()), ZNRecord.class);
    System.out.println(result.toString());
    System.out.println(zn.toString());
View Full Code Here

    System.out.println(zn.toString());
    AssertJUnit.assertTrue(zn.toString().equalsIgnoreCase(result.toString()));
    System.out.println();

    sw = new StringWriter();
    mapper.writeValue(sw, result2);

    ZNRecord zn2 = mapper.readValue(new StringReader(sw.toString()), ZNRecord.class);
    System.out.println(result2.toString());
    System.out.println(zn2.toString());
    AssertJUnit.assertTrue(zn2.toString().equalsIgnoreCase(result2.toString()));
View Full Code Here

    System.out.println(result2.toString());
    System.out.println(zn2.toString());
    AssertJUnit.assertTrue(zn2.toString().equalsIgnoreCase(result2.toString()));

    sw = new StringWriter();
    mapper.writeValue(sw, result3);
    System.out.println();

    ZNRecord zn3 = mapper.readValue(new StringReader(sw.toString()), ZNRecord.class);
    System.out.println(result3.toString());
    System.out.println(zn3.toString());
View Full Code Here

      try {
        ObjectMapper mapper = new ObjectMapper();
        SerializationConfig serializationConfig = mapper.getSerializationConfig();
        serializationConfig.set(SerializationConfig.Feature.INDENT_OUTPUT, true);
        StringWriter sw = new StringWriter();
        mapper.writeValue(sw, _alertHistory);
        return sw.toString();
      } catch (Exception e) {
        _logger.warn("", e);
        return "";
      }
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.