Mercurial > hg > orthanc
diff Core/HttpServer/MongooseServer.h @ 1645:1558b3226b18
IHttpExceptionFormatter
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 24 Sep 2015 15:55:17 +0200 |
parents | d73124f6b439 |
children | b1291df2f780 |
line wrap: on
line diff
--- a/Core/HttpServer/MongooseServer.h Wed Sep 23 22:05:27 2015 +0200 +++ b/Core/HttpServer/MongooseServer.h Thu Sep 24 15:55:17 2015 +0200 @@ -34,6 +34,8 @@ #include "IHttpHandler.h" +#include "../OrthancException.h" + #include <list> #include <map> #include <set> @@ -57,6 +59,21 @@ const char* username) const = 0; }; + + class IHttpExceptionFormatter + { + public: + virtual ~IHttpExceptionFormatter() + { + } + + virtual void Format(HttpOutput& output, + const OrthancException& exception, + HttpMethod method, + const char* uri) = 0; + }; + + class MongooseServer { private: @@ -77,7 +94,7 @@ IIncomingHttpRequestFilter* filter_; bool keepAlive_; bool httpCompression_; - bool describeErrors_; + IHttpExceptionFormatter* exceptionFormatter_; bool IsRunning() const; @@ -144,13 +161,6 @@ void SetHttpCompressionEnabled(bool enabled); - bool IsDescribeErrorsEnabled() const - { - return describeErrors_; - } - - void SetDescribeErrorsEnabled(bool enabled); - const IIncomingHttpRequestFilter* GetIncomingHttpRequestFilter() const { return filter_; @@ -170,5 +180,12 @@ } IHttpHandler& GetHandler() const; + + void SetHttpExceptionFormatter(IHttpExceptionFormatter& formatter); + + IHttpExceptionFormatter* GetExceptionFormatter() + { + return exceptionFormatter_; + } }; }