001
014
015 package com.liferay.portal.kernel.util;
016
017 import com.liferay.portal.kernel.security.pacl.permission.PortalRuntimePermission;
018
019 import java.io.IOException;
020
021 import java.net.URL;
022
023 import java.util.Map;
024
025 import javax.portlet.ActionRequest;
026 import javax.portlet.RenderRequest;
027
028 import javax.servlet.http.Cookie;
029 import javax.servlet.http.HttpServletRequest;
030
031
034 public class HttpUtil {
035
036 public static String addParameter(String url, String name, boolean value) {
037 return getHttp().addParameter(url, name, value);
038 }
039
040 public static String addParameter(String url, String name, double value) {
041 return getHttp().addParameter(url, name, value);
042 }
043
044 public static String addParameter(String url, String name, int value) {
045 return getHttp().addParameter(url, name, value);
046 }
047
048 public static String addParameter(String url, String name, long value) {
049 return getHttp().addParameter(url, name, value);
050 }
051
052 public static String addParameter(String url, String name, short value) {
053 return getHttp().addParameter(url, name, value);
054 }
055
056 public static String addParameter(String url, String name, String value) {
057 return getHttp().addParameter(url, name, value);
058 }
059
060 public static String decodePath(String path) {
061 return getHttp().decodePath(path);
062 }
063
064 public static String decodeURL(String url) {
065 return getHttp().decodeURL(url);
066 }
067
068 public static String decodeURL(String url, boolean unescapeSpaces) {
069 return getHttp().decodeURL(url, unescapeSpaces);
070 }
071
072 public static String encodePath(String path) {
073 return getHttp().encodePath(path);
074 }
075
076 public static String encodeURL(String url) {
077 return getHttp().encodeURL(url);
078 }
079
080 public static String encodeURL(String url, boolean escapeSpaces) {
081 return getHttp().encodeURL(url, escapeSpaces);
082 }
083
084 public static String fixPath(String path) {
085 return getHttp().fixPath(path);
086 }
087
088 public static String fixPath(
089 String path, boolean leading, boolean trailing) {
090
091 return getHttp().fixPath(path, leading, trailing);
092 }
093
094 public static String getCompleteURL(HttpServletRequest request) {
095 return getHttp().getCompleteURL(request);
096 }
097
098 public static Cookie[] getCookies() {
099 return getHttp().getCookies();
100 }
101
102 public static String getDomain(String url) {
103 return getHttp().getDomain(url);
104 }
105
106 public static Http getHttp() {
107 PortalRuntimePermission.checkGetBeanProperty(HttpUtil.class);
108
109 return _http;
110 }
111
112 public static String getIpAddress(String url) {
113 return getHttp().getIpAddress(url);
114 }
115
116 public static String getParameter(String url, String name) {
117 return getHttp().getParameter(url, name);
118 }
119
120 public static String getParameter(
121 String url, String name, boolean escaped) {
122
123 return getHttp().getParameter(url, name, escaped);
124 }
125
126 public static Map<String, String[]> getParameterMap(String queryString) {
127 return getHttp().getParameterMap(queryString);
128 }
129
130 public static String getPath(String url) {
131 return getHttp().getPath(url);
132 }
133
134 public static String getProtocol(ActionRequest actionRequest) {
135 return getHttp().getProtocol(actionRequest);
136 }
137
138 public static String getProtocol(boolean secure) {
139 return getHttp().getProtocol(secure);
140 }
141
142 public static String getProtocol(HttpServletRequest request) {
143 return getHttp().getProtocol(request);
144 }
145
146 public static String getProtocol(RenderRequest renderRequest) {
147 return getHttp().getProtocol(renderRequest);
148 }
149
150 public static String getProtocol(String url) {
151 return getHttp().getProtocol(url);
152 }
153
154 public static String getQueryString(String url) {
155 return getHttp().getQueryString(url);
156 }
157
158 public static String getRequestURL(HttpServletRequest request) {
159 return getHttp().getRequestURL(request);
160 }
161
162 public static boolean hasDomain(String url) {
163 return getHttp().hasDomain(url);
164 }
165
166 public static boolean hasProtocol(String url) {
167 return getHttp().hasProtocol(url);
168 }
169
170 public static boolean hasProxyConfig() {
171 return getHttp().hasProxyConfig();
172 }
173
174 public static boolean isNonProxyHost(String host) {
175 return getHttp().isNonProxyHost(host);
176 }
177
178 public static boolean isProxyHost(String host) {
179 return getHttp().isProxyHost(host);
180 }
181
182 public static Map<String, String[]> parameterMapFromString(
183 String queryString) {
184
185 return getHttp().parameterMapFromString(queryString);
186 }
187
188 public static String parameterMapToString(
189 Map<String, String[]> parameterMap) {
190
191 return getHttp().parameterMapToString(parameterMap);
192 }
193
194 public static String parameterMapToString(
195 Map<String, String[]> parameterMap, boolean addQuestion) {
196
197 return getHttp().parameterMapToString(parameterMap, addQuestion);
198 }
199
200 public static String protocolize(String url, ActionRequest actionRequest) {
201 return getHttp().protocolize(url, actionRequest);
202 }
203
204 public static String protocolize(String url, boolean secure) {
205 return getHttp().protocolize(url, secure);
206 }
207
208 public static String protocolize(String url, HttpServletRequest request) {
209 return getHttp().protocolize(url, request);
210 }
211
212 public static String protocolize(String url, RenderRequest renderRequest) {
213 return getHttp().protocolize(url, renderRequest);
214 }
215
216 public static String removeDomain(String url) {
217 return getHttp().removeDomain(url);
218 }
219
220 public static String removeParameter(String url, String name) {
221 return getHttp().removeParameter(url, name);
222 }
223
224 public static String removeProtocol(String url) {
225 return getHttp().removeProtocol(url);
226 }
227
228 public static String setParameter(String url, String name, boolean value) {
229 return getHttp().setParameter(url, name, value);
230 }
231
232 public static String setParameter(String url, String name, double value) {
233 return getHttp().setParameter(url, name, value);
234 }
235
236 public static String setParameter(String url, String name, int value) {
237 return getHttp().setParameter(url, name, value);
238 }
239
240 public static String setParameter(String url, String name, long value) {
241 return getHttp().setParameter(url, name, value);
242 }
243
244 public static String setParameter(String url, String name, short value) {
245 return getHttp().setParameter(url, name, value);
246 }
247
248 public static String setParameter(String url, String name, String value) {
249 return getHttp().setParameter(url, name, value);
250 }
251
252 public static byte[] URLtoByteArray(Http.Options options)
253 throws IOException {
254
255 return getHttp().URLtoByteArray(options);
256 }
257
258 public static byte[] URLtoByteArray(String location) throws IOException {
259 return getHttp().URLtoByteArray(location);
260 }
261
262 public static byte[] URLtoByteArray(String location, boolean post)
263 throws IOException {
264
265 return getHttp().URLtoByteArray(location, post);
266 }
267
268 public static String URLtoString(Http.Options options) throws IOException {
269 return getHttp().URLtoString(options);
270 }
271
272 public static String URLtoString(String location) throws IOException {
273 return getHttp().URLtoString(location);
274 }
275
276 public static String URLtoString(String location, boolean post)
277 throws IOException {
278
279 return getHttp().URLtoString(location, post);
280 }
281
282
293 public static String URLtoString(URL url) throws IOException {
294 return getHttp().URLtoString(url);
295 }
296
297 public void setHttp(Http http) {
298 PortalRuntimePermission.checkSetBeanProperty(getClass());
299
300 _http = http;
301 }
302
303 private static Http _http;
304
305 }