Examples of SmileFactory


Examples of com.fasterxml.jackson.dataformat.smile.SmileFactory

        }
        if (!MediaType.parse(contentType).is(MEDIA_TYPE_SMILE)) {
            throw new UnexpectedResponseException("Expected application/x-jackson-smile response from server but got " + contentType, request, response);
        }
        try {
            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);
View Full Code Here

Examples of com.fasterxml.jackson.dataformat.smile.SmileFactory

            this.headers = ImmutableListMultimap.copyOf(headers);

            T value = null;
            IllegalArgumentException exception = null;
            try {
                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);
View Full Code Here

Examples of com.fasterxml.jackson.dataformat.smile.SmileFactory

    private Response createSmileResponse(HttpStatus status, Object value)
    {
        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
        try {
            new ObjectMapper(new SmileFactory()).writeValue(outputStream, value);
        }
        catch (IOException e) {
            throw propagate(e);
        }
        return new TestingResponse(status, contentType(MEDIA_TYPE_SMILE), outputStream.toByteArray());
View Full Code Here

Examples of com.fasterxml.jackson.dataformat.smile.SmileFactory

    @Override
    protected void assertEncodedProperly(byte[] encoded, MultivaluedMap<String, Object> headers, String expected)
            throws IOException
    {
        ObjectMapper smileMapper = new ObjectMapper(new SmileFactory());
        assertEquals(smileMapper.readValue(encoded, String.class), expected);
    }
View Full Code Here

Examples of com.fasterxml.jackson.dataformat.smile.SmileFactory

    @Override
    public void write(OutputStream out)
            throws Exception
    {
        ObjectMapper objectMapper = OBJECT_MAPPER_SUPPLIER.get();
        JsonGenerator jsonGenerator = new SmileFactory().createGenerator(out);

        // Important: we are NOT to close the underlying stream after
        // mapping, so we need to instruct generator:
        jsonGenerator.disable(JsonGenerator.Feature.AUTO_CLOSE_TARGET);
View Full Code Here

Examples of com.fasterxml.jackson.dataformat.smile.SmileFactory

            InputStream inputStream)
            throws IOException
    {
        Object object;
        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);
View Full Code Here

Examples of com.fasterxml.jackson.dataformat.smile.SmileFactory

            MediaType mediaType,
            MultivaluedMap<String, Object> httpHeaders,
            OutputStream outputStream)
            throws IOException
    {
        JsonGenerator jsonGenerator = new SmileFactory().createGenerator(outputStream);

        // Important: we are NOT to close the underlying stream after
        // mapping, so we need to instruct generator:
        jsonGenerator.disable(JsonGenerator.Feature.AUTO_CLOSE_TARGET);
View Full Code Here

Examples of com.fasterxml.jackson.dataformat.smile.SmileFactory

        _jsonMapper = new ObjectMapper();
        // with JSON, don't force numerics
        _jsonMapper.registerModule(new ClusterMateTypesModule(false));
        _jsonMapper.configure(JsonGenerator.Feature.AUTO_CLOSE_TARGET, false);
       
        SmileFactory sf = new SmileFactory();
        // for our data, sharing names fine, shared values are 'meh', but enable
        sf.enable(SmileGenerator.Feature.CHECK_SHARED_NAMES);
        sf.enable(SmileGenerator.Feature.CHECK_SHARED_STRING_VALUES);

        // and although we don't necessarily embed binary data, if we do, better be raw
        sf.disable(SmileGenerator.Feature.ENCODE_BINARY_AS_7BIT);
        // as to header, trailer: header, absolutely must write and require for reads;
        // trailer: let's not; harmless but useless for our uses
        sf.enable(SmileGenerator.Feature.WRITE_HEADER);
        sf.disable(SmileGenerator.Feature.WRITE_END_MARKER);
        sf.enable(SmileParser.Feature.REQUIRE_HEADER);
       
        ObjectMapper smileMapper = new ObjectMapper(sf);
        // with Smile, numerics make sense:
        smileMapper.registerModule(new ClusterMateTypesModule(true));
View Full Code Here

Examples of com.fasterxml.jackson.dataformat.smile.SmileFactory

    }

    @Override
    public synchronized ObjectMapper getDefaultMapper() {
        if (_defaultMapper == null) {
            _defaultMapper = new ObjectMapper(new SmileFactory());
            _setAnnotations(_defaultMapper, _defaultAnnotationsToUse);
        }
        return _defaultMapper;
    }
View Full Code Here

Examples of com.fasterxml.jackson.dataformat.smile.SmileFactory

     */
    @Override
    protected ObjectMapper mapper()
    {
        if (_mapper == null) {
            _mapper = new ObjectMapper(new SmileFactory());
            _setAnnotations(_mapper, _defaultAnnotationsToUse);
        }
        return _mapper;
    }
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.