1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29 package org.objectledge.web;
30
31 import org.jcontainer.dna.Configuration;
32
33 /***
34 * MVC configuration component - it provides the access to common MVC configuration.
35 *
36 * @author <a href="mailto:pablo@caltha.pl">Pawel Potempski</a>
37 * @version $Id: WebConfigurator.java,v 1.9 2005/07/22 17:25:46 pablo Exp $
38 */
39 public class WebConfigurator
40 {
41 /*** the default encoding. */
42 public static final String DEFAULT_ENCODING = "UTF-8";
43
44 /*** the default content type. */
45 public static final String DEFAULT_CONTENT_TYPE = "text/html";
46
47 /*** the default view token. */
48 public static final String DEFAULT_VIEW_TOKEN = "view";
49
50 /*** the default action token. */
51 public static final String DEFAULT_ACTION_TOKEN = "action";
52
53 /*** the default encoding */
54 private String defaultEncoding;
55
56 /*** the default content type */
57 private String defaultContentType;
58
59 /*** the view token */
60 private String viewToken;
61
62 /*** the action token */
63 private String actionToken;
64
65 /***
66 * Constructor.
67 *
68 * @param config the configuration.
69 */
70 public WebConfigurator(Configuration config)
71 {
72 defaultEncoding = config.getChild("default_encoding").getValue(DEFAULT_ENCODING);
73 defaultContentType = config.getChild("default_content_type").getValue(DEFAULT_CONTENT_TYPE);
74 viewToken = config.getChild("view_token").getValue(DEFAULT_VIEW_TOKEN);
75 actionToken = config.getChild("action_token").getValue(DEFAULT_ACTION_TOKEN);
76 }
77
78 /***
79 * Get the default encoding of MVC created pages.
80 *
81 * @return the default encoding.
82 */
83 public String getDefaultEncoding()
84 {
85 return defaultEncoding;
86 }
87
88 /***
89 * Get the default content type of MVC created pages.
90 *
91 * @return the default content type.
92 */
93 public String getDefaultContentType()
94 {
95 return defaultContentType;
96 }
97
98 /***
99 * Get the view choice request parameter name.
100 *
101 * @return the view parameter name.
102 */
103 public String getViewToken()
104 {
105 return viewToken;
106 }
107
108 /***
109 * Get the action choice request parameter name.
110 *
111 * @return the action parameter name.
112 */
113 public String getActionToken()
114 {
115 return actionToken;
116 }
117 }