Package com.fasterxml.jackson.core

Examples of com.fasterxml.jackson.core.JsonParser.disable()


        try {
            JsonParser jsonParser = new SmileFactory().createParser(inputStream);

            // Important: we are NOT to close the underlying stream after
            // mapping, so we need to instruct parser:
            jsonParser.disable(JsonParser.Feature.AUTO_CLOSE_SOURCE);

            object = objectMapper.readValue(jsonParser, objectMapper.getTypeFactory().constructType(genericType));
        }
        catch (Exception e) {
            // we want to return a 400 for bad JSON but not for a real IO exception
View Full Code Here


            JsonParser jsonParser = new SmileFactory().createParser(response.getInputStream());
            ObjectMapper objectMapper = OBJECT_MAPPER_SUPPLIER.get();

            // Important: we are NOT to close the underlying stream after
            // mapping, so we need to instruct parser:
            jsonParser.disable(JsonParser.Feature.AUTO_CLOSE_SOURCE);

            return objectMapper.readValue(jsonParser, objectMapper.getTypeFactory().constructType(jsonCodec.getType()));
        }
        catch (InvalidFormatException e) {
            throw new IllegalArgumentException("Unable to create " + jsonCodec.getType() + " from SMILE response", e);
View Full Code Here

                JsonParser jsonParser = new SmileFactory().createParser(inputStream);
                ObjectMapper objectMapper = OBJECT_MAPPER_SUPPLIER.get();

                // Important: we are NOT to close the underlying stream after
                // mapping, so we need to instruct parser:
                jsonParser.disable(JsonParser.Feature.AUTO_CLOSE_SOURCE);

                value = objectMapper.readValue(jsonParser, objectMapper.getTypeFactory().constructType(jsonCodec.getType()));
            }
            catch (InvalidFormatException e) {
                exception = new IllegalArgumentException("Unable to create " + jsonCodec.getType() + " from SMILE response", e);
View Full Code Here

        try {
            JsonParser jsonParser = objectMapper.getFactory().createParser(inputStream);

            // Important: we are NOT to close the underlying stream after
            // mapping, so we need to instruct parser:
            jsonParser.disable(JsonParser.Feature.AUTO_CLOSE_SOURCE);

            object = objectMapper.readValue(jsonParser, objectMapper.getTypeFactory().constructType(genericType));
        }
        catch (Exception e) {
            // We want to handle parsing exceptions differently than regular IOExceptions so just rethrow IOExceptions
View Full Code Here

        }

        if (schemaAnnotation != null) {
            ObjectMapper mapper = locateMapper(type, mediaType);
            JsonParser jp = mapper.getFactory().createJsonParser(entityStream);
            jp.disable(JsonParser.Feature.AUTO_CLOSE_SOURCE);
            URL schemaLocation = schemaLookup.getSchemaURL(schemaAnnotation.value());
            JsonSchema jsonSchema = cache.getSchema(schemaLocation);
            JsonNode jsonNode = mapper.readTree(jp);
            List<ErrorMessage> validationErrors = jsonSchema.validate(jsonNode);
            if (validationErrors.isEmpty()) {
View Full Code Here

        try {
            JsonParser jsonParser = new SmileFactory().createParser(inputStream);

            // Important: we are NOT to close the underlying stream after
            // mapping, so we need to instruct parser:
            jsonParser.disable(JsonParser.Feature.AUTO_CLOSE_SOURCE);

            object = objectMapper.readValue(jsonParser, objectMapper.getTypeFactory().constructType(genericType));
        }
        catch (Exception e) {
            // we want to return a 400 for bad JSON but not for a real IO exception
View Full Code Here

        try {
            JsonParser jsonParser = objectMapper.getFactory().createJsonParser(inputStream);

            // Important: we are NOT to close the underlying stream after
            // mapping, so we need to instruct parser:
            jsonParser.disable(JsonParser.Feature.AUTO_CLOSE_SOURCE);

            object = objectMapper.readValue(jsonParser, objectMapper.getTypeFactory().constructType(genericType));
        }
        catch (Exception e) {
            // We want to handle parsing exceptions differently than regular IOExceptions so just rethrow IOExceptions
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.