| Line 53... |
Line 53... |
| 53 |
//@Import(RepositoryRestMvcConfiguration.class)
|
53 |
//@Import(RepositoryRestMvcConfiguration.class)
|
| 54 |
public class AppConfig {
|
54 |
public class AppConfig {
|
| 55 |
|
55 |
|
| 56 |
private static final String VELOCITY_PATH_PREFIX = "/WEB-INF/views/ftl/";
|
56 |
private static final String VELOCITY_PATH_PREFIX = "/WEB-INF/views/ftl/";
|
| 57 |
private static final String VELOCITY_PATH_SUFFIX = ".vm";
|
57 |
private static final String VELOCITY_PATH_SUFFIX = ".vm";
|
| 58 |
private static final String MESSAGE_PATH_SOURCE_NAME = "classpath:message";
|
58 |
private static final String MESSAGE_PATH_SOURCE_NAME = "classpath:messages";
|
| 59 |
private static final Logger LOGGER = LogManager.getLogger(AppConfig.class);
|
59 |
private static final Logger LOGGER = LogManager.getLogger(AppConfig.class);
|
| 60 |
private static Resource resource;
|
60 |
private static Resource resource;
|
| 61 |
|
61 |
|
| 62 |
public static Resource getResource() {
|
62 |
public static Resource getResource() {
|
| 63 |
return resource;
|
63 |
return resource;
|
| Line 109... |
Line 109... |
| 109 |
public ViewResolver viewResolver() {
|
109 |
public ViewResolver viewResolver() {
|
| 110 |
VelocityLayoutViewResolver bean = new VelocityLayoutViewResolver();
|
110 |
VelocityLayoutViewResolver bean = new VelocityLayoutViewResolver();
|
| 111 |
bean.setPrefix("");
|
111 |
bean.setPrefix("");
|
| 112 |
bean.setSuffix(VELOCITY_PATH_SUFFIX);
|
112 |
bean.setSuffix(VELOCITY_PATH_SUFFIX);
|
| 113 |
bean.setRequestContextAttribute("rc");
|
113 |
bean.setRequestContextAttribute("rc");
|
| - |
|
114 |
bean.setExposeSpringMacroHelpers(true);
|
| 114 |
bean.setAttributesMap(this.velocityAttributesMap());
|
115 |
bean.setAttributesMap(this.velocityAttributesMap());
|
| 115 |
return bean;
|
116 |
return bean;
|
| 116 |
}
|
117 |
}
|
| 117 |
|
118 |
|
| 118 |
// @Bean
|
119 |
// @Bean
|
| Line 143... |
Line 144... |
| 143 |
@Bean(name = "messageSource")
|
144 |
@Bean(name = "messageSource")
|
| 144 |
public ReloadableResourceBundleMessageSource getReloadableResourceBundleMessageSource() {
|
145 |
public ReloadableResourceBundleMessageSource getReloadableResourceBundleMessageSource() {
|
| 145 |
LOGGER.debug("creating messageSource bean with message path source name : " + MESSAGE_PATH_SOURCE_NAME);
|
146 |
LOGGER.debug("creating messageSource bean with message path source name : " + MESSAGE_PATH_SOURCE_NAME);
|
| 146 |
ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
|
147 |
ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
|
| 147 |
messageSource.setBasename(MESSAGE_PATH_SOURCE_NAME);
|
148 |
messageSource.setBasename(MESSAGE_PATH_SOURCE_NAME);
|
| - |
|
149 |
messageSource.setDefaultEncoding("UTF-8");
|
| - |
|
150 |
//messageSource.setDefaultEncoding("ISO 8859-1");
|
| - |
|
151 |
// messageSource.setDefaultEncoding("U+0900 ");
|
| - |
|
152 |
// messageSource.setDefaultEncoding("UTF-32");
|
| - |
|
153 |
|
| 148 |
return messageSource;
|
154 |
return messageSource;
|
| 149 |
}
|
155 |
}
|
| 150 |
|
156 |
|
| 151 |
@Bean(name = "multipartResolver")
|
157 |
@Bean(name = "multipartResolver")
|
| 152 |
public CommonsMultipartResolver getCommonsMultipartResolver() {
|
158 |
public CommonsMultipartResolver getCommonsMultipartResolver() {
|
| Line 243... |
Line 249... |
| 243 |
// Loader");
|
249 |
// Loader");
|
| 244 |
// props.put("file.resource.loader.class",
|
250 |
// props.put("file.resource.loader.class",
|
| 245 |
// "org.apache.velocity.runtime.resource.loader.FileResourceLoader");
|
251 |
// "org.apache.velocity.runtime.resource.loader.FileResourceLoader");
|
| 246 |
// props.put("file.resource.loader.cache", true);
|
252 |
// props.put("file.resource.loader.cache", true);
|
| 247 |
// props.put("file.resource.loader.path", ".");
|
253 |
// props.put("file.resource.loader.path", ".");
|
| - |
|
254 |
factory.setPreferFileSystemAccess(false);
|
| - |
|
255 |
// factory.setResourceLoaderPath("classpath:/templates/");
|
| - |
|
256 |
|
| 248 |
|
257 |
|
| 249 |
Properties velocityProperties = new Properties();
|
258 |
Properties velocityProperties = new Properties();
|
| 250 |
velocityProperties.put("resource.loader", "class");
|
259 |
velocityProperties.put("resource.loader", "class");
|
| 251 |
velocityProperties.put("class.resource.loader.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
|
260 |
velocityProperties.put("class.resource.loader.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
|
| 252 |
velocityProperties.put("file.resource.loader.cache", true);
|
261 |
velocityProperties.put("file.resource.loader.cache", true);
|
| 253 |
velocityProperties.put("file.resource.loader.unicode", true);
|
262 |
velocityProperties.put("file.resource.loader.unicode", true);
|
| 254 |
velocityProperties.put("input.encoding", "UTF-8");
|
263 |
velocityProperties.put("input.encoding", "UTF-8");
|
| 255 |
velocityProperties.put("output.encoding", "UTF-8");
|
264 |
velocityProperties.put("output.encoding", "UTF-8");
|
| 256 |
velocityProperties.put("overrideLogging", true);
|
265 |
velocityProperties.put("overrideLogging", true);
|
| - |
|
266 |
velocityProperties.setProperty("input.encoding", "UTF-8");
|
| - |
|
267 |
velocityProperties.setProperty("output.encoding", "UTF-8");
|
| - |
|
268 |
factory.setVelocityProperties(velocityProperties);
|
| 257 |
|
269 |
|
| 258 |
// velocityProperties.put("file.resource.loader.path", ".");
|
270 |
// velocityProperties.put("file.resource.loader.path", ".");
|
| 259 |
|
271 |
|
| 260 |
factory.setVelocityProperties(velocityProperties);
|
272 |
factory.setVelocityProperties(velocityProperties);
|
| 261 |
return factory.createVelocityEngine();
|
273 |
return factory.createVelocityEngine();
|