Handler that returns HTTP 200 if file exist and returns file data with mapped content/type.
Dynamic config
Userver HTTP Handlers.
Static options:
Inherits all the options from server::handlers::HttpHandlerBase and adds the following ones:
Name | Description | Default value |
fs-cache-component | Name of the FsCache component | fs-cache-component |
Example usage:
int main(int argc, char* argv[]) {
const auto component_list =
.Append<server::handlers::HttpHandlerStatic>();
}
Definition at line 41 of file http_handler_static.hpp.
|
| HttpHandlerStatic (const components::ComponentConfig &config, const components::ComponentContext &context) |
|
std::string | HandleRequestThrow (const http::HttpRequest &request, request::RequestContext &) const override |
|
| HttpHandlerBase (const components::ComponentConfig &config, const components::ComponentContext &component_context, bool is_monitor=false) |
|
Public Member Functions inherited from server::handlers::HttpHandlerBase |
| HttpHandlerBase (const components::ComponentConfig &config, const components::ComponentContext &component_context, bool is_monitor=false) |
|
void | HandleRequest (request::RequestBase &request, request::RequestContext &context) const override |
|
void | ReportMalformedRequest (request::RequestBase &request) const final |
|
virtual const std::string & | HandlerName () const |
|
const std::vector< http::HttpMethod > & | GetAllowedMethods () const |
|
virtual logging::Level | GetLogLevelForResponseStatus (http::HttpStatus status) const |
|
virtual FormattedErrorData | GetFormattedExternalErrorBody (const CustomHandlerException &exc) const |
|
std::string | GetResponseDataForLoggingChecked (const http::HttpRequest &request, request::RequestContext &context, const std::string &response_data) const |
|
void | HandleCustomHandlerException (const http::HttpRequest &request, const CustomHandlerException &ex) const |
|
void | HandleUnknownException (const http::HttpRequest &request, const std::exception &ex) const |
|
void | LogUnknownException (const std::exception &ex) const |
| Helper function to log an unknown exception.
|
|
const std::optional< logging::Level > & | GetLogLevel () const |
| Returns the default log level for the handler.
|
|
Public Member Functions inherited from server::handlers::HandlerBase |
| HandlerBase (const components::ComponentConfig &config, const components::ComponentContext &component_context, bool is_monitor=false) |
|
bool | IsMonitor () const |
| Returns whether this is a monitoring handler.
|
|
const HandlerConfig & | GetConfig () const |
| Returns handler config.
|
|
| LoggableComponentBase (const ComponentConfig &, const ComponentContext &) |
|
| LoggableComponentBase (LoggableComponentBase &&)=delete |
|
| LoggableComponentBase (const LoggableComponentBase &)=delete |
|
| ~LoggableComponentBase () override=default |
|
ComponentHealth | GetComponentHealth () const override |
|
void | OnLoadingCancelled () override |
|
void | OnAllComponentsLoaded () override |
|
void | OnAllComponentsAreStopping () override |
|