001/*
002 * Copyright 2002-2014 the original author or authors.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *      https://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017package org.springframework.web.servlet.config;
018
019import org.w3c.dom.Element;
020
021import org.springframework.beans.factory.support.AbstractBeanDefinition;
022import org.springframework.beans.factory.xml.AbstractSimpleBeanDefinitionParser;
023import org.springframework.beans.factory.xml.ParserContext;
024
025/**
026 * Parse the <mvc:groovy-configurer> MVC namespace element and register a
027 * GroovyConfigurer bean
028 *
029 * @author Sebastien Deleuze
030 * @since 4.1
031 */
032public class GroovyMarkupConfigurerBeanDefinitionParser extends AbstractSimpleBeanDefinitionParser {
033
034        public static final String BEAN_NAME = "mvcGroovyMarkupConfigurer";
035
036
037        @Override
038        protected String resolveId(Element element, AbstractBeanDefinition definition, ParserContext parserContext) {
039                return BEAN_NAME;
040        }
041
042        @Override
043        protected String getBeanClassName(Element element) {
044                return "org.springframework.web.servlet.view.groovy.GroovyMarkupConfigurer";
045        }
046
047        @Override
048        protected boolean isEligibleAttribute(String name) {
049                return (name.equals("auto-indent") || name.equals("cache-templates") || name.equals("resource-loader-path"));
050        }
051
052}