MCPcopy Create free account
hub / github.com/ByConity/ByConity / createHandlerFactory

Function createHandlerFactory

src/Server/HTTPHandlerFactory.cpp:139–158  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

137}
138
139HTTPRequestHandlerFactoryPtr
140createHandlerFactory(IServer & server, AsynchronousMetrics & async_metrics, const std::string & name, ContextMutablePtr context)
141{
142 if (name == "HTTPHandler-factory" || name == "HTTPSHandler-factory")
143 return createHTTPHandlerFactory(server, name, async_metrics, context);
144 else if (name == "InterserverIOHTTPHandler-factory" || name == "InterserverIOHTTPSHandler-factory")
145 return createInterserverHTTPHandlerFactory(server, name);
146 else if (name == "PrometheusHandler-factory")
147 {
148 auto factory = std::make_shared<HTTPRequestHandlerFactoryMain>(name);
149 auto handler = std::make_shared<HandlingRuleHTTPHandlerFactory<PrometheusRequestHandler>>(
150 server, std::make_shared<ServerPrometheusMetricsWriter>(server.config(), context, "prometheus", async_metrics));
151 handler->attachStrictPath(server.config().getString("prometheus.endpoint", "/metrics"));
152 handler->allowGetAndHeadRequest();
153 factory->addHandler(handler);
154 return factory;
155 }
156
157 throw Exception("LOGICAL ERROR: Unknown HTTP handler factory name.", ErrorCodes::LOGICAL_ERROR);
158}
159
160static const auto ping_response_expression = "Ok.\n";
161static const auto root_response_expression = "config://http_server_default_response";

Callers 1

mainMethod · 0.85

Calls 8

createHTTPHandlerFactoryFunction · 0.85
attachStrictPathMethod · 0.80
ExceptionClass · 0.50
configMethod · 0.45
getStringMethod · 0.45
addHandlerMethod · 0.45

Tested by

no test coverage detected