Skip to content

io microsphere spring webmvc util WebMvcUtils

github-actions[bot] edited this page Jun 18, 2026 · 18 revisions

WebMvcUtils

Type: Class | Module: microsphere-spring-webmvc | Package: io.microsphere.spring.webmvc.util | Since: 1.0.0

Source: microsphere-spring-webmvc/src/main/java/io/microsphere/spring/webmvc/util/WebMvcUtils.java

Overview

Spring Web MVC Utilities Class

Declaration

public abstract class WebMvcUtils implements Utils

Author: Mercy

Version Information

  • Introduced in: 1.0.0
  • Current Project Version: 0.2.27-SNAPSHOT

Version Compatibility

This component is tested and compatible with the following Java versions:

Java Version Status
Java 17 ✅ Compatible
Java 21 ✅ Compatible
Java 25 ✅ Compatible

Usage

Maven Dependency

Add the following dependency to your pom.xml:

<dependency>
    <groupId>io.github.microsphere-projects</groupId>
    <artifactId>microsphere-spring-webmvc</artifactId>
    <version>${microsphere-spring.version}</version>
</dependency>

Tip: Use the BOM (microsphere-spring-dependencies) for consistent version management. See the Getting Started guide.

Import

import io.microsphere.spring.webmvc.util.WebMvcUtils;

API Reference

Public Methods

Method Description
getHttpServletRequest The supported HttpMessageConverter types
getHttpServletRequest
getWebApplicationContext Gets the WebApplicationContext associated with the current Servlet Request request
getWebApplicationContext Get the WebApplicationContext from HttpServletRequest
setHandlerMethodRequestBodyArgument Set the RequestBody @RequestBody method parameter in HandlerMethod to the HttpServletRequest context
setHandlerMethodRequestBodyArgument Set the RequestBody @RequestBody method parameter in HandlerMethod to the HttpServletRequest context
setHandlerMethodReturnValue Set the return value of the HandlerMethod to the HttpServletRequest context
setHandlerMethodReturnValue Set the return value of the HandlerMethod to the HttpServletRequest context
getHandlerMethodRequestBodyArgument Gets the RequestBody @RequestBody method parameter from the HttpServletRequest context
getHandlerMethodRequestBodyArgument Gets the RequestBody @RequestBody method parameter from the HttpServletRequest context
getHandlerMethodRequestBodyArgument Gets the RequestBody @RequestBody method parameter from the HttpServletRequest context
getHandlerMethodRequestBodyArgument Gets the RequestBody @RequestBody method parameter from the HttpServletRequest context
getHandlerMethodArguments Gets the HandlerMethod method parameter
getHandlerMethodArguments Gets the HandlerMethod method parameter
getHandlerMethodArguments Gets the HandlerMethod method parameter
getHandlerMethodArguments Gets the HandlerMethod method parameter
getHandlerMethodReturnValue
getHandlerMethodReturnValue Gets the value returned by the HandlerMethod method
getHandlerMethodReturnValue Gets the value returned by the HandlerMethod method
getHandlerMethodReturnValue Gets the value returned by the HandlerMethod method

Method Details

getHttpServletRequest

public static HttpServletRequest getHttpServletRequest()

The supported HttpMessageConverter types / public static final Set>> SUPPORTED_CONVERTER_TYPES = ofSet(MappingJackson2HttpMessageConverter.class, StringHttpMessageConverter.class);

/** Any number of these characters are considered delimiters between multiple values in a single init-param String value.

getWebApplicationContext

public static WebApplicationContext getWebApplicationContext()

Gets the WebApplicationContext associated with the current Servlet Request request

getWebApplicationContext

public static WebApplicationContext getWebApplicationContext(HttpServletRequest request, @Nullable ServletContext servletContext)

Get the WebApplicationContext from HttpServletRequest

setHandlerMethodRequestBodyArgument

public static void setHandlerMethodRequestBodyArgument(Method method, Object requestBodyArgument)

Set the RequestBody @RequestBody method parameter in HandlerMethod to the HttpServletRequest context

setHandlerMethodRequestBodyArgument

public static void setHandlerMethodRequestBodyArgument(HttpServletRequest request, Method method, Object requestBodyArgument)

Set the RequestBody @RequestBody method parameter in HandlerMethod to the HttpServletRequest context

setHandlerMethodReturnValue

public static void setHandlerMethodReturnValue(Method method, Object returnValue)

Set the return value of the HandlerMethod to the HttpServletRequest context

setHandlerMethodReturnValue

public static void setHandlerMethodReturnValue(HttpServletRequest request, Method method, Object returnValue)

Set the return value of the HandlerMethod to the HttpServletRequest context

getHandlerMethodRequestBodyArgument

public static <T> T getHandlerMethodRequestBodyArgument(HandlerMethod handlerMethod)

Gets the RequestBody @RequestBody method parameter from the HttpServletRequest context

getHandlerMethodRequestBodyArgument

public static <T> T getHandlerMethodRequestBodyArgument(HttpServletRequest request, HandlerMethod handlerMethod)

Gets the RequestBody @RequestBody method parameter from the HttpServletRequest context

getHandlerMethodRequestBodyArgument

public static <T> T getHandlerMethodRequestBodyArgument(Method method)

Gets the RequestBody @RequestBody method parameter from the HttpServletRequest context

getHandlerMethodRequestBodyArgument

public static <T> T getHandlerMethodRequestBodyArgument(HttpServletRequest request, Method method)

Gets the RequestBody @RequestBody method parameter from the HttpServletRequest context

getHandlerMethodReturnValue

public static <T> T getHandlerMethodReturnValue(HttpServletRequest request, HandlerMethod handlerMethod)

Gets the value returned by the HandlerMethod method

getHandlerMethodReturnValue

public static <T> T getHandlerMethodReturnValue(Method method)

Gets the value returned by the HandlerMethod method

getHandlerMethodReturnValue

public static <T> T getHandlerMethodReturnValue(HttpServletRequest request, Method method)

Gets the value returned by the HandlerMethod method


This documentation was auto-generated from the source code of microsphere-spring.

Home

spring-context

spring-guice

spring-jdbc

spring-test

spring-web

spring-webflux

spring-webmvc

Clone this wiki locally