All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.atmosphere.jackson.JacksonSerializer Maven / Gradle / Ivy

There is a newer version: 1.0.18.vaadin3
Show newest version
package org.atmosphere.jackson;

import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.atmosphere.gwt.server.JSONSerializer;
import org.atmosphere.gwt.server.SerializationException;

/**
 *
 * @author p.havelaar
 */
public class JacksonSerializer implements JSONSerializer {

    final JacksonSerializerProvider provider;

    public JacksonSerializer(JacksonSerializerProvider provider) {
        this.provider = provider;
    }
    

    @Override
    public String serialize(Object data) throws SerializationException {
        try {
            return provider.mapper.writeValueAsString(data);
        } catch (IOException ex) {
            throw new SerializationException("Failed to serialize data", ex);
        }
    }
    
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy