01: /*
02: * $Id: StatusCodeHTTPCallException.java,v 1.19 2007/03/15 17:08:27 agoubard Exp $
03: *
04: * Copyright 2003-2007 Orange Nederland Breedband B.V.
05: * See the COPYRIGHT file for redistribution and use restrictions.
06: */
07: package org.xins.common.http;
08:
09: import org.xins.common.service.TargetDescriptor;
10:
11: /**
12: * Exception that indicates that an HTTP call failed because the returned HTTP
13: * status code was considered invalid.
14: *
15: * @version $Revision: 1.19 $ $Date: 2007/03/15 17:08:27 $
16: * @author <a href="mailto:ernst@ernstdehaan.com">Ernst de Haan</a>
17: *
18: * @since XINS 1.0.0
19: */
20: public final class StatusCodeHTTPCallException extends
21: HTTPCallException {
22:
23: /**
24: * Serial version UID. Used for serialization. The assigned value is for
25: * compatibility with XINS 1.2.5.
26: */
27: private static final long serialVersionUID = 5165140514693822383L;
28:
29: /**
30: * The returned HTTP status code.
31: */
32: private final int _code;
33:
34: /**
35: * Constructs a new <code>StatusCodeHTTPCallException</code> based on the
36: * original request, target called, call duration and HTTP status code.
37: *
38: * @param request
39: * the original request, cannot be <code>null</code>.
40: *
41: * @param target
42: * descriptor for the target that was attempted to be called, cannot be
43: * <code>null</code>.
44: *
45: * @param duration
46: * the call duration in milliseconds, must be >= 0.
47: *
48: * @param code
49: * the HTTP status code.
50: *
51: * @throws IllegalArgumentException
52: * if <code>request == null
53: * || target == null
54: * || duration < 0</code>.
55: *
56: * @since XINS 1.5.0.
57: */
58: public StatusCodeHTTPCallException(HTTPCallRequest request,
59: TargetDescriptor target, long duration, int code)
60: throws IllegalArgumentException {
61: super ("Unsupported HTTP status code " + code, request, target,
62: duration, null, null);
63:
64: _code = code;
65: }
66:
67: /**
68: * Returns the HTTP status code.
69: *
70: * @return
71: * the HTTP status code that is considered unacceptable.
72: */
73: public int getStatusCode() {
74: return _code;
75: }
76: }
|