Class FastJsonJsonView

  • All Implemented Interfaces:
    org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanNameAware, org.springframework.context.ApplicationContextAware, org.springframework.web.context.ServletContextAware, org.springframework.web.servlet.View

    public class FastJsonJsonView
    extends org.springframework.web.servlet.view.AbstractView
    Fastjson for Spring MVC View.
    Since:
    1.2.9
    Author:
    libinsong1204@gmail.com, VictorZeng
    See Also:
    AbstractView
    • Constructor Detail

      • FastJsonJsonView

        public FastJsonJsonView()
        Set default param.
    • Method Detail

      • getFastJsonConfig

        public FastJsonConfig getFastJsonConfig()
        Returns:
        the fastJsonConfig.
        Since:
        1.2.11
      • setFastJsonConfig

        public void setFastJsonConfig​(FastJsonConfig fastJsonConfig)
        Parameters:
        fastJsonConfig - the fastJsonConfig to set.
        Since:
        1.2.11
      • setRenderedAttributes

        public void setRenderedAttributes​(Set<String> renderedAttributes)
        Set renderedAttributes.
        Parameters:
        renderedAttributes - renderedAttributes
      • isExtractValueFromSingleKeyModel

        public boolean isExtractValueFromSingleKeyModel()
        Check extractValueFromSingleKeyModel.
        Returns:
        extractValueFromSingleKeyModel
      • setExtractValueFromSingleKeyModel

        public void setExtractValueFromSingleKeyModel​(boolean extractValueFromSingleKeyModel)
        Set extractValueFromSingleKeyModel.
        Parameters:
        extractValueFromSingleKeyModel -
      • setJsonpParameterNames

        public void setJsonpParameterNames​(Set<String> jsonpParameterNames)
        Set JSONP request parameter names. Each time a request has one of those parameters, the resulting JSON will be wrapped into a function named as specified by the JSONP request parameter value.

        The parameter names configured by default are "jsonp" and "callback".

        Since:
        4.1
        See Also:
        JSONP Wikipedia article
      • renderMergedOutputModel

        protected void renderMergedOutputModel​(Map<String,​Object> model,
                                               javax.servlet.http.HttpServletRequest request,
                                               javax.servlet.http.HttpServletResponse response)
                                        throws Exception
        Specified by:
        renderMergedOutputModel in class org.springframework.web.servlet.view.AbstractView
        Throws:
        Exception
      • prepareResponse

        protected void prepareResponse​(javax.servlet.http.HttpServletRequest request,
                                       javax.servlet.http.HttpServletResponse response)
        Overrides:
        prepareResponse in class org.springframework.web.servlet.view.AbstractView
      • setDisableCaching

        public void setDisableCaching​(boolean disableCaching)
        Disables caching of the generated JSON.

        Default is true, which will prevent the client from caching the generated JSON.

      • setUpdateContentLength

        public void setUpdateContentLength​(boolean updateContentLength)
        Whether to update the 'Content-Length' header of the response. When set to true, the response is buffered in order to determine the content length and set the 'Content-Length' header of the response.

        The default setting is false.

      • setResponseContentType

        protected void setResponseContentType​(javax.servlet.http.HttpServletRequest request,
                                              javax.servlet.http.HttpServletResponse response)
        Overrides:
        setResponseContentType in class org.springframework.web.servlet.view.AbstractView