Package org.codehaus.jackson.map

Examples of org.codehaus.jackson.map.ObjectMapper


  @RequestMapping(method=RequestMethod.POST, produces="application/json")
  public @ResponseBody Map<String,String> handleExportRequest(HttpServletRequest request)
      throws ServletException, IOException {
    //given a list of ogpids, export them to geocommons
    //read the POST'ed JSON object
    ObjectMapper mapper = new ObjectMapper();
    JsonNode rootNode = mapper.readTree(request.getInputStream());
    String basemap = rootNode.path("basemap").getTextValue();
    String bbox = rootNode.path("extent").getTextValue();
    String username = rootNode.path("username").getTextValue();
    String password = rootNode.path("password").getTextValue();
   
    ObjectNode responseJson = mapper.createObjectNode();
    //response json format
    //{"status": "", "message": "", mapUrl: "", "layers": []}
    //status  where in the process
    //statusMessage text
    //mapUrl:
View Full Code Here


     *
     * @author Chris Barnett
     */
    home = this.searchConfigRetriever.getHome();
    //
    ObjectMapper mapper = new ObjectMapper();
    try {
      this.imageRequest = mapper.readValue(URLDecoder.decode(imageRequest, "UTF-8"), ImageRequest.class);
    } catch (Exception e){
      e.printStackTrace();
    }
    this.isLocallyAuthenticated = ogpUserContext.isAuthenticatedLocally();

View Full Code Here

   * parses the JSON string into a Jackson JsonNode, stores it in the property configContents
   * @throws IOException
   */
  public void readConfigFile() throws IOException{
    if (configContents == null){
      ObjectMapper mapper = new ObjectMapper();
      JsonNode rootNode = mapper.readValue(this.loadConfigFile(), JsonNode.class);     
      JsonNode jsonResponse = rootNode.path("config");
      this.configContents = jsonResponse;
    }
  }
View Full Code Here

    public void setUp() throws Exception {
        objectMapper = initializeObjectMapper();
    }

    public static ObjectMapper initializeObjectMapper() {
        ObjectMapper objectMapper = new ObjectMapper();
        objectMapper.setSerializationInclusion(Inclusion.NON_NULL)
                .enable(SerializationConfig.Feature.INDENT_OUTPUT)
                .enable(SerializationConfig.Feature.WRAP_ROOT_VALUE)
                .enable(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE)
                .enable(DeserializationConfig.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
        return objectMapper;
View Full Code Here

  {
    parseArgs(args);

      File sourcesJson = new File(_sSourcesConfigFile);

      ObjectMapper mapper = new ObjectMapper();
      PhysicalSourceConfig physicalSourceConfig = mapper.readValue(sourcesJson, PhysicalSourceConfig.class);
      physicalSourceConfig.checkForNulls();

      Config config = new Config();

      ConfigLoader<StaticConfig> configLoader =
View Full Code Here

      // Load the source configuration JSON file
      //File sourcesJson = new File("integration-test/config/sources-member2.json");
      File sourcesJson = new File(_sSourcesConfigFile);

      ObjectMapper mapper = new ObjectMapper();
      PhysicalSourceConfig physicalSourceConfig = mapper.readValue(sourcesJson, PhysicalSourceConfig.class);
      physicalSourceConfig.checkForNulls();

      Config config = new Config();

      ConfigLoader<StaticConfig> configLoader =
View Full Code Here

                    */
                //old: CLIENT.property(ClientProperties.SSL_CONFIG, new SslConfig(context));
           
            CLIENT = ClientBuilder.newBuilder().sslContext(sslConfig.createSSLContext()).build();
     
      DEFAULT_MAPPER = new ObjectMapper();
     
      DEFAULT_MAPPER.setSerializationInclusion(Inclusion.NON_NULL);
      DEFAULT_MAPPER.enable(SerializationConfig.Feature.INDENT_OUTPUT);
      DEFAULT_MAPPER.enable(DeserializationConfig.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
      DEFAULT_MAPPER.disable(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES);
      DEFAULT_MAPPER.enable(DeserializationConfig.Feature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT);
     
      WRAPPED_MAPPER = new ObjectMapper();
     
      WRAPPED_MAPPER.setSerializationInclusion(Inclusion.NON_NULL);
      WRAPPED_MAPPER.enable(SerializationConfig.Feature.INDENT_OUTPUT);
      WRAPPED_MAPPER.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE);
      WRAPPED_MAPPER.enable(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE);
View Full Code Here

        // convert stream to string
        java.util.Scanner s = new java.util.Scanner(streamData).useDelimiter("\\A");
        String data = s.hasNext() ? s.next() : "";

        // parse JSON
        ObjectMapper mapper = new ObjectMapper();
        Backup backupData = null;
        try {
            backupData = mapper.readValue(data, Backup.class);
        } catch (Exception e) {
            logger.error("Could not parse input data: {}, {}", e.getClass(), e.getMessage());
            return false;
        }
View Full Code Here

public class FieldTest {

    @Test
    public void testNestedObjectParsing() throws Exception {
        Map value = new ObjectMapper().readValue(getClass().getResourceAsStream("nested.json"), Map.class);
        Field fl = Field.parseField(value);
        assertEquals("artiststimestamp", fl.name());
        Field[] properties = fl.properties();
        Field first = properties[0];
        assertEquals("date", first.name());
View Full Code Here

        assertEquals(FieldType.STRING, secondProps[0].type());
    }

    @Test
    public void testBasicParsing() throws Exception {
        Map value = new ObjectMapper().readValue(getClass().getResourceAsStream("basic.json"), Map.class);
        Field fl = Field.parseField(value);
    }
View Full Code Here

TOP

Related Classes of org.codehaus.jackson.map.ObjectMapper

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.