19
19
import java .util .HashMap ;
20
20
import java .util .Map ;
21
21
22
+ import org .springframework .boot .autoconfigure .template .AbstractTemplateViewResolverProperties ;
22
23
import org .springframework .boot .context .properties .ConfigurationProperties ;
23
24
24
25
/**
26
+ * {@link ConfigurationProperties} for configuring FreeMarker
27
+ *
25
28
* @author Dave Syer
26
- *
29
+ * @author Andy Wilkinson
30
+ *
27
31
* @since 1.1.0
28
32
*/
29
33
@ ConfigurationProperties (prefix = "spring.freemarker" )
30
- public class FreeMarkerProperties {
34
+ public class FreeMarkerProperties extends AbstractTemplateViewResolverProperties {
31
35
32
36
public static final String DEFAULT_TEMPLATE_LOADER_PATH = "classpath:/templates/" ;
33
37
34
38
public static final String DEFAULT_PREFIX = "" ;
35
39
36
40
public static final String DEFAULT_SUFFIX = ".ftl" ;
37
41
38
- private String prefix = DEFAULT_PREFIX ;
39
-
40
- private String suffix = DEFAULT_SUFFIX ;
41
-
42
- private String templateLoaderPath = DEFAULT_TEMPLATE_LOADER_PATH ;
43
-
44
- private boolean cache ;
45
-
46
- private String contentType = "text/html" ;
47
-
48
- private String charSet = "UTF-8" ;
49
-
50
- private String [] viewNames ;
51
-
52
- private boolean checkTemplateLocation = true ;
53
-
54
- private String requestContextAttribute ;
55
-
56
- private boolean exposeRequestAttributes = false ;
57
-
58
- private boolean exposeSessionAttributes = false ;
59
-
60
- private boolean allowRequestOverride = false ;
61
-
62
- private boolean exposeSpringMacroHelpers = true ;
63
-
64
42
private Map <String , String > settings = new HashMap <String , String >();
65
43
66
- public void setCheckTemplateLocation (boolean checkTemplateLocation ) {
67
- this .checkTemplateLocation = checkTemplateLocation ;
68
- }
69
-
70
- public boolean isCheckTemplateLocation () {
71
- return this .checkTemplateLocation ;
72
- }
73
-
74
- public String [] getViewNames () {
75
- return this .viewNames ;
76
- }
77
-
78
- public void setViewNames (String [] viewNames ) {
79
- this .viewNames = viewNames ;
80
- }
81
-
82
- public boolean isCache () {
83
- return this .cache ;
84
- }
85
-
86
- public void setCache (boolean cache ) {
87
- this .cache = cache ;
88
- }
89
-
90
- public String getContentType () {
91
- return this .contentType
92
- + (this .contentType .contains (";charset=" ) ? "" : ";charset="
93
- + this .charSet );
94
- }
95
-
96
- public void setContentType (String contentType ) {
97
- this .contentType = contentType ;
98
- }
99
-
100
- public String getCharSet () {
101
- return this .charSet ;
102
- }
103
-
104
- public void setCharSet (String charSet ) {
105
- this .charSet = charSet ;
106
- }
107
-
108
- public String getPrefix () {
109
- return this .prefix ;
110
- }
44
+ private String templateLoaderPath = DEFAULT_TEMPLATE_LOADER_PATH ;
111
45
112
- public void setPrefix ( String prefix ) {
113
- this . prefix = prefix ;
46
+ public FreeMarkerProperties ( ) {
47
+ super ( DEFAULT_PREFIX , DEFAULT_SUFFIX ) ;
114
48
}
115
49
116
- public String getSuffix () {
117
- return this .suffix ;
50
+ public Map < String , String > getSettings () {
51
+ return this .settings ;
118
52
}
119
53
120
- public void setSuffix ( String suffix ) {
121
- this .suffix = suffix ;
54
+ public void setSettings ( Map < String , String > settings ) {
55
+ this .settings = settings ;
122
56
}
123
57
124
58
public String getTemplateLoaderPath () {
@@ -128,53 +62,4 @@ public String getTemplateLoaderPath() {
128
62
public void setTemplateLoaderPath (String templateLoaderPath ) {
129
63
this .templateLoaderPath = templateLoaderPath ;
130
64
}
131
-
132
- public String getRequestContextAttribute () {
133
- return this .requestContextAttribute ;
134
- }
135
-
136
- public void setRequestContextAttribute (String requestContextAttribute ) {
137
- this .requestContextAttribute = requestContextAttribute ;
138
- }
139
-
140
- public boolean isExposeRequestAttributes () {
141
- return this .exposeRequestAttributes ;
142
- }
143
-
144
- public void setExposeRequestAttributes (boolean exposeRequestAttributes ) {
145
- this .exposeRequestAttributes = exposeRequestAttributes ;
146
- }
147
-
148
- public boolean isExposeSessionAttributes () {
149
- return this .exposeSessionAttributes ;
150
- }
151
-
152
- public void setExposeSessionAttributes (boolean exposeSessionAttributes ) {
153
- this .exposeSessionAttributes = exposeSessionAttributes ;
154
- }
155
-
156
- public boolean isAllowRequestOverride () {
157
- return this .allowRequestOverride ;
158
- }
159
-
160
- public void setAllowRequestOverride (boolean allowRequestOverride ) {
161
- this .allowRequestOverride = allowRequestOverride ;
162
- }
163
-
164
- public boolean isExposeSpringMacroHelpers () {
165
- return this .exposeSpringMacroHelpers ;
166
- }
167
-
168
- public void setExposeSpringMacroHelpers (boolean exposeSpringMacroHelpers ) {
169
- this .exposeSpringMacroHelpers = exposeSpringMacroHelpers ;
170
- }
171
-
172
- public Map <String , String > getSettings () {
173
- return this .settings ;
174
- }
175
-
176
- public void setSettings (Map <String , String > settings ) {
177
- this .settings = settings ;
178
- }
179
-
180
65
}
0 commit comments