merge the formfield patch from ooo-build
[ooovba.git] / ucb / source / ucp / webdav / DAVException.hxx
blob4e281543c89b44bc887039af2cff22987ac94e5e
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: DAVException.hxx,v $
10 * $Revision: 1.9 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _DAVEXCEPTION_HXX_
32 #define _DAVEXCEPTION_HXX_
34 #include <rtl/ustring.hxx>
36 namespace webdav_ucp
39 /////////////////////////////////////////////////////////////////////////////
40 // HTTP/WebDAV status codes
41 /////////////////////////////////////////////////////////////////////////////
43 const sal_uInt16 SC_NONE = 0;
45 // 1xx (Informational - no errors)
46 const sal_uInt16 SC_CONTINUE = 100;
47 const sal_uInt16 SC_SWITCHING_PROTOCOLS = 101;
48 // DAV extensions
49 const sal_uInt16 SC_PROCESSING = 102;
51 //2xx (Successful - no errors)
52 const sal_uInt16 SC_OK = 200;
53 const sal_uInt16 SC_CREATED = 201;
54 const sal_uInt16 SC_ACCEPTED = 202;
55 const sal_uInt16 SC_NON_AUTHORITATIVE_INFORMATION = 203;
56 const sal_uInt16 SC_NO_CONTENT = 204;
57 const sal_uInt16 SC_RESET_CONTENT = 205;
58 const sal_uInt16 SC_PARTIAL_CONTENT = 206;
59 // DAV extensions
60 const sal_uInt16 SC_MULTISTATUS = 207;
62 //3xx (Redirection)
63 const sal_uInt16 SC_MULTIPLE_CHOICES = 300;
64 const sal_uInt16 SC_MOVED_PERMANENTLY = 301;
65 const sal_uInt16 SC_MOVED_TEMPORARILY = 302;
66 const sal_uInt16 SC_SEE_OTHER = 303;
67 const sal_uInt16 SC_NOT_MODIFIED = 304;
68 const sal_uInt16 SC_USE_PROXY = 305;
69 const sal_uInt16 SC_TEMPORARY_REDIRECT = 307;
71 //4xx (Client error)
72 const sal_uInt16 SC_BAD_REQUEST = 400;
73 const sal_uInt16 SC_UNAUTHORIZED = 401;
74 const sal_uInt16 SC_PAYMENT_REQUIRED = 402;
75 const sal_uInt16 SC_FORBIDDEN = 403;
76 const sal_uInt16 SC_NOT_FOUND = 404;
77 const sal_uInt16 SC_METHOD_NOT_ALLOWED = 405;
78 const sal_uInt16 SC_NOT_ACCEPTABLE = 406;
79 const sal_uInt16 SC_PROXY_AUTHENTICATION_REQUIRED = 407;
80 const sal_uInt16 SC_REQUEST_TIMEOUT = 408;
81 const sal_uInt16 SC_CONFLICT = 409;
82 const sal_uInt16 SC_GONE = 410;
83 const sal_uInt16 SC_LENGTH_REQUIRED = 411;
84 const sal_uInt16 SC_PRECONDITION_FAILED = 412;
85 const sal_uInt16 SC_REQUEST_ENTITY_TOO_LARGE = 413;
86 const sal_uInt16 SC_REQUEST_URI_TOO_LONG = 414;
87 const sal_uInt16 SC_UNSUPPORTED_MEDIA_TYPE = 415;
88 const sal_uInt16 SC_REQUESTED_RANGE_NOT_SATISFIABLE = 416;
89 const sal_uInt16 SC_EXPECTATION_FAILED = 417;
90 // DAV extensions
91 const sal_uInt16 SC_UNPROCESSABLE_ENTITY = 422;
92 const sal_uInt16 SC_LOCKED = 423;
93 const sal_uInt16 SC_FAILED_DEPENDENCY = 424;
95 //5xx (Server error)
96 const sal_uInt16 SC_INTERNAL_SERVER_ERROR = 500;
97 const sal_uInt16 SC_NOT_IMPLEMENTED = 501;
98 const sal_uInt16 SC_BAD_GATEWAY = 502;
99 const sal_uInt16 SC_SERVICE_UNAVAILABLE = 503;
100 const sal_uInt16 SC_GATEWAY_TIMEOUT = 504;
101 const sal_uInt16 SC_HTTP_VERSION_NOT_SUPPORTED = 505;
102 // DAV extensions
103 const sal_uInt16 SC_INSUFFICIENT_STORAGE = 507;
105 /////////////////////////////////////////////////////////////////////////////
107 class DAVException
109 public:
110 enum ExceptionCode {
111 DAV_HTTP_ERROR = 0, // Generic error, mData = error message
112 DAV_HTTP_LOOKUP, // Name lookup failed, mData = server[:port]
113 DAV_HTTP_AUTH, // User authentication failed on server
114 DAV_HTTP_AUTHPROXY, // User authentication failed on proxy
115 DAV_HTTP_CONNECT, // Could not connect to server, mData = server[:port]
116 DAV_HTTP_TIMEOUT, // Connection timed out
117 DAV_HTTP_FAILED, // The precondition failed
118 DAV_HTTP_RETRY, // Retry request
119 DAV_HTTP_REDIRECT, // See http_redirect.h, mData = new URL
120 DAV_SESSION_CREATE, // session creation error, mData = server[:port]
121 DAV_INVALID_ARG }; // mData = file URL
123 private:
124 ExceptionCode mExceptionCode;
125 rtl::OUString mData;
126 sal_uInt16 mStatusCode;
128 public:
129 DAVException( ExceptionCode inExceptionCode ) :
130 mExceptionCode( inExceptionCode ), mStatusCode( SC_NONE ) {};
131 DAVException( ExceptionCode inExceptionCode,
132 const rtl::OUString & rData ) :
133 mExceptionCode( inExceptionCode ), mData( rData ),
134 mStatusCode( SC_NONE ) {};
135 DAVException( ExceptionCode inExceptionCode,
136 const rtl::OUString & rData,
137 sal_uInt16 nStatusCode ) :
138 mExceptionCode( inExceptionCode ), mData( rData ),
139 mStatusCode( nStatusCode ) {};
140 ~DAVException( ) {};
142 const ExceptionCode & getError() const { return mExceptionCode; }
143 const rtl::OUString & getData() const { return mData; }
144 sal_uInt16 getStatus() const { return mStatusCode; }
147 } // namespace webdav_ucp
149 #endif // _DAVEXCEPTION_HXX_