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
Source§impl HttpStaticConfig
impl HttpStaticConfig
Sourcepub fn metadata() -> ComponentMetadata
pub fn metadata() -> ComponentMetadata
Component metadata for the http-static scheme, derived from the
#[uri_param] fields on HttpStaticUriConfig.
Sourcepub fn uri_options() -> Vec<UriOption>
pub fn uri_options() -> Vec<UriOption>
URI option definitions, derived from #[uri_param] 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 moreSource§impl Debug for HttpStaticConfig
impl Debug for HttpStaticConfig
Source§impl Default for HttpStaticConfig
impl Default for HttpStaticConfig
Source§impl<'de> Deserialize<'de> for HttpStaticConfig
impl<'de> Deserialize<'de> for HttpStaticConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl UriConfig for HttpStaticConfig
impl UriConfig for HttpStaticConfig
Source§fn scheme() -> &'static str
fn scheme() -> &'static str
Source§fn from_uri(uri: &str) -> Result<Self, CamelError>
fn from_uri(uri: &str) -> Result<Self, CamelError>
Source§fn from_components(parts: UriComponents) -> Result<Self, CamelError>
fn from_components(parts: UriComponents) -> Result<Self, CamelError>
Source§fn validate(self) -> Result<Self, CamelError>
fn validate(self) -> Result<Self, CamelError>
Auto Trait Implementations§
impl Freeze for HttpStaticConfig
impl RefUnwindSafe for HttpStaticConfig
impl Send for HttpStaticConfig
impl Sync for HttpStaticConfig
impl Unpin for HttpStaticConfig
impl UnsafeUnpin for HttpStaticConfig
impl UnwindSafe for HttpStaticConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more