<commit_before>package org.mixer2.spring.webmvc;

import java.util.Locale;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.mixer2.Mixer2Engine;
import org.springframework.beans.BeanUtils;
import org.springframework.core.io.Resource;
import org.springframework.util.ClassUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.servlet.view.AbstractUrlBasedView;
import org.springframework.web.servlet.view.UrlBasedViewResolver;

/**
 * View Resolver for SpringMVC . <h4>your should add dependency for your
 * application:</h4>
 * 
 * <pre>
 * {@code
 * <dependency>
 *     <groupId>org.springframework</groupId>
 *     <artifactId>spring-webmvc</artifactId>
 *     <version>3.1.2.RELEASE (or higher)</version>
 * </dependency>
 * }
 * </pre>
 * 
 * <h4>Spring MVC configuration Sample</h4>
 * 
 * <pre>
 * {@code
 * <bean id="mixer2Engine" class="org.mixer2.Mixer2Engine" scope="singleton" />
 * <bean class="org.mixer2.spring.webmvc.Mixer2XhtmlViewResolver">
 *     <property name="order" value="1" />
 *     <property name="prefix" value="classpath:m2mockup/m2template/" />
 *     <!-- Also, you can use file system path like "file:/var/foo/"  -->
 *     <property name="suffix" value=".html" />
 *     <property name="basePackage" value="com.example.yourproject.web.view" />
 *     <property name="mixer2Engine" ref="mixer2Engine" />
 *     
 *     <!-- Default value is true that means this resolver returns null -->
 *     <!-- if template file not found and continue to resolve view name -->
 *     <!-- by another subsequent view resolver. -->
 *     <!-- Set "false" if you expect FileNotFoundException for unknown view name -->
 *     <property name="returnNullIfTemplateFileNotFound" value="true" />
 *     
 *     <!-- If this resolver can not find the view class, -->
 *     <!-- returns html template "as is" with defaultView. -->
 *     <!-- If set true, raise ViewClassNotFoundException .  -->
 *     <!-- Default value is false. -->
 *     <property name="raiseErrorIfViewClassNotFound" value="true" />
 * </bean>
 * }
 * </pre>
 * 
 * <p>
 * Using this ViewResolver, Your controller method can returns <strong>template
 * html file path and name without file extension</strong>.<br />
 * See sample below.
 * </p>
 * 
 * <pre>
 * <code>
 * {@literal @}Controller
 * public class HelloWorldController {
 * 
 *    {@literal @}Autowired
 *    protected helloMessageService helloMessageService;
 * 
 *    {@literal @}RequestMapping(value = "/hello", method = RequestMethod.GET)
 *    public String showHello(Model model) {
 *        String helloMessage = helloMessageService.getMessage();
 *        model.addAttribute("helloMessage", helloMessage);
 *        return "foo/bar/helloWorld"; 
 *    }
 * }
 * </code>
 * </pre>
 * <commit_msg>edit comment.<commit_after>package org.mixer2.spring.webmvc;

import java.util.Locale;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.mixer2.Mixer2Engine;
import org.springframework.beans.BeanUtils;
import org.springframework.core.io.Resource;
import org.springframework.util.ClassUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.servlet.view.AbstractUrlBasedView;
import org.springframework.web.servlet.view.UrlBasedViewResolver;

/**
 * View Resolver for SpringMVC . <h4>your should add dependency for your
 * application:</h4>
 * 
 * <pre>
 * {@code
 * <dependency>
 *     <groupId>org.springframework</groupId>
 *     <artifactId>spring-webmvc</artifactId>
 *     <version>3.1.2.RELEASE (or higher)</version>
 * </dependency>
 * }
 * </pre>
 * 
 * <h4>Spring MVC configuration Sample</h4>
 * 
 * <pre>
 * {@code
 * <bean id="mixer2Engine" class="org.mixer2.Mixer2Engine" scope="singleton" />
 * <bean class="org.mixer2.spring.webmvc.Mixer2XhtmlViewResolver">
 *     <property name="order" value="1" />
 *     <property name="prefix" value="classpath:m2mockup/m2template/" />
 *     <!-- Also, you can use file system path like "file:/var/foo/"  -->
 *     <property name="suffix" value=".html" />
 *     <property name="basePackage" value="com.example.yourproject.web.view" />
 *     <property name="mixer2Engine" ref="mixer2Engine" />
 *     
 *     <!-- Default value is true that means this resolver returns null -->
 *     <!-- if template file not found and continue to resolve view name -->
 *     <!-- by another subsequent view resolver. -->
 *     <!-- Set "false" if you expect FileNotFoundException for unknown view name -->
 *     <property name="returnNullIfTemplateFileNotFound" value="true" />
 *     
 *     <!-- If this resolver can not find the view class, -->
 *     <!-- returns html template "as is" with defaultView. -->
 *     <!-- But if use this property, raise ClassNotFoundException .  -->
 *     <!-- Default value is false. -->
 *     <property name="raiseErrorIfViewClassNotFound" value="true" />
 * </bean>
 * }
 * </pre>
 * 
 * <p>
 * Using this ViewResolver, Your controller method can returns <strong>template
 * html file path and name without file extension</strong>.<br />
 * See sample below.
 * </p>
 * 
 * <pre>
 * <code>
 * {@literal @}Controller
 * public class HelloWorldController {
 * 
 *    {@literal @}Autowired
 *    protected helloMessageService helloMessageService;
 * 
 *    {@literal @}RequestMapping(value = "/hello", method = RequestMethod.GET)
 *    public String showHello(Model model) {
 *        String helloMessage = helloMessageService.getMessage();
 *        model.addAttribute("helloMessage", helloMessage);
 *        return "foo/bar/helloWorld"; 
 *    }
 * }
 * </code>
 * </pre>
 * 
{'fraction_non_alphanumeric': 0.1490758334772845, 'fraction_numerical': 0.006909656244601831, 'mean_word_length': 3.471042471042471, 'pattern_counts': {'":': 0, '<': 91, '<?xml version=': 0, '>': 91, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1793073', 'n_tokens_mistral': 1728, 'n_tokens_neox': 1699, 'n_words': 411}