KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > springframework > web > servlet > view > freemarker > FreeMarkerViewResolver


1 /*
2  * Copyright 2002-2006 the original author or authors.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package org.springframework.web.servlet.view.freemarker;
18
19 import org.springframework.web.servlet.view.AbstractTemplateViewResolver;
20
21 /**
22  * Convenience subclass of UrlBasedViewResolver that supports FreeMarkerView
23  * (i.e. FreeMarker templates) and custom subclasses of it.
24  *
25  * <p>The view class for all views generated by this resolver can be specified
26  * via <code>setViewClass</code>. See UrlBasedViewResolver's javadoc for details.
27  *
28  * <p><b>Note:</b> When chaining ViewResolvers, a FreeMarkerViewResolver always
29  * needs to be last, as it will attempt to resolve any view name, no matter
30  * whether the underlying resource actually exists.
31  *
32  * @author Juergen Hoeller
33  * @since 1.1
34  * @see #setViewClass
35  * @see #setPrefix
36  * @see #setSuffix
37  * @see #setRequestContextAttribute
38  * @see #setExposeSpringMacroHelpers
39  * @see FreeMarkerView
40  */

41 public class FreeMarkerViewResolver extends AbstractTemplateViewResolver {
42
43     /**
44      * Sets default viewClass to <code>requiredViewClass</code>.
45      * @see #setViewClass
46      * @see #requiredViewClass
47      */

48     public FreeMarkerViewResolver() {
49         setViewClass(requiredViewClass());
50     }
51
52     /**
53      * Requires FreeMarkerView.
54      * @see FreeMarkerView
55      */

56     protected Class JavaDoc requiredViewClass() {
57         return FreeMarkerView.class;
58     }
59
60 }
61
Popular Tags