ApacheRequestHandlerFactory.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. //
  2. // ApacheRequestHandlerFactory.h
  3. //
  4. // Copyright (c) 2006-2011, Applied Informatics Software Engineering GmbH.
  5. // and Contributors.
  6. //
  7. // SPDX-License-Identifier: BSL-1.0
  8. //
  9. #ifndef ApacheConnector_ApacheRequestHandlerFactory_INCLUDED
  10. #define ApacheConnector_ApacheRequestHandlerFactory_INCLUDED
  11. #include "ApacheServerRequest.h"
  12. #include "Poco/Net/HTTPRequestHandlerFactory.h"
  13. #include "Poco/ClassLoader.h"
  14. #include "Poco/Mutex.h"
  15. #include <map>
  16. class ApacheRequestHandlerFactory: public Poco::Net::HTTPRequestHandlerFactory
  17. {
  18. public:
  19. ApacheRequestHandlerFactory();
  20. /// Constructs the ApacheRequestHandlerFactory
  21. ~ApacheRequestHandlerFactory();
  22. /// Destructor of the ApacheRequestHandlerFactory
  23. Poco::Net::HTTPRequestHandler* createRequestHandler(const Poco::Net::HTTPServerRequest& request);
  24. /// Creates a new request handler for the given HTTP request.
  25. bool mustHandle(const std::string& uri);
  26. /// Returns 1 if the given uri must be handled by the
  27. /// poco_mapper module, 0 otherwise.
  28. void handleURIs(const std::string& uris);
  29. /// Parses the given string for dllName, factoryName and the URIs to handle
  30. /// by the request-handler
  31. void addRequestHandlerFactory(const std::string& dllPath, const std::string& factoryName, const std::string& uri);
  32. /// Adds the request handler from the given dll with the given name and
  33. /// registers that handler with the given uri
  34. private:
  35. typedef std::map<std::string, Poco::Net::HTTPRequestHandlerFactory*> RequestHandlerFactories;
  36. RequestHandlerFactories _requestHandlers;
  37. Poco::ClassLoader<Poco::Net::HTTPRequestHandlerFactory> _loader;
  38. Poco::FastMutex _mutex;
  39. };
  40. #endif // ApacheConnector_ApacheRequestHandlerFactory_INCLUDED