Class ViewUtils

java.lang.Object
io.microsphere.spring.webmvc.util.ViewUtils
All Implemented Interfaces:
io.microsphere.util.Utils

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

    Modifier and Type
    Method
    Description
    static Map<String,Object>
    getPathVariables(org.springframework.web.context.request.RequestAttributes requestAttributes)
    Get a Map with path variables.
    static org.springframework.http.HttpStatusCode
    getResponseStatus(org.springframework.web.context.request.RequestAttributes requestAttributes)
    Get the HttpStatusCode 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 Details

    • getResponseStatus

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

      @Nullable public static Map<String,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