Bump for 3.6-28
[LibreOffice.git] / ucb / source / ucp / webdav / DAVException.hxx
blob376f7ff337ed8853909b4f45ad49c73e722f2d29
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 #ifndef _DAVEXCEPTION_HXX_
30 #define _DAVEXCEPTION_HXX_
32 #include <rtl/ustring.hxx>
34 namespace webdav_ucp
37 /////////////////////////////////////////////////////////////////////////////
38 // HTTP/WebDAV status codes
39 /////////////////////////////////////////////////////////////////////////////
41 const sal_uInt16 SC_NONE = 0;
43 // 1xx (Informational - no errors)
44 const sal_uInt16 SC_CONTINUE = 100;
45 const sal_uInt16 SC_SWITCHING_PROTOCOLS = 101;
46 // DAV extensions
47 const sal_uInt16 SC_PROCESSING = 102;
49 //2xx (Successful - no errors)
50 const sal_uInt16 SC_OK = 200;
51 const sal_uInt16 SC_CREATED = 201;
52 const sal_uInt16 SC_ACCEPTED = 202;
53 const sal_uInt16 SC_NON_AUTHORITATIVE_INFORMATION = 203;
54 const sal_uInt16 SC_NO_CONTENT = 204;
55 const sal_uInt16 SC_RESET_CONTENT = 205;
56 const sal_uInt16 SC_PARTIAL_CONTENT = 206;
57 // DAV extensions
58 const sal_uInt16 SC_MULTISTATUS = 207;
60 //3xx (Redirection)
61 const sal_uInt16 SC_MULTIPLE_CHOICES = 300;
62 const sal_uInt16 SC_MOVED_PERMANENTLY = 301;
63 const sal_uInt16 SC_MOVED_TEMPORARILY = 302;
64 const sal_uInt16 SC_SEE_OTHER = 303;
65 const sal_uInt16 SC_NOT_MODIFIED = 304;
66 const sal_uInt16 SC_USE_PROXY = 305;
67 const sal_uInt16 SC_TEMPORARY_REDIRECT = 307;
69 //4xx (Client error)
70 const sal_uInt16 SC_BAD_REQUEST = 400;
71 const sal_uInt16 SC_UNAUTHORIZED = 401;
72 const sal_uInt16 SC_PAYMENT_REQUIRED = 402;
73 const sal_uInt16 SC_FORBIDDEN = 403;
74 const sal_uInt16 SC_NOT_FOUND = 404;
75 const sal_uInt16 SC_METHOD_NOT_ALLOWED = 405;
76 const sal_uInt16 SC_NOT_ACCEPTABLE = 406;
77 const sal_uInt16 SC_PROXY_AUTHENTICATION_REQUIRED = 407;
78 const sal_uInt16 SC_REQUEST_TIMEOUT = 408;
79 const sal_uInt16 SC_CONFLICT = 409;
80 const sal_uInt16 SC_GONE = 410;
81 const sal_uInt16 SC_LENGTH_REQUIRED = 411;
82 const sal_uInt16 SC_PRECONDITION_FAILED = 412;
83 const sal_uInt16 SC_REQUEST_ENTITY_TOO_LARGE = 413;
84 const sal_uInt16 SC_REQUEST_URI_TOO_LONG = 414;
85 const sal_uInt16 SC_UNSUPPORTED_MEDIA_TYPE = 415;
86 const sal_uInt16 SC_REQUESTED_RANGE_NOT_SATISFIABLE = 416;
87 const sal_uInt16 SC_EXPECTATION_FAILED = 417;
88 // DAV extensions
89 const sal_uInt16 SC_UNPROCESSABLE_ENTITY = 422;
90 const sal_uInt16 SC_LOCKED = 423;
91 const sal_uInt16 SC_FAILED_DEPENDENCY = 424;
93 //5xx (Server error)
94 const sal_uInt16 SC_INTERNAL_SERVER_ERROR = 500;
95 const sal_uInt16 SC_NOT_IMPLEMENTED = 501;
96 const sal_uInt16 SC_BAD_GATEWAY = 502;
97 const sal_uInt16 SC_SERVICE_UNAVAILABLE = 503;
98 const sal_uInt16 SC_GATEWAY_TIMEOUT = 504;
99 const sal_uInt16 SC_HTTP_VERSION_NOT_SUPPORTED = 505;
100 // DAV extensions
101 const sal_uInt16 SC_INSUFFICIENT_STORAGE = 507;
103 /////////////////////////////////////////////////////////////////////////////
105 class DAVException
107 public:
108 enum ExceptionCode {
109 DAV_HTTP_ERROR = 0, // Generic error,
110 // mData = server error message,
111 // mStatusCode = HTTP status code
112 DAV_HTTP_LOOKUP, // Name lookup failed,
113 // mData = server[:port]
114 DAV_HTTP_AUTH, // User authentication failed on server,
115 // mData = server[:port]
116 DAV_HTTP_AUTHPROXY, // User authentication failed on proxy,
117 // mData = proxy server[:port]
118 DAV_HTTP_CONNECT, // Could not connect to server,
119 // mData = server[:port]
120 DAV_HTTP_TIMEOUT, // Connection timed out
121 // mData = server[:port]
122 DAV_HTTP_FAILED, // The precondition failed
123 // mData = server[:port]
124 DAV_HTTP_RETRY, // Retry request
125 // mData = server[:port]
126 DAV_HTTP_REDIRECT, // Request was redirected,
127 // mData = new URL
128 DAV_SESSION_CREATE, // session creation error,
129 // mData = server[:port]
130 DAV_INVALID_ARG, // invalid argument
132 DAV_LOCK_EXPIRED, // DAV lock expired
134 DAV_NOT_LOCKED, // not locked
136 DAV_LOCKED_SELF, // locked by this OOo session
138 DAV_LOCKED // locked by third party
141 private:
142 ExceptionCode mExceptionCode;
143 rtl::OUString mData;
144 sal_uInt16 mStatusCode;
146 public:
147 DAVException( ExceptionCode inExceptionCode ) :
148 mExceptionCode( inExceptionCode ), mStatusCode( SC_NONE ) {};
149 DAVException( ExceptionCode inExceptionCode,
150 const rtl::OUString & rData ) :
151 mExceptionCode( inExceptionCode ), mData( rData ),
152 mStatusCode( SC_NONE ) {};
153 DAVException( ExceptionCode inExceptionCode,
154 const rtl::OUString & rData,
155 sal_uInt16 nStatusCode ) :
156 mExceptionCode( inExceptionCode ), mData( rData ),
157 mStatusCode( nStatusCode ) {};
158 ~DAVException( ) {};
160 const ExceptionCode & getError() const { return mExceptionCode; }
161 const rtl::OUString & getData() const { return mData; }
162 sal_uInt16 getStatus() const { return mStatusCode; }
165 } // namespace webdav_ucp
167 #endif // _DAVEXCEPTION_HXX_
169 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */