Top Description Fields Constructors Methods
org.springframework.web.servlet.config

public abstract Class MvcNamespaceUtils

extends Object
Class Inheritance
Imports
java.util.LinkedHashMap, .Map, org.springframework.beans.factory.BeanFactory, org.springframework.beans.factory.config.BeanDefinition, .RuntimeBeanReference, org.springframework.beans.factory.parsing.BeanComponentDefinition, org.springframework.beans.factory.support.BeanDefinitionRegistry, .RootBeanDefinition, org.springframework.beans.factory.xml.ParserContext, org.springframework.lang.Nullable, org.springframework.util.AntPathMatcher, .PathMatcher, org.springframework.web.cors.CorsConfiguration, org.springframework.web.servlet.DispatcherServlet, org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping, .HandlerMappingIntrospector, org.springframework.web.servlet.i18n.AcceptHeaderLocaleResolver, org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter, .SimpleControllerHandlerAdapter, org.springframework.web.servlet.support.SessionFlashMapManager, org.springframework.web.servlet.view.DefaultRequestToViewNameTranslator, org.springframework.web.util.UrlPathHelper

Convenience methods for use in MVC namespace BeanDefinitionParsers.
Authors
Rossen Stoyanchev, Juergen Hoeller, Brian Clozel, Marten Deinum
Since
3.1

Field Summary

Modifier and TypeField and Description
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private static boolean
containsBeanInHierarchy(ParserContext context, String beanName)

Check for an existing bean of the given name, ideally in the entire context hierarchy (through a containsBean call) since this is also what DispatcherServlet does, or otherwise just in the local context (through containsBeanDefinition).

public static Object

Returns:

a bean definition, bean reference, or null if none defined
getContentNegotiationManager
(ParserContext context)

Find the ContentNegotiationManager bean created by or registered with the annotation-driven element.

private static void
registerBeanNameUrlHandlerMapping(ParserContext context, Object source)

Registers an HttpRequestHandlerAdapter under a well-known name unless already registered.

public static RuntimeBeanReference

Returns:

a RuntimeBeanReference to this Map<String, CorsConfiguration> instance
registerCorsConfigurations
(Map<String, CorsConfiguration> corsConfigurations, ParserContext context, Object source)

Registers a Map<String, CorsConfiguration> (mapped CorsConfigurations) under a well-known name unless already registered.

public static void
private static void
registerFlashMapManager(ParserContext context, Object source)

Registers an SessionFlashMapManager under a well-known name unless already registered.

private static void
registerHandlerMappingIntrospector(ParserContext context, Object source)

Registers an HandlerMappingIntrospector under a well-known name unless already registered.

private static void
registerHttpRequestHandlerAdapter(ParserContext context, Object source)

Registers an HttpRequestHandlerAdapter under a well-known name unless already registered.

private static void
registerLocaleResolver(ParserContext context, Object source)

Registers an AcceptHeaderLocaleResolver under a well-known name unless already registered.

public static RuntimeBeanReference

Returns:

a RuntimeBeanReference to this PathMatcher instance
registerPathMatcher
(RuntimeBeanReference pathMatcherRef, ParserContext context, Object source)

Adds an alias to an existing well-known name or registers a new instance of a PathMatcher under that well-known name, unless already registered.

private static void
registerSimpleControllerHandlerAdapter(ParserContext context, Object source)

Registers a SimpleControllerHandlerAdapter under a well-known name unless already registered.

private static void
registerThemeResolver(ParserContext context, Object source)

Registers an org.springframework.web.servlet.theme.FixedThemeResolver under a well-known name unless already registered.

public static RuntimeBeanReference

Returns:

a RuntimeBeanReference to this UrlPathHelper instance
registerUrlPathHelper
(RuntimeBeanReference urlPathHelperRef, ParserContext context, Object source)

Adds an alias to an existing well-known name or registers a new instance of a UrlPathHelper under that well-known name, unless already registered.

private static void
registerViewNameTranslator(ParserContext context, Object source)

Registers an DefaultRequestToViewNameTranslator under a well-known name unless already registered.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

