com.alibaba.fastjson2.support.spring6.http.codec.Fastjson2Decoder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fastjson2-extension-spring6 Show documentation
Show all versions of fastjson2-extension-spring6 Show documentation
Fastjson is a JSON processor (JSON parser + JSON generator) written in Java
package com.alibaba.fastjson2.support.spring6.http.codec;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONException;
import com.alibaba.fastjson2.support.config.FastJsonConfig;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.reactivestreams.Publisher;
import org.springframework.core.ResolvableType;
import org.springframework.core.codec.DecodingException;
import org.springframework.core.codec.Hints;
import org.springframework.core.io.buffer.DataBuffer;
import org.springframework.core.io.buffer.DataBufferUtils;
import org.springframework.core.log.LogFormatUtils;
import org.springframework.http.codec.json.AbstractJackson2Decoder;
import org.springframework.lang.NonNull;
import org.springframework.lang.Nullable;
import org.springframework.util.MimeType;
import reactor.core.publisher.Flux;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Map;
/**
* Fastjson2 for Spring WebFlux.
*
* @author Xi.Liu
* @see AbstractJackson2Decoder
*/
public class Fastjson2Decoder
extends AbstractJackson2Decoder {
private final FastJsonConfig config;
public Fastjson2Decoder(ObjectMapper mapper, MimeType... mimeTypes) {
super(mapper, mimeTypes);
this.config = new FastJsonConfig();
}
public Fastjson2Decoder(ObjectMapper mapper, FastJsonConfig config, MimeType... mimeTypes) {
super(mapper, mimeTypes);
this.config = config;
}
@NonNull
@Override
public Flux