Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
HttpBean |
|
| 1.2608695652173914;1,261 |
1 | /* | |
2 | =================== DO NOT EDIT THIS FILE ==================== | |
3 | Generated by Modello 1.1 on 2010-11-13 15:27:48, | |
4 | any modifications will be overwritten. | |
5 | ============================================================== | |
6 | */ | |
7 | ||
8 | package org.apache.maven.doxia.linkcheck; | |
9 | ||
10 | /** | |
11 | * Http bean to encapsulate the supported HTTP parameters. | |
12 | * @see org.apache.commons.httpclient.HttpMethod. | |
13 | * | |
14 | * @version $Revision$ $Date$ | |
15 | */ | |
16 | 6 | public class HttpBean |
17 | implements java.io.Serializable | |
18 | { | |
19 | ||
20 | //--------------------------/ | |
21 | //- Class/Member Variables -/ | |
22 | //--------------------------/ | |
23 | ||
24 | /** | |
25 | * | |
26 | * The HTTP method to use. Currently supported are "GET" | |
27 | * and "HEAD". | |
28 | * <dl> | |
29 | * <dt>HTTP GET</dt> | |
30 | * <dd> | |
31 | * The HTTP GET method is defined in section 9.3 of | |
32 | * <a | |
33 | * HREF="http://www.ietf.org/rfc/rfc2616.txt">RFC2616</a>: | |
34 | * <blockquote> | |
35 | * The GET method means retrieve whatever information (in | |
36 | * the form of an | |
37 | * entity) is identified by the Request-URI. | |
38 | * </blockquote> | |
39 | * </dd> | |
40 | * <dt>HTTP HEAD</dt> | |
41 | * <dd> | |
42 | * The HTTP HEAD method is defined in section 9.4 of | |
43 | * <a | |
44 | * HREF="http://www.ietf.org/rfc/rfc2616.txt">RFC2616</a>: | |
45 | * <blockquote> | |
46 | * The HEAD method is identical to GET except that the | |
47 | * server MUST NOT | |
48 | * return a message-body in the response. | |
49 | * </blockquote> | |
50 | * </dd> | |
51 | * </dl> | |
52 | */ | |
53 | 6 | private String method = "head"; |
54 | ||
55 | /** | |
56 | * | |
57 | * if the HTTP method should automatically follow HTTP | |
58 | * redirects | |
59 | * (status code 302, etc.), <tt>false</tt> otherwise. | |
60 | */ | |
61 | 6 | private boolean followRedirects = false; |
62 | ||
63 | /** | |
64 | * The proxy host. | |
65 | */ | |
66 | private String proxyHost; | |
67 | ||
68 | /** | |
69 | * The proxy port. | |
70 | */ | |
71 | 6 | private int proxyPort = 0; |
72 | ||
73 | /** | |
74 | * The proxy user. | |
75 | */ | |
76 | private String proxyUser; | |
77 | ||
78 | /** | |
79 | * The proxy password. | |
80 | */ | |
81 | private String proxyPassword; | |
82 | ||
83 | /** | |
84 | * The proxy NTLM (NT Lan Manager) host. | |
85 | */ | |
86 | private String proxyNtlmHost; | |
87 | ||
88 | /** | |
89 | * The proxy NTLM (NT Lan Manager) domain. | |
90 | */ | |
91 | private String proxyNtlmDomain; | |
92 | ||
93 | /** | |
94 | * The timeout to be used. A value of zero means the timeout is | |
95 | * not used. | |
96 | * Default value is 2000. | |
97 | */ | |
98 | 6 | private int timeout = 2000; |
99 | ||
100 | ||
101 | //-----------/ | |
102 | //- Methods -/ | |
103 | //-----------/ | |
104 | ||
105 | /** | |
106 | * Method equals. | |
107 | * | |
108 | * @param other | |
109 | * @return boolean | |
110 | */ | |
111 | public boolean equals( Object other ) | |
112 | { | |
113 | 0 | if ( this == other ) |
114 | { | |
115 | 0 | return true; |
116 | } | |
117 | ||
118 | 0 | if ( !( other instanceof HttpBean ) ) |
119 | { | |
120 | 0 | return false; |
121 | } | |
122 | ||
123 | 0 | HttpBean that = (HttpBean) other; |
124 | 0 | boolean result = true; |
125 | ||
126 | 0 | result = result && ( getMethod() == null ? that.getMethod() == null : getMethod().equals( that.getMethod() ) ); |
127 | 0 | result = result && followRedirects == that.followRedirects; |
128 | 0 | result = result && ( getProxyHost() == null ? that.getProxyHost() == null : getProxyHost().equals( that.getProxyHost() ) ); |
129 | 0 | result = result && proxyPort == that.proxyPort; |
130 | 0 | result = result && ( getProxyUser() == null ? that.getProxyUser() == null : getProxyUser().equals( that.getProxyUser() ) ); |
131 | 0 | result = result && ( getProxyPassword() == null ? that.getProxyPassword() == null : getProxyPassword().equals( that.getProxyPassword() ) ); |
132 | 0 | result = result && ( getProxyNtlmHost() == null ? that.getProxyNtlmHost() == null : getProxyNtlmHost().equals( that.getProxyNtlmHost() ) ); |
133 | 0 | result = result && ( getProxyNtlmDomain() == null ? that.getProxyNtlmDomain() == null : getProxyNtlmDomain().equals( that.getProxyNtlmDomain() ) ); |
134 | 0 | result = result && timeout == that.timeout; |
135 | ||
136 | 0 | return result; |
137 | } //-- boolean equals( Object ) | |
138 | ||
139 | /** | |
140 | * Get the HTTP method to use. Currently supported are "GET" | |
141 | * and "HEAD". | |
142 | * <dl> | |
143 | * <dt>HTTP GET</dt> | |
144 | * <dd> | |
145 | * The HTTP GET method is defined in section 9.3 of | |
146 | * <a | |
147 | * HREF="http://www.ietf.org/rfc/rfc2616.txt">RFC2616</a>: | |
148 | * <blockquote> | |
149 | * The GET method means retrieve whatever information (in | |
150 | * the form of an | |
151 | * entity) is identified by the Request-URI. | |
152 | * </blockquote> | |
153 | * </dd> | |
154 | * <dt>HTTP HEAD</dt> | |
155 | * <dd> | |
156 | * The HTTP HEAD method is defined in section 9.4 of | |
157 | * <a | |
158 | * HREF="http://www.ietf.org/rfc/rfc2616.txt">RFC2616</a>: | |
159 | * <blockquote> | |
160 | * The HEAD method is identical to GET except that the | |
161 | * server MUST NOT | |
162 | * return a message-body in the response. | |
163 | * </blockquote> | |
164 | * </dd> | |
165 | * </dl> | |
166 | * | |
167 | * @return String | |
168 | */ | |
169 | public String getMethod() | |
170 | { | |
171 | 4 | return this.method; |
172 | } //-- String getMethod() | |
173 | ||
174 | /** | |
175 | * Get the proxy host. | |
176 | * | |
177 | * @return String | |
178 | */ | |
179 | public String getProxyHost() | |
180 | { | |
181 | 6 | return this.proxyHost; |
182 | } //-- String getProxyHost() | |
183 | ||
184 | /** | |
185 | * Get the proxy NTLM (NT Lan Manager) domain. | |
186 | * | |
187 | * @return String | |
188 | */ | |
189 | public String getProxyNtlmDomain() | |
190 | { | |
191 | 0 | return this.proxyNtlmDomain; |
192 | } //-- String getProxyNtlmDomain() | |
193 | ||
194 | /** | |
195 | * Get the proxy NTLM (NT Lan Manager) host. | |
196 | * | |
197 | * @return String | |
198 | */ | |
199 | public String getProxyNtlmHost() | |
200 | { | |
201 | 0 | return this.proxyNtlmHost; |
202 | } //-- String getProxyNtlmHost() | |
203 | ||
204 | /** | |
205 | * Get the proxy password. | |
206 | * | |
207 | * @return String | |
208 | */ | |
209 | public String getProxyPassword() | |
210 | { | |
211 | 0 | return this.proxyPassword; |
212 | } //-- String getProxyPassword() | |
213 | ||
214 | /** | |
215 | * Get the proxy port. | |
216 | * | |
217 | * @return int | |
218 | */ | |
219 | public int getProxyPort() | |
220 | { | |
221 | 0 | return this.proxyPort; |
222 | } //-- int getProxyPort() | |
223 | ||
224 | /** | |
225 | * Get the proxy user. | |
226 | * | |
227 | * @return String | |
228 | */ | |
229 | public String getProxyUser() | |
230 | { | |
231 | 0 | return this.proxyUser; |
232 | } //-- String getProxyUser() | |
233 | ||
234 | /** | |
235 | * Get the timeout to be used. A value of zero means the | |
236 | * timeout is not used. | |
237 | * Default value is 2000. | |
238 | * | |
239 | * @return int | |
240 | */ | |
241 | public int getTimeout() | |
242 | { | |
243 | 18 | return this.timeout; |
244 | } //-- int getTimeout() | |
245 | ||
246 | /** | |
247 | * Method hashCode. | |
248 | * | |
249 | * @return int | |
250 | */ | |
251 | public int hashCode() | |
252 | { | |
253 | 0 | int result = 17; |
254 | ||
255 | 0 | result = 37 * result + ( method != null ? method.hashCode() : 0 ); |
256 | 0 | result = 37 * result + ( followRedirects ? 0 : 1 ); |
257 | 0 | result = 37 * result + ( proxyHost != null ? proxyHost.hashCode() : 0 ); |
258 | 0 | result = 37 * result + (int) proxyPort; |
259 | 0 | result = 37 * result + ( proxyUser != null ? proxyUser.hashCode() : 0 ); |
260 | 0 | result = 37 * result + ( proxyPassword != null ? proxyPassword.hashCode() : 0 ); |
261 | 0 | result = 37 * result + ( proxyNtlmHost != null ? proxyNtlmHost.hashCode() : 0 ); |
262 | 0 | result = 37 * result + ( proxyNtlmDomain != null ? proxyNtlmDomain.hashCode() : 0 ); |
263 | 0 | result = 37 * result + (int) timeout; |
264 | ||
265 | 0 | return result; |
266 | } //-- int hashCode() | |
267 | ||
268 | /** | |
269 | * Get if the HTTP method should automatically follow HTTP | |
270 | * redirects | |
271 | * (status code 302, etc.), <tt>false</tt> otherwise. | |
272 | * | |
273 | * @return boolean | |
274 | */ | |
275 | public boolean isFollowRedirects() | |
276 | { | |
277 | 2 | return this.followRedirects; |
278 | } //-- boolean isFollowRedirects() | |
279 | ||
280 | /** | |
281 | * Set if the HTTP method should automatically follow HTTP | |
282 | * redirects | |
283 | * (status code 302, etc.), <tt>false</tt> otherwise. | |
284 | * | |
285 | * @param followRedirects | |
286 | */ | |
287 | public void setFollowRedirects( boolean followRedirects ) | |
288 | { | |
289 | 0 | this.followRedirects = followRedirects; |
290 | 0 | } //-- void setFollowRedirects( boolean ) |
291 | ||
292 | /** | |
293 | * Set the HTTP method to use. Currently supported are "GET" | |
294 | * and "HEAD". | |
295 | * <dl> | |
296 | * <dt>HTTP GET</dt> | |
297 | * <dd> | |
298 | * The HTTP GET method is defined in section 9.3 of | |
299 | * <a | |
300 | * HREF="http://www.ietf.org/rfc/rfc2616.txt">RFC2616</a>: | |
301 | * <blockquote> | |
302 | * The GET method means retrieve whatever information (in | |
303 | * the form of an | |
304 | * entity) is identified by the Request-URI. | |
305 | * </blockquote> | |
306 | * </dd> | |
307 | * <dt>HTTP HEAD</dt> | |
308 | * <dd> | |
309 | * The HTTP HEAD method is defined in section 9.4 of | |
310 | * <a | |
311 | * HREF="http://www.ietf.org/rfc/rfc2616.txt">RFC2616</a>: | |
312 | * <blockquote> | |
313 | * The HEAD method is identical to GET except that the | |
314 | * server MUST NOT | |
315 | * return a message-body in the response. | |
316 | * </blockquote> | |
317 | * </dd> | |
318 | * </dl> | |
319 | * | |
320 | * @param method | |
321 | */ | |
322 | public void setMethod( String method ) | |
323 | { | |
324 | 0 | this.method = method; |
325 | 0 | } //-- void setMethod( String ) |
326 | ||
327 | /** | |
328 | * Set the proxy host. | |
329 | * | |
330 | * @param proxyHost | |
331 | */ | |
332 | public void setProxyHost( String proxyHost ) | |
333 | { | |
334 | 0 | this.proxyHost = proxyHost; |
335 | 0 | } //-- void setProxyHost( String ) |
336 | ||
337 | /** | |
338 | * Set the proxy NTLM (NT Lan Manager) domain. | |
339 | * | |
340 | * @param proxyNtlmDomain | |
341 | */ | |
342 | public void setProxyNtlmDomain( String proxyNtlmDomain ) | |
343 | { | |
344 | 0 | this.proxyNtlmDomain = proxyNtlmDomain; |
345 | 0 | } //-- void setProxyNtlmDomain( String ) |
346 | ||
347 | /** | |
348 | * Set the proxy NTLM (NT Lan Manager) host. | |
349 | * | |
350 | * @param proxyNtlmHost | |
351 | */ | |
352 | public void setProxyNtlmHost( String proxyNtlmHost ) | |
353 | { | |
354 | 0 | this.proxyNtlmHost = proxyNtlmHost; |
355 | 0 | } //-- void setProxyNtlmHost( String ) |
356 | ||
357 | /** | |
358 | * Set the proxy password. | |
359 | * | |
360 | * @param proxyPassword | |
361 | */ | |
362 | public void setProxyPassword( String proxyPassword ) | |
363 | { | |
364 | 0 | this.proxyPassword = proxyPassword; |
365 | 0 | } //-- void setProxyPassword( String ) |
366 | ||
367 | /** | |
368 | * Set the proxy port. | |
369 | * | |
370 | * @param proxyPort | |
371 | */ | |
372 | public void setProxyPort( int proxyPort ) | |
373 | { | |
374 | 0 | this.proxyPort = proxyPort; |
375 | 0 | } //-- void setProxyPort( int ) |
376 | ||
377 | /** | |
378 | * Set the proxy user. | |
379 | * | |
380 | * @param proxyUser | |
381 | */ | |
382 | public void setProxyUser( String proxyUser ) | |
383 | { | |
384 | 0 | this.proxyUser = proxyUser; |
385 | 0 | } //-- void setProxyUser( String ) |
386 | ||
387 | /** | |
388 | * Method toString. | |
389 | * | |
390 | * @return String | |
391 | */ | |
392 | public java.lang.String toString() | |
393 | { | |
394 | 0 | StringBuffer buf = new StringBuffer( 128 ); |
395 | ||
396 | 0 | buf.append( "method = '" ); |
397 | 0 | buf.append( getMethod() ); |
398 | 0 | buf.append( "'" ); |
399 | 0 | buf.append( "\n" ); |
400 | 0 | buf.append( "followRedirects = '" ); |
401 | 0 | buf.append( isFollowRedirects() ); |
402 | 0 | buf.append( "'" ); |
403 | 0 | buf.append( "\n" ); |
404 | 0 | buf.append( "proxyHost = '" ); |
405 | 0 | buf.append( getProxyHost() ); |
406 | 0 | buf.append( "'" ); |
407 | 0 | buf.append( "\n" ); |
408 | 0 | buf.append( "proxyPort = '" ); |
409 | 0 | buf.append( getProxyPort() ); |
410 | 0 | buf.append( "'" ); |
411 | 0 | buf.append( "\n" ); |
412 | 0 | buf.append( "proxyUser = '" ); |
413 | 0 | buf.append( getProxyUser() ); |
414 | 0 | buf.append( "'" ); |
415 | 0 | buf.append( "\n" ); |
416 | 0 | buf.append( "proxyPassword = '" ); |
417 | 0 | buf.append( getProxyPassword() ); |
418 | 0 | buf.append( "'" ); |
419 | 0 | buf.append( "\n" ); |
420 | 0 | buf.append( "proxyNtlmHost = '" ); |
421 | 0 | buf.append( getProxyNtlmHost() ); |
422 | 0 | buf.append( "'" ); |
423 | 0 | buf.append( "\n" ); |
424 | 0 | buf.append( "proxyNtlmDomain = '" ); |
425 | 0 | buf.append( getProxyNtlmDomain() ); |
426 | 0 | buf.append( "'" ); |
427 | 0 | buf.append( "\n" ); |
428 | 0 | buf.append( "timeout = '" ); |
429 | 0 | buf.append( getTimeout() ); |
430 | 0 | buf.append( "'" ); |
431 | ||
432 | 0 | return buf.toString(); |
433 | } //-- java.lang.String toString() | |
434 | ||
435 | ||
436 | ||
437 | /** | |
438 | * Set the timeout to be used. A value of zero means the timeout is not used. | |
439 | * | |
440 | * @param timeout positive int | |
441 | */ | |
442 | public void setTimeout( int timeout ) | |
443 | { | |
444 | 0 | if ( timeout < 0 ) |
445 | { | |
446 | 0 | throw new IllegalArgumentException( timeout + " should be 0 or positive." ); |
447 | } | |
448 | 0 | this.timeout = timeout; |
449 | 0 | } |
450 | ||
451 | private java.util.Properties httpClientParameters; | |
452 | ||
453 | /** | |
454 | * @return the extra HttpClient parameters | |
455 | * @see http://hc.apache.org/httpclient-3.x/preference-api.html | |
456 | */ | |
457 | public java.util.Properties getHttpClientParameters() | |
458 | { | |
459 | 12 | return httpClientParameters; |
460 | } | |
461 | ||
462 | /** | |
463 | * @param httpClientParameters the extra HttpClient parameters to set | |
464 | * @see http://hc.apache.org/httpclient-3.x/preference-api.html | |
465 | */ | |
466 | public void setHttpClientParameters( java.util.Properties httpClientParameters ) | |
467 | { | |
468 | 0 | this.httpClientParameters = httpClientParameters; |
469 | 0 | } |
470 | ||
471 | } |