Interface View

    • Field Detail

      • PATH_VARIABLES

        static final String PATH_VARIABLES
        Name of the HttpServletRequest attribute that contains a Map with path variables. The map consists of String-based URI template variable names as keys and their corresponding Object-based values -- extracted from segments of the URL and type converted.

        Note: This attribute is not required to be supported by all View implementations.

        Since:
        3.1
      • SELECTED_CONTENT_TYPE

        static final String SELECTED_CONTENT_TYPE
        The MediaType selected during content negotiation, which may be more specific than the one the View is configured with. For example: "application/vnd.example-v1+xml" vs "application/*+xml".
        Since:
        3.2
    • Method Detail

      • getContentType

        String getContentType()
        Return the content type of the view, if predetermined.

        Can be used to check the view's content type upfront, i.e. before an actual rendering attempt.

        Returns:
        the content type String (optionally including a character set), or null if not predetermined
      • render

        void render​(Map<String,​?> model,
                    HttpServletRequest request,
                    HttpServletResponse response)
             throws Exception
        Render the view given the specified model.

        The first step will be preparing the request: In the JSP case, this would mean setting model objects as request attributes. The second step will be the actual rendering of the view, for example including the JSP via a RequestDispatcher.

        Parameters:
        model - Map with name Strings as keys and corresponding model objects as values (Map can also be null in case of empty model)
        request - current HTTP request
        response - HTTP response we are building
        Throws:
        Exception - if rendering failed