pub struct HttpStaticConfig {
pub dir: PathBuf,
pub port: u16,
pub host: String,
pub spa_fallback: bool,
pub cache_control: String,
pub error_pages: HashMap<u16, PathBuf>,
pub mount_path: String,
}Expand description
Configuration for an http-static: server endpoint.
Parsed from either a Camel URI (http-static:/path?port=8080&spaFallback=true)
or a Camel.toml profile section ([default.components.http-static]).
§Config Resolution
Camel.toml profile defaults are applied first, then URI params override
individual fields. Use HttpStaticConfig::from_uri_with_defaults for
the merged resolution.
Fields§
§dir: PathBufRoot directory to serve static files from.
port: u16TCP port to listen on.
host: StringBind address.
spa_fallback: boolServe index.html for unmatched paths (SPA mode).
cache_control: StringCache-Control header value applied to all static responses.
error_pages: HashMap<u16, PathBuf>Custom error pages mapped by HTTP status code.
mount_path: StringURL path prefix this mount serves on (e.g. “/assets”).
Derived from the URI path in http-static:/assets?dir=/var/www.
Implementations§
Source§impl HttpStaticConfig
impl HttpStaticConfig
Sourcepub fn from_uri_with_defaults(
uri: &str,
toml_defaults: &Self,
) -> Result<Self, CamelError>
pub fn from_uri_with_defaults( uri: &str, toml_defaults: &Self, ) -> Result<Self, CamelError>
Resolve config from a URI, with TOML-provided defaults applied first.
Fields present in the URI params override the corresponding values from
toml_defaults. Fields absent from the URI retain their TOML value.
§Config Resolution Order
- Start with
toml_defaults(from Camel.toml profile) - Override individual fields where URI params are present
- Apply hardcoded defaults for any remaining unset fields
Trait Implementations§
Source§impl Clone for HttpStaticConfig
impl Clone for HttpStaticConfig
Source§fn clone(&self) -> HttpStaticConfig
fn clone(&self) -> HttpStaticConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more