Class FormReaderHttpMessageConverter

  • All Implemented Interfaces:
    org.springframework.http.converter.GenericHttpMessageConverter<Object>, org.springframework.http.converter.HttpMessageConverter<Object>

    public class FormReaderHttpMessageConverter
    extends org.springframework.http.converter.AbstractGenericHttpMessageConverter<Object>
    HttpMessageConverter 简单实现,可解析 application/x-www-form-urlencoded
    注意: 只支持读取, 不支持写入
    Author:
    CofCool
    • Field Summary

      • Fields inherited from class org.springframework.http.converter.AbstractHttpMessageConverter

        logger
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean canWrite​(Type type, Class<?> clazz, org.springframework.http.MediaType mediaType)  
      Object read​(Type type, Class<?> contextClass, org.springframework.http.HttpInputMessage inputMessage)  
      protected Object readInternal​(Class<?> clazz, org.springframework.http.HttpInputMessage inputMessage)  
      protected void writeInternal​(Object t, Type type, org.springframework.http.HttpOutputMessage outputMessage)  
      • Methods inherited from class org.springframework.http.converter.AbstractGenericHttpMessageConverter

        canRead, supports, write, writeInternal
      • Methods inherited from class org.springframework.http.converter.AbstractHttpMessageConverter

        addDefaultHeaders, canRead, canRead, canWrite, canWrite, getContentLength, getDefaultCharset, getDefaultContentType, getSupportedMediaTypes, read, setDefaultCharset, setSupportedMediaTypes, write
      • Methods inherited from interface org.springframework.http.converter.HttpMessageConverter

        canRead, canWrite, getSupportedMediaTypes, read, write
    • Constructor Detail

      • FormReaderHttpMessageConverter

        public FormReaderHttpMessageConverter()
    • Method Detail

      • readInternal

        protected Object readInternal​(Class<?> clazz,
                                      org.springframework.http.HttpInputMessage inputMessage)
                               throws IOException,
                                      org.springframework.http.converter.HttpMessageNotReadableException
        Specified by:
        readInternal in class org.springframework.http.converter.AbstractHttpMessageConverter<Object>
        Throws:
        IOException
        org.springframework.http.converter.HttpMessageNotReadableException
      • read

        public Object read​(Type type,
                           Class<?> contextClass,
                           org.springframework.http.HttpInputMessage inputMessage)
                    throws IOException,
                           org.springframework.http.converter.HttpMessageNotReadableException
        Throws:
        IOException
        org.springframework.http.converter.HttpMessageNotReadableException
      • canWrite

        public boolean canWrite​(Type type,
                                Class<?> clazz,
                                org.springframework.http.MediaType mediaType)
        Specified by:
        canWrite in interface org.springframework.http.converter.GenericHttpMessageConverter<Object>
        Overrides:
        canWrite in class org.springframework.http.converter.AbstractGenericHttpMessageConverter<Object>
      • writeInternal

        protected void writeInternal​(Object t,
                                     Type type,
                                     org.springframework.http.HttpOutputMessage outputMessage)
                              throws IOException,
                                     org.springframework.http.converter.HttpMessageNotWritableException
        Specified by:
        writeInternal in class org.springframework.http.converter.AbstractGenericHttpMessageConverter<Object>
        Throws:
        IOException
        org.springframework.http.converter.HttpMessageNotWritableException