1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.springframework.extensions.webscripts.connector;
20
21 import java.util.Collections;
22 import java.util.HashMap;
23 import java.util.Map;
24
25
26
27
28
29
30
31
32
33
34 public final class ConnectorContext
35 {
36
37 private Map<String, String> parameters = Collections.<String, String>emptyMap();
38
39
40 private Map<String, String> headers = Collections.<String, String>emptyMap();
41
42
43 private String contentType;
44
45
46 private HttpMethod method = HttpMethod.GET;
47
48
49
50
51
52 public ConnectorContext()
53 {
54 this(null, null, null);
55 }
56
57
58
59
60
61
62
63 public ConnectorContext(Map<String, String> parameters, Map<String, String> headers)
64 {
65 this(null, parameters, headers);
66 }
67
68
69
70
71
72
73 public ConnectorContext(HttpMethod method)
74 {
75 if (method != null)
76 {
77 this.method = method;
78 }
79 }
80
81
82
83
84
85
86
87
88 public ConnectorContext(HttpMethod method, Map<String, String> parameters, Map<String, String> headers)
89 {
90 if (method != null)
91 {
92 this.method = method;
93 }
94 if (parameters != null)
95 {
96 this.parameters = new HashMap<String, String>(parameters.size());
97 this.parameters.putAll(parameters);
98 }
99 if (headers != null)
100 {
101 this.headers = new HashMap<String, String>(headers.size());
102 this.headers.putAll(headers);
103 }
104 }
105
106
107
108
109
110
111 public Map<String, String> getParameters()
112 {
113 return this.parameters;
114 }
115
116
117
118
119
120
121 public Map<String, String> getHeaders()
122 {
123 return this.headers;
124 }
125
126
127
128
129
130
131 public String getContentType()
132 {
133 return this.contentType;
134 }
135
136
137
138
139
140
141 public void setContentType(String contentType)
142 {
143 this.contentType = contentType;
144 }
145
146
147
148
149
150
151 public HttpMethod getMethod()
152 {
153 return this.method;
154 }
155
156
157
158
159
160
161 public void setMethod(HttpMethod method)
162 {
163 if (method != null)
164 {
165 this.method = method;
166 }
167 }
168 }