Java Code Examples for org.springframework.beans.factory.support.ManagedList#add()
The following examples show how to use
org.springframework.beans.factory.support.ManagedList#add() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DefaultsBeanDefinitionParser.java From jdal with Apache License 2.0 | 6 votes |
/** * Register default TablePanel Actions * @param element current element * @param parserContext parserContext * @return a new ComponentDefinition with default table action list. */ private ComponentDefinition registerDefaultTableActions(Element element, ParserContext parserContext) { ManagedList<Object> actions = new ManagedList<Object>(7); actions.add(createBeanDefinition(AddAction.class, parserContext)); actions.add(createBeanDefinition(RefreshAction.class, parserContext)); actions.add(createBeanDefinition(RemoveAction.class, parserContext)); actions.add(createBeanDefinition(FindAction.class, parserContext)); actions.add(createBeanDefinition(ClearFilterAction.class, parserContext)); BeanDefinitionBuilder bdb = BeanDefinitionBuilder.genericBeanDefinition(ListFactoryBean.class); bdb.getRawBeanDefinition().setSource(parserContext.extractSource(element)); bdb.addPropertyValue("sourceList", actions); bdb.setScope(BeanDefinition.SCOPE_PROTOTYPE); BeanComponentDefinition bcd = new BeanComponentDefinition(bdb.getBeanDefinition(), DEFAULT_TABLE_ACTIONS); registerBeanComponentDefinition(element, parserContext, bcd); return bcd; }
Example 2
Source File: DatasourceBeanDefinitionParser.java From compass with Apache License 2.0 | 6 votes |
private void parseSlaveDataSources( List<Element> slaveElements, BeanDefinitionBuilder masterSlaveDataSourceBeanDefinitionBuilder, ParserContext parserContext, String masterSlaveDataSourceId, String dataSourcePrototypeAttributeValue) { ManagedList<AbstractBeanDefinition> slaveBeanDefinitions = new ManagedList<AbstractBeanDefinition>(slaveElements.size()); int index=0; for (Element slaveElement : slaveElements) { index++; AbstractBeanDefinition slaveBeanDefinition=this.createSlaveBeanDefinition( index, slaveElement, masterSlaveDataSourceId, dataSourcePrototypeAttributeValue, parserContext); slaveBeanDefinitions.add(slaveBeanDefinition); } masterSlaveDataSourceBeanDefinitionBuilder.addPropertyValue(MasterSlaveDataSource.SLAVE_DATA_SOURCES_PROPERTY_NAME, slaveBeanDefinitions); }
Example 3
Source File: DictionaryBeanFactoryPostProcessor.java From rice with Educational Community License v2.0 | 6 votes |
/** * Iterates through the list values and calls helpers to process the value * * @param listVal the list to process * @param propertyName name of the property which has the list value * @param nestedBeanStack stack of bean containers which contains the list property */ protected void visitList(List<?> listVal, String propertyName, Stack<BeanDefinitionHolder> nestedBeanStack) { boolean isMergeEnabled = false; if (listVal instanceof ManagedList) { isMergeEnabled = ((ManagedList) listVal).isMergeEnabled(); } ManagedList newList = new ManagedList(); newList.setMergeEnabled(isMergeEnabled); for (int i = 0; i < listVal.size(); i++) { Object elem = listVal.get(i); if (isStringValue(elem)) { elem = processListStringPropertyValue(propertyName, listVal, getString(elem), i, nestedBeanStack, beanProcessors); } else { elem = visitPropertyValue(propertyName, elem, nestedBeanStack); } newList.add(i, elem); } listVal.clear(); listVal.addAll(newList); }
Example 4
Source File: ViewResolversBeanDefinitionParser.java From spring4-understanding with Apache License 2.0 | 6 votes |
private BeanDefinition createContentNegotiatingViewResolver(Element resolverElement, ParserContext context) { RootBeanDefinition beanDef = new RootBeanDefinition(ContentNegotiatingViewResolver.class); beanDef.setSource(context.extractSource(resolverElement)); beanDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE); MutablePropertyValues values = beanDef.getPropertyValues(); List<Element> elements = DomUtils.getChildElementsByTagName(resolverElement, new String[] {"default-views"}); if (!elements.isEmpty()) { ManagedList<Object> list = new ManagedList<Object>(); for (Element element : DomUtils.getChildElementsByTagName(elements.get(0), "bean", "ref")) { list.add(context.getDelegate().parsePropertySubElement(element, null)); } values.add("defaultViews", list); } if (resolverElement.hasAttribute("use-not-acceptable")) { values.add("useNotAcceptableStatusCode", resolverElement.getAttribute("use-not-acceptable")); } Object manager = getContentNegotiationManager(context); if (manager != null) { values.add("contentNegotiationManager", manager); } return beanDef; }
Example 5
Source File: AnnotationDrivenBeanDefinitionParser.java From spring4-understanding with Apache License 2.0 | 6 votes |
private ManagedList<?> getDeferredResultInterceptors(Element element, Object source, ParserContext parserContext) { ManagedList<? super Object> interceptors = new ManagedList<Object>(); Element asyncElement = DomUtils.getChildElementByTagName(element, "async-support"); if (asyncElement != null) { Element interceptorsElement = DomUtils.getChildElementByTagName(asyncElement, "deferred-result-interceptors"); if (interceptorsElement != null) { interceptors.setSource(source); for (Element converter : DomUtils.getChildElementsByTagName(interceptorsElement, "bean")) { BeanDefinitionHolder beanDef = parserContext.getDelegate().parseBeanDefinitionElement(converter); beanDef = parserContext.getDelegate().decorateBeanDefinitionIfRequired(converter, beanDef); interceptors.add(beanDef); } } } return interceptors; }
Example 6
Source File: AnnotationDrivenBeanDefinitionParser.java From spring-analysis-note with MIT License | 6 votes |
private ManagedList<?> getCallableInterceptors( Element element, @Nullable Object source, ParserContext context) { ManagedList<Object> interceptors = new ManagedList<>(); Element asyncElement = DomUtils.getChildElementByTagName(element, "async-support"); if (asyncElement != null) { Element interceptorsElement = DomUtils.getChildElementByTagName(asyncElement, "callable-interceptors"); if (interceptorsElement != null) { interceptors.setSource(source); for (Element converter : DomUtils.getChildElementsByTagName(interceptorsElement, "bean")) { BeanDefinitionHolder beanDef = context.getDelegate().parseBeanDefinitionElement(converter); if (beanDef != null) { beanDef = context.getDelegate().decorateBeanDefinitionIfRequired(converter, beanDef); interceptors.add(beanDef); } } } } return interceptors; }
Example 7
Source File: AnnotationDrivenBeanDefinitionParser.java From lams with GNU General Public License v2.0 | 6 votes |
private ManagedList<?> getCallableInterceptors(Element element, Object source, ParserContext parserContext) { ManagedList<? super Object> interceptors = new ManagedList<Object>(); Element asyncElement = DomUtils.getChildElementByTagName(element, "async-support"); if (asyncElement != null) { Element interceptorsElement = DomUtils.getChildElementByTagName(asyncElement, "callable-interceptors"); if (interceptorsElement != null) { interceptors.setSource(source); for (Element converter : DomUtils.getChildElementsByTagName(interceptorsElement, "bean")) { BeanDefinitionHolder beanDef = parserContext.getDelegate().parseBeanDefinitionElement(converter); beanDef = parserContext.getDelegate().decorateBeanDefinitionIfRequired(converter, beanDef); interceptors.add(beanDef); } } } return interceptors; }
Example 8
Source File: AnnotationDrivenBeanDefinitionParser.java From spring-analysis-note with MIT License | 5 votes |
private ManagedList<Object> extractBeanSubElements(Element parentElement, ParserContext context) { ManagedList<Object> list = new ManagedList<>(); list.setSource(context.extractSource(parentElement)); for (Element beanElement : DomUtils.getChildElementsByTagName(parentElement, "bean", "ref")) { Object object = context.getDelegate().parsePropertySubElement(beanElement, null); list.add(object); } return list; }
Example 9
Source File: ResourcesBeanDefinitionParser.java From java-technology-stack with MIT License | 5 votes |
private void parseResourceCache(ManagedList<Object> resourceResolvers, ManagedList<Object> resourceTransformers, Element element, @Nullable Object source) { String resourceCache = element.getAttribute("resource-cache"); if ("true".equals(resourceCache)) { ConstructorArgumentValues cargs = new ConstructorArgumentValues(); RootBeanDefinition cachingResolverDef = new RootBeanDefinition(CachingResourceResolver.class); cachingResolverDef.setSource(source); cachingResolverDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE); cachingResolverDef.setConstructorArgumentValues(cargs); RootBeanDefinition cachingTransformerDef = new RootBeanDefinition(CachingResourceTransformer.class); cachingTransformerDef.setSource(source); cachingTransformerDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE); cachingTransformerDef.setConstructorArgumentValues(cargs); String cacheManagerName = element.getAttribute("cache-manager"); String cacheName = element.getAttribute("cache-name"); if (StringUtils.hasText(cacheManagerName) && StringUtils.hasText(cacheName)) { RuntimeBeanReference cacheManagerRef = new RuntimeBeanReference(cacheManagerName); cargs.addIndexedArgumentValue(0, cacheManagerRef); cargs.addIndexedArgumentValue(1, cacheName); } else { ConstructorArgumentValues cacheCavs = new ConstructorArgumentValues(); cacheCavs.addIndexedArgumentValue(0, RESOURCE_CHAIN_CACHE); RootBeanDefinition cacheDef = new RootBeanDefinition(ConcurrentMapCache.class); cacheDef.setSource(source); cacheDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE); cacheDef.setConstructorArgumentValues(cacheCavs); cargs.addIndexedArgumentValue(0, cacheDef); } resourceResolvers.add(cachingResolverDef); resourceTransformers.add(cachingTransformerDef); } }
Example 10
Source File: CacheAdviceParser.java From spring4-understanding with Apache License 2.0 | 5 votes |
private List<RootBeanDefinition> parseDefinitionsSources(List<Element> definitions, ParserContext parserContext) { ManagedList<RootBeanDefinition> defs = new ManagedList<RootBeanDefinition>(definitions.size()); // extract default param for the definition for (Element element : definitions) { defs.add(parseDefinitionSource(element, parserContext)); } return defs; }
Example 11
Source File: MessageBrokerBeanDefinitionParser.java From spring-analysis-note with MIT License | 5 votes |
private ManagedList<Object> extractBeanSubElements(Element parentElement, ParserContext context) { ManagedList<Object> list = new ManagedList<>(); list.setSource(context.extractSource(parentElement)); for (Element beanElement : DomUtils.getChildElementsByTagName(parentElement, "bean", "ref")) { Object object = context.getDelegate().parsePropertySubElement(beanElement, null); list.add(object); } return list; }
Example 12
Source File: MessageBrokerBeanDefinitionParser.java From spring-analysis-note with MIT License | 5 votes |
private RuntimeBeanReference registerMessageConverter( Element element, ParserContext context, @Nullable Object source) { Element convertersElement = DomUtils.getChildElementByTagName(element, "message-converters"); ManagedList<Object> converters = new ManagedList<>(); if (convertersElement != null) { converters.setSource(source); for (Element beanElement : DomUtils.getChildElementsByTagName(convertersElement, "bean", "ref")) { Object object = context.getDelegate().parsePropertySubElement(beanElement, null); converters.add(object); } } if (convertersElement == null || Boolean.valueOf(convertersElement.getAttribute("register-defaults"))) { converters.setSource(source); converters.add(new RootBeanDefinition(StringMessageConverter.class)); converters.add(new RootBeanDefinition(ByteArrayMessageConverter.class)); if (jackson2Present) { RootBeanDefinition jacksonConverterDef = new RootBeanDefinition(MappingJackson2MessageConverter.class); RootBeanDefinition resolverDef = new RootBeanDefinition(DefaultContentTypeResolver.class); resolverDef.getPropertyValues().add("defaultMimeType", MimeTypeUtils.APPLICATION_JSON); jacksonConverterDef.getPropertyValues().add("contentTypeResolver", resolverDef); // Use Jackson factory in order to have JSR-310 and Joda-Time modules registered automatically GenericBeanDefinition jacksonFactoryDef = new GenericBeanDefinition(); jacksonFactoryDef.setBeanClass(Jackson2ObjectMapperFactoryBean.class); jacksonFactoryDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE); jacksonFactoryDef.setSource(source); jacksonConverterDef.getPropertyValues().add("objectMapper", jacksonFactoryDef); converters.add(jacksonConverterDef); } } ConstructorArgumentValues cargs = new ConstructorArgumentValues(); cargs.addIndexedArgumentValue(0, converters); RootBeanDefinition messageConverterDef = new RootBeanDefinition(CompositeMessageConverter.class, cargs, null); String name = MESSAGE_CONVERTER_BEAN_NAME; registerBeanDefByName(name, messageConverterDef, context, source); return new RuntimeBeanReference(name); }
Example 13
Source File: JettyHTTPServerEngineFactoryBeanDefinitionParser.java From cxf with Apache License 2.0 | 5 votes |
private List<Object> getRequiredElementsList(Element parent, ParserContext ctx, QName name, BeanDefinitionBuilder bean) { List<Element> elemList = DOMUtils.findAllElementsByTagNameNS(parent, name.getNamespaceURI(), name.getLocalPart()); ManagedList<Object> list = new ManagedList<>(elemList.size()); list.setSource(ctx.extractSource(parent)); for (Element elem : elemList) { list.add(ctx.getDelegate().parsePropertySubElement(elem, bean.getBeanDefinition())); } return list; }
Example 14
Source File: InterceptorsBeanDefinitionParser.java From spring-analysis-note with MIT License | 5 votes |
private ManagedList<String> getIncludePatterns(Element interceptor, String elementName) { List<Element> paths = DomUtils.getChildElementsByTagName(interceptor, elementName); ManagedList<String> patterns = new ManagedList<>(paths.size()); for (Element path : paths) { patterns.add(path.getAttribute("path")); } return patterns; }
Example 15
Source File: CacheAdviceParser.java From spring-analysis-note with MIT License | 5 votes |
private List<RootBeanDefinition> parseDefinitionsSources(List<Element> definitions, ParserContext parserContext) { ManagedList<RootBeanDefinition> defs = new ManagedList<>(definitions.size()); // extract default param for the definition for (Element element : definitions) { defs.add(parseDefinitionSource(element, parserContext)); } return defs; }
Example 16
Source File: NettyHttpServerEngineFactoryBeanDefinitionParser.java From cxf with Apache License 2.0 | 5 votes |
private List<Object> getRequiredElementsList(Element parent, ParserContext ctx, QName name, BeanDefinitionBuilder bean) { List<Element> elemList = DOMUtils.findAllElementsByTagNameNS(parent, name.getNamespaceURI(), name.getLocalPart()); ManagedList<Object> list = new ManagedList<>(elemList.size()); list.setSource(ctx.extractSource(parent)); for (Element elem : elemList) { list.add(ctx.getDelegate().parsePropertySubElement(elem, bean.getBeanDefinition())); } return list; }
Example 17
Source File: ScheduledTasksBeanDefinitionParser.java From java-technology-stack with MIT License | 4 votes |
@Override protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { builder.setLazyInit(false); // lazy scheduled tasks are a contradiction in terms -> force to false ManagedList<RuntimeBeanReference> cronTaskList = new ManagedList<>(); ManagedList<RuntimeBeanReference> fixedDelayTaskList = new ManagedList<>(); ManagedList<RuntimeBeanReference> fixedRateTaskList = new ManagedList<>(); ManagedList<RuntimeBeanReference> triggerTaskList = new ManagedList<>(); NodeList childNodes = element.getChildNodes(); for (int i = 0; i < childNodes.getLength(); i++) { Node child = childNodes.item(i); if (!isScheduledElement(child, parserContext)) { continue; } Element taskElement = (Element) child; String ref = taskElement.getAttribute("ref"); String method = taskElement.getAttribute("method"); // Check that 'ref' and 'method' are specified if (!StringUtils.hasText(ref) || !StringUtils.hasText(method)) { parserContext.getReaderContext().error("Both 'ref' and 'method' are required", taskElement); // Continue with the possible next task element continue; } String cronAttribute = taskElement.getAttribute("cron"); String fixedDelayAttribute = taskElement.getAttribute("fixed-delay"); String fixedRateAttribute = taskElement.getAttribute("fixed-rate"); String triggerAttribute = taskElement.getAttribute("trigger"); String initialDelayAttribute = taskElement.getAttribute("initial-delay"); boolean hasCronAttribute = StringUtils.hasText(cronAttribute); boolean hasFixedDelayAttribute = StringUtils.hasText(fixedDelayAttribute); boolean hasFixedRateAttribute = StringUtils.hasText(fixedRateAttribute); boolean hasTriggerAttribute = StringUtils.hasText(triggerAttribute); boolean hasInitialDelayAttribute = StringUtils.hasText(initialDelayAttribute); if (!(hasCronAttribute || hasFixedDelayAttribute || hasFixedRateAttribute || hasTriggerAttribute)) { parserContext.getReaderContext().error( "one of the 'cron', 'fixed-delay', 'fixed-rate', or 'trigger' attributes is required", taskElement); continue; // with the possible next task element } if (hasInitialDelayAttribute && (hasCronAttribute || hasTriggerAttribute)) { parserContext.getReaderContext().error( "the 'initial-delay' attribute may not be used with cron and trigger tasks", taskElement); continue; // with the possible next task element } String runnableName = runnableReference(ref, method, taskElement, parserContext).getBeanName(); if (hasFixedDelayAttribute) { fixedDelayTaskList.add(intervalTaskReference(runnableName, initialDelayAttribute, fixedDelayAttribute, taskElement, parserContext)); } if (hasFixedRateAttribute) { fixedRateTaskList.add(intervalTaskReference(runnableName, initialDelayAttribute, fixedRateAttribute, taskElement, parserContext)); } if (hasCronAttribute) { cronTaskList.add(cronTaskReference(runnableName, cronAttribute, taskElement, parserContext)); } if (hasTriggerAttribute) { String triggerName = new RuntimeBeanReference(triggerAttribute).getBeanName(); triggerTaskList.add(triggerTaskReference(runnableName, triggerName, taskElement, parserContext)); } } String schedulerRef = element.getAttribute("scheduler"); if (StringUtils.hasText(schedulerRef)) { builder.addPropertyReference("taskScheduler", schedulerRef); } builder.addPropertyValue("cronTasksList", cronTaskList); builder.addPropertyValue("fixedDelayTasksList", fixedDelayTaskList); builder.addPropertyValue("fixedRateTasksList", fixedRateTaskList); builder.addPropertyValue("triggerTasksList", triggerTaskList); }
Example 18
Source File: HandlersBeanDefinitionParser.java From java-technology-stack with MIT License | 4 votes |
@Override @Nullable public BeanDefinition parse(Element element, ParserContext context) { Object source = context.extractSource(element); CompositeComponentDefinition compDefinition = new CompositeComponentDefinition(element.getTagName(), source); context.pushContainingComponent(compDefinition); String orderAttribute = element.getAttribute("order"); int order = orderAttribute.isEmpty() ? DEFAULT_MAPPING_ORDER : Integer.valueOf(orderAttribute); RootBeanDefinition handlerMappingDef = new RootBeanDefinition(WebSocketHandlerMapping.class); handlerMappingDef.setSource(source); handlerMappingDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE); handlerMappingDef.getPropertyValues().add("order", order); String handlerMappingName = context.getReaderContext().registerWithGeneratedName(handlerMappingDef); RuntimeBeanReference sockJsService = WebSocketNamespaceUtils.registerSockJsService( element, SOCK_JS_SCHEDULER_NAME, context, source); HandlerMappingStrategy strategy; if (sockJsService != null) { strategy = new SockJsHandlerMappingStrategy(sockJsService); } else { RuntimeBeanReference handler = WebSocketNamespaceUtils.registerHandshakeHandler(element, context, source); Element interceptElem = DomUtils.getChildElementByTagName(element, "handshake-interceptors"); ManagedList<Object> interceptors = WebSocketNamespaceUtils.parseBeanSubElements(interceptElem, context); String allowedOrigins = element.getAttribute("allowed-origins"); List<String> origins = Arrays.asList(StringUtils.tokenizeToStringArray(allowedOrigins, ",")); interceptors.add(new OriginHandshakeInterceptor(origins)); strategy = new WebSocketHandlerMappingStrategy(handler, interceptors); } ManagedMap<String, Object> urlMap = new ManagedMap<>(); urlMap.setSource(source); for (Element mappingElement : DomUtils.getChildElementsByTagName(element, "mapping")) { strategy.addMapping(mappingElement, urlMap, context); } handlerMappingDef.getPropertyValues().add("urlMap", urlMap); context.registerComponent(new BeanComponentDefinition(handlerMappingDef, handlerMappingName)); context.popAndRegisterContainingComponent(); return null; }
Example 19
Source File: RedissonLiveObjectDefinitionParser.java From redisson with Apache License 2.0 | 4 votes |
@Override protected void parseNested(Element element, ParserContext parserContext, BeanDefinitionBuilder builder, BeanDefinition bd) { Class<?> apiClass; try { apiClass = Class.forName(helper.getAttribute(element, RedissonNamespaceParserSupport.CLASS_ATTRIBUTE)); } catch (ClassNotFoundException ex) { throw new IllegalArgumentException( "The class [" + helper.getAttribute(element, RedissonNamespaceParserSupport.CLASS_ATTRIBUTE) + "] specified in \"api-class\" attribute has not " + "found. Please check the class path.", ex); } Assert.state(helper.hasAttribute(element, RedissonNamespaceParserSupport.OBJECT_ID_ATTRIBUTE) || helper.hasAttribute(element, RedissonNamespaceParserSupport.OBJECT_ID_REF_ATTRIBUTE), "One of \"" + RedissonNamespaceParserSupport.OBJECT_ID_ATTRIBUTE + "\" or \"" + RedissonNamespaceParserSupport.OBJECT_ID_REF_ATTRIBUTE + "\" attribute is required in the \"" + RedissonNamespaceParserSupport.LIVE_OBJECT_ELEMENT + "\" element."); builder.addPropertyValue("targetObject", new RuntimeBeanReference( helper.getAttribute(element, RedissonNamespaceParserSupport.LIVE_OBJECT_SERVICE_REF_ATTRIBUTE))); builder.addPropertyValue("targetMethod", "get"); ManagedList args = new ManagedList(); args.add(apiClass); if (helper.hasAttribute(element, RedissonNamespaceParserSupport.OBJECT_ID_ATTRIBUTE)) { args.add(helper.getAttribute(element, RedissonNamespaceParserSupport.OBJECT_ID_ATTRIBUTE)); } if (helper.hasAttribute(element, RedissonNamespaceParserSupport.OBJECT_ID_REF_ATTRIBUTE)) { args.add(new RuntimeBeanReference( helper.getAttribute(element, RedissonNamespaceParserSupport.OBJECT_ID_REF_ATTRIBUTE))); } builder.addPropertyValue("arguments", args); }
Example 20
Source File: HandlersBeanDefinitionParser.java From spring4-understanding with Apache License 2.0 | 4 votes |
@Override public BeanDefinition parse(Element element, ParserContext context) { Object source = context.extractSource(element); CompositeComponentDefinition compDefinition = new CompositeComponentDefinition(element.getTagName(), source); context.pushContainingComponent(compDefinition); String orderAttribute = element.getAttribute("order"); int order = orderAttribute.isEmpty() ? DEFAULT_MAPPING_ORDER : Integer.valueOf(orderAttribute); RootBeanDefinition handlerMappingDef = new RootBeanDefinition(WebSocketHandlerMapping.class); handlerMappingDef.setSource(source); handlerMappingDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE); handlerMappingDef.getPropertyValues().add("order", order); String handlerMappingName = context.getReaderContext().registerWithGeneratedName(handlerMappingDef); RuntimeBeanReference sockJsService = WebSocketNamespaceUtils.registerSockJsService( element, SOCK_JS_SCHEDULER_NAME, context, source); HandlerMappingStrategy strategy; if (sockJsService != null) { strategy = new SockJsHandlerMappingStrategy(sockJsService); } else { RuntimeBeanReference handshakeHandler = WebSocketNamespaceUtils.registerHandshakeHandler(element, context, source); Element interceptorsElement = DomUtils.getChildElementByTagName(element, "handshake-interceptors"); ManagedList<? super Object> interceptors = WebSocketNamespaceUtils.parseBeanSubElements(interceptorsElement, context); String allowedOriginsAttribute = element.getAttribute("allowed-origins"); List<String> allowedOrigins = Arrays.asList(StringUtils.tokenizeToStringArray(allowedOriginsAttribute, ",")); interceptors.add(new OriginHandshakeInterceptor(allowedOrigins)); strategy = new WebSocketHandlerMappingStrategy(handshakeHandler, interceptors); } ManagedMap<String, Object> urlMap = new ManagedMap<String, Object>(); urlMap.setSource(source); for (Element mappingElement : DomUtils.getChildElementsByTagName(element, "mapping")) { strategy.addMapping(mappingElement, urlMap, context); } handlerMappingDef.getPropertyValues().add("urlMap", urlMap); context.registerComponent(new BeanComponentDefinition(handlerMappingDef, handlerMappingName)); context.popAndRegisterContainingComponent(); return null; }