@@ -0,0 +1,2721 @@
+package com.alibaba.fastjson.support.spring;%0A%0Aimport java.io.ByteArrayOutputStream;%0Aimport java.io.IOException;%0Aimport java.io.InputStream;%0Aimport java.io.OutputStream;%0Aimport java.nio.charset.Charset;%0A%0Aimport org.springframework.http.HttpInputMessage;%0Aimport org.springframework.http.HttpOutputMessage;%0Aimport org.springframework.http.converter.AbstractHttpMessageConverter;%0Aimport org.springframework.http.converter.HttpMessageNotReadableException;%0Aimport org.springframework.http.converter.HttpMessageNotWritableException;%0A%0Aimport com.alibaba.fastjson.JSON;%0Aimport com.alibaba.fastjson.serializer.SerializerFeature;%0A%0Apublic class FastJsonHttpMessageConverter extends AbstractHttpMessageConverter%3CObject%3E %7B%0A%0A    public final static Charset UTF8    = Charset.forName(%22UTF-8%22);%0A%0A    private Charset             charset = UTF8;%0A%0A    private SerializerFeature%5B%5D serializerFeature;%0A%0A    @Override%0A    protected boolean supports(Class%3C? extends Object%3E clazz) %7B%0A        return true;%0A    %7D%0A%0A    @Override%0A    protected Object readInternal(Class%3CObject%3E clazz, HttpInputMessage inputMessage) throws IOException,%0A                                                                                     HttpMessageNotReadableException %7B%0A%0A        ByteArrayOutputStream baos = new ByteArrayOutputStream();%0A%0A        InputStream in = inputMessage.getBody();%0A%0A        byte%5B%5D buf = new byte%5B1024%5D;%0A        for (;;) %7B%0A            int len = in.read(buf);%0A            if (len == -1) %7B%0A                break;%0A            %7D%0A%0A            if (len %3E 0) %7B%0A                baos.write(buf, 0, len);%0A            %7D%0A        %7D%0A%0A        byte%5B%5D bytes = baos.toByteArray();%0A        if (charset == UTF8) %7B%0A            return JSON.parseObject(bytes, clazz);%0A        %7D else %7B%0A            return JSON.parseObject(bytes, 0, bytes.length, charset.newDecoder(), clazz);%0A        %7D%0A    %7D%0A%0A    @Override%0A    protected void writeInternal(Object obj, HttpOutputMessage outputMessage) throws IOException,%0A                                                                             HttpMessageNotWritableException %7B%0A%0A        OutputStream out = outputMessage.getBody();%0A        byte%5B%5D bytes;%0A        %0A        if (charset == UTF8) %7B%0A            if (serializerFeature != null) %7B%0A                bytes = JSON.toJSONBytes(obj, serializerFeature);%0A            %7D else %7B%0A                bytes = JSON.toJSONBytes(obj);%0A            %7D%0A            %0A        %7D else %7B%0A            String text;%0A            if (serializerFeature != null) %7B%0A                text = JSON.toJSONString(obj, serializerFeature);%0A            %7D else %7B%0A                text = JSON.toJSONString(obj);%0A            %7D%0A            bytes = text.getBytes(charset);%0A        %7D%0A        %0A        out.write(bytes);%0A    %7D%0A%0A%7D%0A

add spring-web support