ServiceException.h
Aller à la documentation de ce fichier.
1 /*
2  * Copyright © (2011-2013) Institut national de l'information
3  * géographique et forestière
4  *
5  * Géoportail SAV <contact.geoservices@ign.fr>
6  *
7  * This software is a computer program whose purpose is to publish geographic
8  * data using OGC WMS and WMTS protocol.
9  *
10  * This software is governed by the CeCILL-C license under French law and
11  * abiding by the rules of distribution of free software. You can use,
12  * modify and/ or redistribute the software under the terms of the CeCILL-C
13  * license as circulated by CEA, CNRS and INRIA at the following URL
14  * "http://www.cecill.info".
15  *
16  * As a counterpart to the access to the source code and rights to copy,
17  * modify and redistribute granted by the license, users are provided only
18  * with a limited warranty and the software's author, the holder of the
19  * economic rights, and the successive licensors have only limited
20  * liability.
21  *
22  * In this respect, the user's attention is drawn to the risks associated
23  * with loading, using, modifying and/or developing or reproducing the
24  * software by the user in light of its specific status of free software,
25  * that may mean that it is complicated to manipulate, and that also
26  * therefore means that it is reserved for developers and experienced
27  * professionals having in-depth computer knowledge. Users are therefore
28  * encouraged to load and test the software's suitability as regards their
29  * requirements in conditions enabling the security of their systems and/or
30  * data to be ensured and, more generally, to use and operate it in the
31  * same conditions as regards security.
32  *
33  * The fact that you are presently reading this means that you have had
34  *
35  * knowledge of the CeCILL-C license and that you accept its terms.
36  */
37 
46 #ifndef SERVICE_EXCEPTION_H
47 #define SERVICE_EXCEPTION_H
48 
49 #include <string>
50 #include <map>
51 
52 
59 typedef enum {
170 
171 } ExceptionCode;
172 
173 
189 private:
194  std::string locator;
199  ExceptionCode code ;
204  std::string message;
209  std::string service;
214  std::string format;
215 
216 public:
233  ServiceException ( std::string locator, ExceptionCode code, std::string message, std::string service, std::string format = "text/xml" ) ;
234 
245  static std::string getCodeAsString ( ExceptionCode code );
246 
257  static int getCodeAsStatusCode ( ExceptionCode code );
258 
269  static std::string getStatusCodeAsReasonPhrase ( int statusCode );
270 
279  std::string toString();
280 
289  std::string getService() {
290  return this->service ;
291  } ;
292 
301  std::string getFormat() {
302  return this->format ;
303  } ;
304 
314  return this->code;
315  } ;
316 };
317 
318 
319 #endif // SERVICE_EXCEPTION_H
WMTS_TILE_OUT_OF_RANGE
@ WMTS_TILE_OUT_OF_RANGE
Definition: ServiceException.h:139
ServiceException::getCode
ExceptionCode getCode()
Retourne le code de l'erreur.
Definition: ServiceException.h:313
WMS_LAYER_NOT_QUERYABLE
@ WMS_LAYER_NOT_QUERYABLE
Definition: ServiceException.h:109
OWS_VERSION_NEGOTIATION_FAILED
@ OWS_VERSION_NEGOTIATION_FAILED
Definition: ServiceException.h:74
ServiceException::toString
std::string toString()
Génère la chaîne de caracteres relative à l'exception décrite par l'objet.
Definition: ServiceException.cpp:175
WMS_INVALID_POINT
@ WMS_INVALID_POINT
Definition: ServiceException.h:114
HTTP_NOT_FOUND
@ HTTP_NOT_FOUND
Definition: ServiceException.h:144
ServiceException
Gestion des exceptions de service.
Definition: ServiceException.h:188
WMS_INVALID_CRS
@ WMS_INVALID_CRS
Definition: ServiceException.h:94
INTERNAL_SERVER_ERROR
@ INTERNAL_SERVER_ERROR
Definition: ServiceException.h:164
OWS_OPERATION_NOT_SUPORTED
@ OWS_OPERATION_NOT_SUPORTED
Definition: ServiceException.h:134
ServiceException::getCodeAsString
static std::string getCodeAsString(ExceptionCode code)
Retourne le code d'erreur sous forme de texte.
Definition: ServiceException.cpp:52
OWS_NOAPPLICABLE_CODE
@ OWS_NOAPPLICABLE_CODE
Definition: ServiceException.h:84
SERVICE_UNAVAILABLE
@ SERVICE_UNAVAILABLE
Definition: ServiceException.h:169
ServiceException::getService
std::string getService()
Retourne le nom du service.
Definition: ServiceException.h:289
ADMIN_BAD_REQUEST
@ ADMIN_BAD_REQUEST
Definition: ServiceException.h:159
WMS_CURRENT_UPDATESEQUENCE
@ WMS_CURRENT_UPDATESEQUENCE
Definition: ServiceException.h:119
OWS_MISSING_PARAMETER_VALUE
@ OWS_MISSING_PARAMETER_VALUE
Definition: ServiceException.h:64
ExceptionCode
ExceptionCode
Codes d'exceptions definis par les specifications WMS, OWS et HTTP.
Definition: ServiceException.h:59
WMS_LAYER_NOT_DEFINED
@ WMS_LAYER_NOT_DEFINED
Definition: ServiceException.h:99
ServiceException::getFormat
std::string getFormat()
Retourne le format du message.
Definition: ServiceException.h:301
WMS_MISSING_DIMENSION_VALUE
@ WMS_MISSING_DIMENSION_VALUE
Definition: ServiceException.h:124
OWS_INVALID_UPDATESEQUENCE
@ OWS_INVALID_UPDATESEQUENCE
Definition: ServiceException.h:79
WMS_INVALID_DIMENSION_VALUE
@ WMS_INVALID_DIMENSION_VALUE
Definition: ServiceException.h:129
ServiceException::getCodeAsStatusCode
static int getCodeAsStatusCode(ExceptionCode code)
Retourne le status code HTTP associe à l'exception.
Definition: ServiceException.cpp:103
ADMIN_CONFLICT
@ ADMIN_CONFLICT
Definition: ServiceException.h:154
GFI_PYRAMID_VALUES
@ GFI_PYRAMID_VALUES
Definition: ServiceException.h:149
WMS_STYLE_NOT_DEFINED
@ WMS_STYLE_NOT_DEFINED
Definition: ServiceException.h:104
ServiceException::getStatusCodeAsReasonPhrase
static std::string getStatusCodeAsReasonPhrase(int statusCode)
Retourne la phrase explicative associée au status code http.
Definition: ServiceException.cpp:139
OWS_INVALID_PARAMETER_VALUE
@ OWS_INVALID_PARAMETER_VALUE
Definition: ServiceException.h:69
WMS_INVALID_FORMAT
@ WMS_INVALID_FORMAT
Definition: ServiceException.h:89
ServiceException::ServiceException
ServiceException(std::string locator, ExceptionCode code, std::string message, std::string service, std::string format="text/xml")
Definition: ServiceException.cpp:162