1
22
23 package com.liferay.portal.kernel.util;
24
25 import java.io.IOException;
26
27 import java.net.URL;
28
29 import java.util.Map;
30
31 import javax.portlet.ActionRequest;
32 import javax.portlet.RenderRequest;
33
34 import javax.servlet.http.Cookie;
35 import javax.servlet.http.HttpServletRequest;
36
37
43 public class HttpUtil {
44
45 public static String addParameter(String url, String name, boolean value) {
46 return getHttp().addParameter(url, name, value);
47 }
48
49 public static String addParameter(String url, String name, double value) {
50 return getHttp().addParameter(url, name, value);
51 }
52
53 public static String addParameter(String url, String name, int value) {
54 return getHttp().addParameter(url, name, value);
55 }
56
57 public static String addParameter(String url, String name, long value) {
58 return getHttp().addParameter(url, name, value);
59 }
60
61 public static String addParameter(String url, String name, short value) {
62 return getHttp().addParameter(url, name, value);
63 }
64
65 public static String addParameter(String url, String name, String value) {
66 return getHttp().addParameter(url, name, value);
67 }
68
69 public static String decodeURL(String url) {
70 return getHttp().decodeURL(url);
71 }
72
73 public static String decodeURL(String url, boolean unescapeSpace) {
74 return getHttp().decodeURL(url, unescapeSpace);
75 }
76
77 public static String encodeURL(String url) {
78 return getHttp().encodeURL(url);
79 }
80
81 public static String encodeURL(String url, boolean escapeSpaces) {
82 return getHttp().encodeURL(url, escapeSpaces);
83 }
84
85 public static String getCompleteURL(HttpServletRequest request) {
86 return getHttp().getCompleteURL(request);
87 }
88
89 public static String getDomain(String url) {
90 return getHttp().getDomain(url);
91 }
92
93 public static Http getHttp() {
94 return _http;
95 }
96
97 public static String getParameter(String url, String name) {
98 return getHttp().getParameter(url, name);
99 }
100
101 public static String getParameter(
102 String url, String name, boolean escaped) {
103
104 return getHttp().getParameter(url, name, escaped);
105 }
106
107 public static Map<String, String[]> getParameterMap(String queryString) {
108 return getHttp().getParameterMap(queryString);
109 }
110
111 public static String getProtocol(ActionRequest actionRequest) {
112 return getHttp().getProtocol(actionRequest);
113 }
114
115 public static String getProtocol(boolean secure) {
116 return getHttp().getProtocol(secure);
117 }
118
119 public static String getProtocol(HttpServletRequest request) {
120 return getHttp().getProtocol(request);
121 }
122
123 public static String getProtocol(RenderRequest renderRequest) {
124 return getHttp().getProtocol(renderRequest);
125 }
126
127 public static String getProtocol(String url) {
128 return getHttp().getProtocol(url);
129 }
130
131 public static String getQueryString(String url) {
132 return getHttp().getQueryString(url);
133 }
134
135 public static String getRequestURL(HttpServletRequest request) {
136 return getHttp().getRequestURL(request);
137 }
138
139 public static boolean hasDomain(String url) {
140 return getHttp().hasDomain(url);
141 }
142
143 public static boolean hasProxyConfig() {
144 return getHttp().hasProxyConfig();
145 }
146
147 public static boolean isNonProxyHost(String host) {
148 return getHttp().isNonProxyHost(host);
149 }
150
151 public static boolean isProxyHost(String host) {
152 return getHttp().isProxyHost(host);
153 }
154
155 public static Map<String, String[]> parameterMapFromString(
156 String queryString) {
157
158 return getHttp().parameterMapFromString(queryString);
159 }
160
161 public static String parameterMapToString(
162 Map<String, String[]> parameterMap) {
163
164 return getHttp().parameterMapToString(parameterMap);
165 }
166
167 public static String parameterMapToString(
168 Map<String, String[]> parameterMap, boolean addQuestion) {
169
170 return getHttp().parameterMapToString(parameterMap, addQuestion);
171 }
172
173 public static String protocolize(String url, ActionRequest actionRequest) {
174 return getHttp().protocolize(url, actionRequest);
175 }
176
177 public static String protocolize(String url, boolean secure) {
178 return getHttp().protocolize(url, secure);
179 }
180
181 public static String protocolize(String url, HttpServletRequest request) {
182 return getHttp().protocolize(url, request);
183 }
184
185 public static String protocolize(String url, RenderRequest renderRequest) {
186 return getHttp().protocolize(url, renderRequest);
187 }
188
189 public static String removeDomain(String url) {
190 return getHttp().removeDomain(url);
191 }
192
193 public static String removeParameter(String url, String name) {
194 return getHttp().removeParameter(url, name);
195 }
196
197 public static String removeProtocol(String url) {
198 return getHttp().removeProtocol(url);
199 }
200
201 public static String setParameter(String url, String name, boolean value) {
202 return getHttp().setParameter(url, name, value);
203 }
204
205 public static String setParameter(String url, String name, double value) {
206 return getHttp().setParameter(url, name, value);
207 }
208
209 public static String setParameter(String url, String name, int value) {
210 return getHttp().setParameter(url, name, value);
211 }
212
213 public static String setParameter(String url, String name, long value) {
214 return getHttp().setParameter(url, name, value);
215 }
216
217 public static String setParameter(String url, String name, short value) {
218 return getHttp().setParameter(url, name, value);
219 }
220
221 public static String setParameter(String url, String name, String value) {
222 return getHttp().setParameter(url, name, value);
223 }
224
225 public static byte[] URLtoByteArray(String location) throws IOException {
226 return getHttp().URLtoByteArray(location);
227 }
228
229 public static byte[] URLtoByteArray(String location, boolean post)
230 throws IOException {
231
232 return getHttp().URLtoByteArray(location, post);
233 }
234
235 public static byte[] URLtoByteArray(
236 String location, Cookie[] cookies, Http.Auth auth, Http.Body body,
237 boolean post)
238 throws IOException {
239
240 return getHttp().URLtoByteArray(location, cookies, auth, body, post);
241 }
242
243 public static byte[] URLtoByteArray(
244 String location, Cookie[] cookies, Http.Auth auth,
245 Map<String, String> parts, boolean post)
246 throws IOException {
247
248 return getHttp().URLtoByteArray(location, cookies, auth, parts, post);
249 }
250
251 public static String URLtoString(String location) throws IOException {
252 return getHttp().URLtoString(location);
253 }
254
255 public static String URLtoString(String location, boolean post)
256 throws IOException {
257
258 return getHttp().URLtoString(location, post);
259 }
260
261 public static String URLtoString(
262 String location, Cookie[] cookies, Http.Auth auth, Http.Body body,
263 boolean post)
264 throws IOException {
265
266 return getHttp().URLtoString(location, cookies, auth, body, post);
267 }
268
269 public static String URLtoString(
270 String location, Cookie[] cookies, Http.Auth auth,
271 Map<String, String> parts, boolean post)
272 throws IOException {
273
274 return getHttp().URLtoString(location, cookies, auth, parts, post);
275 }
276
277
288 public static String URLtoString(URL url) throws IOException {
289 return getHttp().URLtoString(url);
290 }
291
292 public void setHttp(Http http) {
293 _http = http;
294 }
295
296 private static Http _http;
297
298 }