Package com.fasterxml.jackson.core

Examples of com.fasterxml.jackson.core.JsonEncoding


  @Override
  protected void writeInternal(Object object, HttpOutputMessage outputMessage)
      throws IOException, HttpMessageNotWritableException {

    JsonEncoding encoding = getJsonEncoding(outputMessage.getHeaders().getContentType());
    JsonGenerator jsonGenerator =
        this.objectMapper.getJsonFactory().createJsonGenerator(outputMessage.getBody(), encoding);

    // A workaround for JsonGenerators not applying serialization features
    // https://github.com/FasterXML/jackson-databind/issues/12
View Full Code Here


import static org.junit.Assert.assertEquals;

public class MessagePackFactoryTest extends MessagePackDataformatTestBase {
    @Test
    public void testCreateGenerator() throws IOException {
        JsonEncoding enc = JsonEncoding.UTF8;
        JsonGenerator generator = factory.createGenerator(out, enc);
        assertEquals(MessagePackGenerator.class, generator.getClass());
    }
View Full Code Here

  }

  @Override
  protected void writeInternal(Object o, HttpOutputMessage outputMessage) throws IOException,
      HttpMessageNotWritableException {
    JsonEncoding encoding = getEncoding(outputMessage.getHeaders().getContentType());
    JsonGenerator jsonGenerator = getObjectMapper().getJsonFactory().createJsonGenerator(outputMessage.getBody(),
        encoding);
    try {
      if (prefixJson) {
        jsonGenerator.writeRaw("{} && ");
View Full Code Here

  @Override
  protected void writeInternal(Object object, HttpOutputMessage outputMessage)
      throws IOException, HttpMessageNotWritableException {

    JsonEncoding encoding = getJsonEncoding(outputMessage.getHeaders().getContentType());
    JsonGenerator generator = this.objectMapper.getFactory().createGenerator(outputMessage.getBody(), encoding);
    try {
      writePrefix(generator, object);
      Class<?> serializationView = null;
      Object value = object;
View Full Code Here

  @Override
  public Object convertToInternal(Object payload, MessageHeaders headers) {
    try {
      if (byte[].class.equals(getSerializedPayloadClass())) {
        ByteArrayOutputStream out = new ByteArrayOutputStream(1024);
        JsonEncoding encoding = getJsonEncoding(getMimeType(headers));
        JsonGenerator generator = this.objectMapper.getFactory().createGenerator(out, encoding);
        this.objectMapper.writeValue(generator, payload);
        payload = out.toByteArray();
      }
      else {
View Full Code Here

            super.writeInternal(object, outputMessage);
        }
    }
    protected void writeView(DataView view, HttpOutputMessage outputMessage)
            throws IOException, HttpMessageNotWritableException {
        JsonEncoding encoding = getJsonEncoding(outputMessage.getHeaders().getContentType());
        ObjectWriter writer = getWriterForView(view.getView());
        JsonGenerator jsonGenerator =
                writer.getFactory().createGenerator(outputMessage.getBody(), encoding);
        try {
            writer.writeValue(jsonGenerator, view.getData());
View Full Code Here

       }

      /* 27-Feb-2009, tatu: Where can we find desired encoding? Within
      *   HTTP headers?
      */
      JsonEncoding enc = findEncoding(mediaType, httpHeaders);
      JsonGenerator jg = writer.getFactory().createGenerator(entityStream, enc);

      try {
         // Want indentation?
         if (writer.isEnabled(SerializationFeature.INDENT_OUTPUT) || withIndentOutput) {
View Full Code Here

TOP

Related Classes of com.fasterxml.jackson.core.JsonEncoding

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.