xref: /unit/src/java/nginx/unit/JspPropertyGroup.java (revision 977:4f9268f27b57)
1 package nginx.unit;
2 
3 import java.util.ArrayList;
4 import java.util.Collection;
5 import java.util.List;
6 
7 import javax.servlet.descriptor.JspPropertyGroupDescriptor;
8 
9 import org.w3c.dom.Node;
10 import org.w3c.dom.NodeList;
11 
12 public class JspPropertyGroup implements JspPropertyGroupDescriptor
13 {
14     private final List<String> url_patterns_ = new ArrayList<>();
15     private String el_ignored_ = null;
16     private String page_encoding_ = null;
17     private String scripting_invalid_ = null;
18     private String is_xml_ = null;
19     private final List<String> include_preludes_ = new ArrayList<>();
20     private final List<String> include_codas_ = new ArrayList<>();
21 
22     private String deffered_syntax_allowed_as_literal_ = null;
23     private String trim_directive_whitespaces_ = null;
24     private String default_content_type_ = null;
25     private String buffer_ = null;
26     private String error_on_undeclared_namespace_ = null;
27 
JspPropertyGroup(NodeList nodes)28     public JspPropertyGroup(NodeList nodes)
29     {
30         for (int i = 0; i < nodes.getLength(); i++) {
31             Node node = nodes.item(i);
32             String tag_name = node.getNodeName();
33 
34             if (tag_name.equals("url-pattern")) {
35                 url_patterns_.add(node.getTextContent().trim());
36                 continue;
37             }
38 
39             if (tag_name.equals("el-ignored")) {
40                 el_ignored_ = node.getTextContent().trim();
41                 continue;
42             }
43 
44             if (tag_name.equals("page-encoding")) {
45                 page_encoding_ = node.getTextContent().trim();
46                 continue;
47             }
48 
49             if (tag_name.equals("scripting-invalid")) {
50                 scripting_invalid_ = node.getTextContent().trim();
51                 continue;
52             }
53 
54             if (tag_name.equals("is-xml")) {
55                 is_xml_ = node.getTextContent().trim();
56                 continue;
57             }
58 
59             if (tag_name.equals("include-prelude")) {
60                 include_preludes_.add(node.getTextContent().trim());
61                 continue;
62             }
63 
64             if (tag_name.equals("include-coda")) {
65                 include_codas_.add(node.getTextContent().trim());
66                 continue;
67             }
68 
69             if (tag_name.equals("deferred-syntax-allowed-as-literal")) {
70                 deffered_syntax_allowed_as_literal_ = node.getTextContent().trim();
71                 continue;
72             }
73 
74             if (tag_name.equals("trim-directive-whitespaces")) {
75                 trim_directive_whitespaces_ = node.getTextContent().trim();
76                 continue;
77             }
78 
79             if (tag_name.equals("default-content-type")) {
80                 default_content_type_ = node.getTextContent().trim();
81                 continue;
82             }
83 
84             if (tag_name.equals("buffer")) {
85                 buffer_ = node.getTextContent().trim();
86                 continue;
87             }
88 
89             if (tag_name.equals("error-on-undeclared-namespace")) {
90                 error_on_undeclared_namespace_ = node.getTextContent().trim();
91                 continue;
92             }
93         }
94 
95     }
96 
97     @Override
getUrlPatterns()98     public Collection<String> getUrlPatterns()
99     {
100         return new ArrayList<>(url_patterns_);
101     }
102 
103     @Override
getElIgnored()104     public String getElIgnored()
105     {
106         return el_ignored_;
107     }
108 
109     @Override
getPageEncoding()110     public String getPageEncoding()
111     {
112         return page_encoding_;
113     }
114 
115     @Override
getScriptingInvalid()116     public String getScriptingInvalid()
117     {
118         return scripting_invalid_;
119     }
120 
121     @Override
getIsXml()122     public String getIsXml()
123     {
124         return is_xml_;
125     }
126 
127     @Override
getIncludePreludes()128     public Collection<String> getIncludePreludes()
129     {
130         return new ArrayList<>(include_preludes_);
131     }
132 
133     @Override
getIncludeCodas()134     public Collection<String> getIncludeCodas()
135     {
136         return new ArrayList<>(include_codas_);
137     }
138 
139     @Override
getDeferredSyntaxAllowedAsLiteral()140     public String getDeferredSyntaxAllowedAsLiteral()
141     {
142         return deffered_syntax_allowed_as_literal_;
143     }
144 
145     @Override
getTrimDirectiveWhitespaces()146     public String getTrimDirectiveWhitespaces()
147     {
148         return trim_directive_whitespaces_;
149     }
150 
151     @Override
getDefaultContentType()152     public String getDefaultContentType()
153     {
154         return default_content_type_;
155     }
156 
157     @Override
getBuffer()158     public String getBuffer()
159     {
160         return buffer_;
161     }
162 
163     @Override
getErrorOnUndeclaredNamespace()164     public String getErrorOnUndeclaredNamespace()
165     {
166         return error_on_undeclared_namespace_;
167     }
168 }
169 
170