[#1372] Add SERVER_SERVLET_CONTEXT_PATH support (#1433)

added support for SERVER_SERVLET_CONTEXT_PATH. Could be used in some cases

Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
This commit is contained in:
Avgustin Marinov
2023-09-26 11:58:38 +03:00
committed by GitHub
parent b51a5d6c90
commit e2d90b7092
5 changed files with 39 additions and 46 deletions

View File

@@ -17,6 +17,7 @@ import org.eclipse.hawkbit.api.ArtifactUrlHandler;
import org.eclipse.hawkbit.api.ArtifactUrlHandlerProperties;
import org.eclipse.hawkbit.api.HostnameResolver;
import org.eclipse.hawkbit.api.PropertyBasedArtifactUrlHandler;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
@@ -58,8 +59,9 @@ public class PropertyHostnameResolverAutoConfiguration {
@Bean
@ConditionalOnMissingBean(ArtifactUrlHandler.class)
PropertyBasedArtifactUrlHandler propertyBasedArtifactUrlHandler(
final ArtifactUrlHandlerProperties urlHandlerProperties) {
return new PropertyBasedArtifactUrlHandler(urlHandlerProperties);
final ArtifactUrlHandlerProperties urlHandlerProperties,
@Value("${server.servlet.context-path:}") final String contextPath) {
return new PropertyBasedArtifactUrlHandler(urlHandlerProperties, contextPath);
}
}