Class ViewUtils

  • All Implemented Interfaces:
    io.microsphere.util.Utils

    public abstract class ViewUtils
    extends java.lang.Object
    implements io.microsphere.util.Utils
    View Utilities class
    Since:
    1.0.0
    Author:
    Mercy
    See Also:
    View
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.Map<java.lang.String,​java.lang.Object> getPathVariables​(org.springframework.web.context.request.RequestAttributes requestAttributes)
      Get a Map with path variables.
      static org.springframework.http.HttpStatus getResponseStatus​(org.springframework.web.context.request.RequestAttributes requestAttributes)
      Get the HttpStatus for the View
      static org.springframework.http.MediaType getSelectedContentType​(org.springframework.web.context.request.RequestAttributes requestAttributes)
      Get the MediaType selected during content negotiation, which may be more specific than the one the View is configured with.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getResponseStatus

        @Nullable
        public static org.springframework.http.HttpStatus getResponseStatus​(org.springframework.web.context.request.RequestAttributes requestAttributes)
        Get the HttpStatus for the View
        Parameters:
        requestAttributes - the RequestAttributes
        Returns:
        the HttpStatus if set, otherwise null
        See Also:
        View.RESPONSE_STATUS_ATTRIBUTE
      • getPathVariables

        @Nullable
        public static java.util.Map<java.lang.String,​java.lang.Object> getPathVariables​(org.springframework.web.context.request.RequestAttributes requestAttributes)
        Get 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.
        Parameters:
        requestAttributes - the RequestAttributes
        Returns:
        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.
        See Also:
        View.PATH_VARIABLES
      • getSelectedContentType

        @Nullable
        public static org.springframework.http.MediaType getSelectedContentType​(org.springframework.web.context.request.RequestAttributes requestAttributes)
        Get 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".
        Parameters:
        requestAttributes - the RequestAttributes
        Returns:
        the MediaType if selected, otherwise null
        See Also:
        View.SELECTED_CONTENT_TYPE