Class ViewUtils
java.lang.Object
io.microsphere.spring.webmvc.util.ViewUtils
- All Implemented Interfaces:
io.microsphere.util.Utils
View Utilities class- Since:
- 1.0.0
- Author:
- Mercy
- See Also:
-
View
-
Method Summary
Modifier and TypeMethodDescriptiongetPathVariables(org.springframework.web.context.request.RequestAttributes requestAttributes) Get a Map with path variables.static org.springframework.http.HttpStatusCodegetResponseStatus(org.springframework.web.context.request.RequestAttributes requestAttributes) Get theHttpStatusCodefor theViewstatic org.springframework.http.MediaTypegetSelectedContentType(org.springframework.web.context.request.RequestAttributes requestAttributes) Get theMediaTypeselected during content negotiation, which may be more specific than the one the View is configured with.
-
Method Details
-
getResponseStatus
@Nullable public static org.springframework.http.HttpStatusCode getResponseStatus(org.springframework.web.context.request.RequestAttributes requestAttributes) Get theHttpStatusCodefor theView- Parameters:
requestAttributes- theRequestAttributes- Returns:
- the
HttpStatusCodeif set, otherwisenull - 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- theRequestAttributes- 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 theMediaTypeselected 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- theRequestAttributes- Returns:
- the
MediaTypeif selected, otherwisenull - See Also:
-
View.SELECTED_CONTENT_TYPE
-