use of org.apache.camel.spi.RestConfiguration in project camel by apache.
the class RestletComponent method doStart.
@Override
protected void doStart() throws Exception {
super.doStart();
// configure component options
RestConfiguration config = getCamelContext().getRestConfiguration("restlet", true);
// configure additional options on spark configuration
if (config.getComponentProperties() != null && !config.getComponentProperties().isEmpty()) {
setProperties(this, config.getComponentProperties());
}
cleanupConverters(enabledConverters);
component.start();
}
use of org.apache.camel.spi.RestConfiguration in project camel by apache.
the class ServletComponent method doStart.
@Override
protected void doStart() throws Exception {
super.doStart();
RestConfiguration config = getCamelContext().getRestConfiguration("servlet", true);
// configure additional options on jetty configuration
if (config.getComponentProperties() != null && !config.getComponentProperties().isEmpty()) {
setProperties(this, config.getComponentProperties());
}
}
use of org.apache.camel.spi.RestConfiguration in project camel by apache.
the class NettyHttpComponent method doStart.
@Override
protected void doStart() throws Exception {
super.doStart();
RestConfiguration config = getCamelContext().getRestConfiguration("netty4-http", true);
// configure additional options on netty4-http configuration
if (config.getComponentProperties() != null && !config.getComponentProperties().isEmpty()) {
setProperties(this, config.getComponentProperties());
}
}
use of org.apache.camel.spi.RestConfiguration in project camel by apache.
the class RestSwaggerEndpointTest method shouldDetermineHostFromRestConfiguration.
@Test
public void shouldDetermineHostFromRestConfiguration() {
assertThat(RestSwaggerEndpoint.hostFrom(null)).isNull();
final RestConfiguration configuration = new RestConfiguration();
assertThat(RestSwaggerEndpoint.hostFrom(configuration)).isNull();
configuration.setScheme("ftp");
assertThat(RestSwaggerEndpoint.hostFrom(configuration)).isNull();
configuration.setScheme("http");
assertThat(RestSwaggerEndpoint.hostFrom(configuration)).isNull();
configuration.setHost("petstore.swagger.io");
assertThat(RestSwaggerEndpoint.hostFrom(configuration)).isEqualTo("http://petstore.swagger.io");
configuration.setPort(80);
assertThat(RestSwaggerEndpoint.hostFrom(configuration)).isEqualTo("http://petstore.swagger.io");
configuration.setPort(8080);
assertThat(RestSwaggerEndpoint.hostFrom(configuration)).isEqualTo("http://petstore.swagger.io:8080");
configuration.setScheme("https");
configuration.setPort(80);
assertThat(RestSwaggerEndpoint.hostFrom(configuration)).isEqualTo("https://petstore.swagger.io:80");
configuration.setPort(443);
assertThat(RestSwaggerEndpoint.hostFrom(configuration)).isEqualTo("https://petstore.swagger.io");
}
use of org.apache.camel.spi.RestConfiguration in project camel by apache.
the class RestSwaggerEndpoint method determineBasePath.
String determineBasePath(final Swagger swagger) {
if (isNotEmpty(basePath)) {
return basePath;
}
final String componentBasePath = component().getBasePath();
if (isNotEmpty(componentBasePath)) {
return componentBasePath;
}
final String specificationBasePath = swagger.getBasePath();
if (isNotEmpty(specificationBasePath)) {
return specificationBasePath;
}
final CamelContext camelContext = getCamelContext();
final RestConfiguration specificConfiguration = camelContext.getRestConfiguration(assignedComponentName, false);
if (specificConfiguration != null && isNotEmpty(specificConfiguration.getContextPath())) {
return specificConfiguration.getContextPath();
}
final RestConfiguration restConfiguration = camelContext.getRestConfiguration("rest-swagger", true);
final String restConfigurationBasePath = restConfiguration.getContextPath();
if (isNotEmpty(restConfigurationBasePath)) {
return restConfigurationBasePath;
}
return RestSwaggerComponent.DEFAULT_BASE_PATH;
}
Aggregations