BEAN_NAME_URL_HANDLER_MAPPING_BEAN_NAMEback to summary
private static final String BEAN_NAME_URL_HANDLER_MAPPING_BEAN_NAME
CORS_CONFIGURATION_BEAN_NAMEback to summary
private static final String CORS_CONFIGURATION_BEAN_NAME
HANDLER_MAPPING_INTROSPECTOR_BEAN_NAMEback to summary
private static final String HANDLER_MAPPING_INTROSPECTOR_BEAN_NAME
HTTP_REQUEST_HANDLER_ADAPTER_BEAN_NAMEback to summary
private static final String HTTP_REQUEST_HANDLER_ADAPTER_BEAN_NAME
PATH_MATCHER_BEAN_NAMEback to summary
private static final String PATH_MATCHER_BEAN_NAME
SIMPLE_CONTROLLER_HANDLER_ADAPTER_BEAN_NAMEback to summary
private static final String SIMPLE_CONTROLLER_HANDLER_ADAPTER_BEAN_NAME
URL_PATH_HELPER_BEAN_NAMEback to summary
private static final String URL_PATH_HELPER_BEAN_NAME

Constructor Detail

MvcNamespaceUtilsback to summary
public MvcNamespaceUtils()

Method Detail

containsBeanInHierarchyback to summary
private static boolean containsBeanInHierarchy(ParserContext context, String beanName)

Check for an existing bean of the given name, ideally in the entire context hierarchy (through a containsBean call) since this is also what DispatcherServlet does, or otherwise just in the local context (through containsBeanDefinition).

getContentNegotiationManagerback to summary
public static Object getContentNegotiationManager(ParserContext context)

Find the ContentNegotiationManager bean created by or registered with the annotation-driven element.

Returns:Object

a bean definition, bean reference, or null if none defined

Annotations
@Nullable
registerBeanNameUrlHandlerMappingback to summary
private static void registerBeanNameUrlHandlerMapping(ParserContext context, Object source)

Registers an HttpRequestHandlerAdapter under a well-known name unless already registered.

registerCorsConfigurationsback to summary
public static RuntimeBeanReference registerCorsConfigurations(Map<String, CorsConfiguration> corsConfigurations, ParserContext context, Object source)

Registers a Map<String, CorsConfiguration> (mapped CorsConfigurations) under a well-known name unless already registered. The bean definition may be updated if a non-null CORS configuration is provided.

Returns:RuntimeBeanReference

a RuntimeBeanReference to this Map<String, CorsConfiguration> instance

registerDefaultComponentsback to summary
public static void registerDefaultComponents(ParserContext context, Object source)
registerFlashMapManagerback to summary
private static void registerFlashMapManager(ParserContext context, Object source)

Registers an SessionFlashMapManager under a well-known name unless already registered.

registerHandlerMappingIntrospectorback to summary
private static void registerHandlerMappingIntrospector(ParserContext context, Object source)

Registers an HandlerMappingIntrospector under a well-known name unless already registered.

registerHttpRequestHandlerAdapterback to summary
private static void registerHttpRequestHandlerAdapter(ParserContext context, Object source)

Registers an HttpRequestHandlerAdapter under a well-known name unless already registered.

registerLocaleResolverback to summary
private static void registerLocaleResolver(ParserContext context, Object source)

Registers an AcceptHeaderLocaleResolver under a well-known name unless already registered.

registerPathMatcherback to summary
public static RuntimeBeanReference registerPathMatcher(RuntimeBeanReference pathMatcherRef, ParserContext context, Object source)

Adds an alias to an existing well-known name or registers a new instance of a PathMatcher under that well-known name, unless already registered.

Returns:RuntimeBeanReference

a RuntimeBeanReference to this PathMatcher instance

registerSimpleControllerHandlerAdapterback to summary
private static void registerSimpleControllerHandlerAdapter(ParserContext context, Object source)

Registers a SimpleControllerHandlerAdapter under a well-known name unless already registered.

registerThemeResolverback to summary
private static void registerThemeResolver(ParserContext context, Object source)

Registers an org.springframework.web.servlet.theme.FixedThemeResolver under a well-known name unless already registered.

Annotations
@SuppressWarnings:deprecation
registerUrlPathHelperback to summary
public static RuntimeBeanReference registerUrlPathHelper(RuntimeBeanReference urlPathHelperRef, ParserContext context, Object source)

Adds an alias to an existing well-known name or registers a new instance of a UrlPathHelper under that well-known name, unless already registered.

Returns:RuntimeBeanReference

a RuntimeBeanReference to this UrlPathHelper instance

registerViewNameTranslatorback to summary
private static void registerViewNameTranslator(ParserContext context, Object source)

Registers an DefaultRequestToViewNameTranslator under a well-known name unless already registered.