1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
package org.apache.tapestry.engine; |
16 | |
|
17 | |
import org.apache.hivemind.util.Defense; |
18 | |
import org.apache.tapestry.util.QueryParameterMap; |
19 | |
|
20 | |
|
21 | |
|
22 | |
|
23 | |
|
24 | |
|
25 | |
|
26 | |
|
27 | |
public class ServiceEncodingImpl implements ServiceEncoding |
28 | |
{ |
29 | |
protected String _servletPath; |
30 | |
|
31 | |
protected String _pathInfo; |
32 | |
|
33 | |
|
34 | |
|
35 | |
|
36 | |
|
37 | |
|
38 | |
protected final QueryParameterMap _parameters; |
39 | |
|
40 | |
protected boolean _modified; |
41 | |
|
42 | |
|
43 | |
|
44 | |
|
45 | |
|
46 | |
public ServiceEncodingImpl(String servletPath) |
47 | |
{ |
48 | 0 | this(servletPath, null, new QueryParameterMap()); |
49 | 0 | } |
50 | |
|
51 | |
public ServiceEncodingImpl(String servletPath, QueryParameterMap parametersMap) |
52 | |
{ |
53 | 0 | this(servletPath, null, parametersMap); |
54 | 0 | } |
55 | |
|
56 | |
public ServiceEncodingImpl(String servletPath, String pathInfo, QueryParameterMap parameters) |
57 | 0 | { |
58 | 0 | Defense.notNull(servletPath, "servletPath"); |
59 | 0 | Defense.notNull(parameters, "parameters"); |
60 | |
|
61 | 0 | _servletPath = servletPath; |
62 | 0 | _pathInfo = pathInfo; |
63 | 0 | _parameters = parameters; |
64 | 0 | } |
65 | |
|
66 | |
public boolean isModified() |
67 | |
{ |
68 | 0 | return _modified; |
69 | |
} |
70 | |
|
71 | |
public void resetModified() |
72 | |
{ |
73 | 0 | _modified = false; |
74 | 0 | } |
75 | |
|
76 | |
public String getParameterValue(String name) |
77 | |
{ |
78 | 0 | return _parameters.getParameterValue(name); |
79 | |
} |
80 | |
|
81 | |
public String[] getParameterValues(String name) |
82 | |
{ |
83 | 0 | return _parameters.getParameterValues(name); |
84 | |
} |
85 | |
|
86 | |
public void setServletPath(String servletPath) |
87 | |
{ |
88 | 0 | Defense.notNull(servletPath, "servletPath"); |
89 | |
|
90 | 0 | _servletPath = servletPath; |
91 | 0 | _modified = true; |
92 | 0 | } |
93 | |
|
94 | |
public void setParameterValue(String name, String value) |
95 | |
{ |
96 | 0 | _parameters.setParameterValue(name, value); |
97 | |
|
98 | 0 | _modified = true; |
99 | 0 | } |
100 | |
|
101 | |
public void setParameterValues(String name, String[] values) |
102 | |
{ |
103 | 0 | _parameters.setParameterValues(name, values); |
104 | |
|
105 | 0 | _modified = true; |
106 | 0 | } |
107 | |
|
108 | |
public String getServletPath() |
109 | |
{ |
110 | 0 | return _servletPath; |
111 | |
} |
112 | |
|
113 | |
public String[] getParameterNames() |
114 | |
{ |
115 | 0 | return _parameters.getParameterNames(); |
116 | |
} |
117 | |
|
118 | |
public String getPathInfo() |
119 | |
{ |
120 | 0 | return _pathInfo; |
121 | |
} |
122 | |
|
123 | |
public void setPathInfo(String pathInfo) |
124 | |
{ |
125 | 0 | _pathInfo = pathInfo; |
126 | 0 | } |
127 | |
} |