1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 package org.apache.struts.tiles2.util;
23
24 import java.util.Collections;
25 import java.util.HashMap;
26 import java.util.Map;
27
28 import org.apache.struts.config.PlugInConfig;
29 import org.apache.tiles.request.jakarta.servlet.ServletApplicationContext;
30
31 import jakarta.servlet.ServletContext;
32
33
34
35
36
37
38 public class PlugInConfigContextAdapter extends ServletApplicationContext {
39
40
41
42
43 private final PlugInConfig plugInConfigObject;
44
45
46
47
48 private final Map<String, String> initParam;
49
50
51
52
53
54
55
56 public PlugInConfigContextAdapter(PlugInConfig plugInConfigObject,
57 ServletContext servletContext) {
58 super(servletContext);
59 this.plugInConfigObject = plugInConfigObject;
60
61 HashMap<String, String> initParam_ = new HashMap<>(super.getInitParams());
62 for (Map.Entry<String, Object> entry : plugInConfigObject.getProperties().entrySet()) {
63 initParam_.put(entry.getKey(), entry.getValue().toString());
64 }
65 initParam = Collections.unmodifiableMap(initParam_);
66 }
67
68 @Override
69 public Map<String, String> getInitParams() {
70 return initParam;
71 }
72
73
74
75
76
77
78 public PlugInConfig getPlugInConfigObject() {
79 return plugInConfigObject;
80 }
81 }