[
https://issues.apache.org/jira/browse/CAMEL-12514?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16475753#comment-16475753
]
ASF GitHub Bot commented on CAMEL-12514:
----------------------------------------
oscerd closed pull request #2341: CAMEL-12514 Extract undertow component name
into standalone method
URL: https://github.com/apache/camel/pull/2341
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git
a/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/UndertowComponent.java
b/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/UndertowComponent.java
index f1de36efb3a..4da41884a8b 100644
---
a/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/UndertowComponent.java
+++
b/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/UndertowComponent.java
@@ -165,7 +165,7 @@ Consumer doCreateConsumer(CamelContext camelContext,
Processor processor, String
RestConfiguration config = configuration;
if (config == null) {
- config = camelContext.getRestConfiguration("undertow", true);
+ config = camelContext.getRestConfiguration(getComponentName(),
true);
}
if (config.getScheme() != null) {
scheme = config.getScheme();
@@ -201,7 +201,7 @@ Consumer doCreateConsumer(CamelContext camelContext,
Processor processor, String
Map<String, Object> map = new HashMap<>();
// build query string, and append any endpoint configuration properties
- if (config.getComponent() == null ||
config.getComponent().equals("undertow")) {
+ if (config.getComponent() == null ||
config.getComponent().equals(getComponentName())) {
// setup endpoint options
if (config.getEndpointProperties() != null &&
!config.getEndpointProperties().isEmpty()) {
map.putAll(config.getEndpointProperties());
@@ -231,9 +231,9 @@ Consumer doCreateConsumer(CamelContext camelContext,
Processor processor, String
String url;
if (api) {
- url =
"undertow:%s://%s:%s/%s?matchOnUriPrefix=true&httpMethodRestrict=%s";
+ url = getComponentName() +
":%s://%s:%s/%s?matchOnUriPrefix=true&httpMethodRestrict=%s";
} else {
- url =
"undertow:%s://%s:%s/%s?matchOnUriPrefix=false&httpMethodRestrict=%s";
+ url = getComponentName() +
":%s://%s:%s/%s?matchOnUriPrefix=false&httpMethodRestrict=%s";
}
// get the endpoint
@@ -270,7 +270,7 @@ public Producer createProducer(CamelContext camelContext,
String host,
uriTemplate = FileUtil.stripLeadingSeparator(uriTemplate);
// get the endpoint
- String url = "undertow:" + host;
+ String url = getComponentName() + ":" + host;
if (!ObjectHelper.isEmpty(basePath)) {
url += "/" + basePath;
}
@@ -280,12 +280,12 @@ public Producer createProducer(CamelContext camelContext,
String host,
RestConfiguration config = configuration;
if (config == null) {
- config = camelContext.getRestConfiguration("undertow", true);
+ config = camelContext.getRestConfiguration(getComponentName(),
true);
}
Map<String, Object> map = new HashMap<>();
// build query string, and append any endpoint configuration properties
- if (config.getComponent() == null ||
config.getComponent().equals("undertow")) {
+ if (config.getComponent() == null ||
config.getComponent().equals(getComponentName())) {
// setup endpoint options
if (config.getEndpointProperties() != null &&
!config.getEndpointProperties().isEmpty()) {
map.putAll(config.getEndpointProperties());
@@ -315,7 +315,7 @@ public Producer createProducer(CamelContext camelContext,
String host,
protected void doStart() throws Exception {
super.doStart();
- RestConfiguration config =
getCamelContext().getRestConfiguration("undertow", true);
+ RestConfiguration config =
getCamelContext().getRestConfiguration(getComponentName(), true);
// configure additional options on undertow configuration
if (config.getComponentProperties() != null &&
!config.getComponentProperties().isEmpty()) {
setProperties(this, config.getComponentProperties());
@@ -392,4 +392,8 @@ public void setHostOptions(UndertowHostOptions hostOptions)
{
public ComponentVerifier getVerifier() {
return (scope, parameters) ->
getExtension(ComponentVerifierExtension.class).orElseThrow(UnsupportedOperationException::new).verify(scope,
parameters);
}
+
+ protected String getComponentName() {
+ return "undertow";
+ }
}
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> Extract undertow component name to allow extensibility
> ------------------------------------------------------
>
> Key: CAMEL-12514
> URL: https://issues.apache.org/jira/browse/CAMEL-12514
> Project: Camel
> Issue Type: Improvement
> Components: camel-undertow
> Affects Versions: 2.21.0
> Reporter: Hynek Mlnarik
> Priority: Major
> Fix For: 2.22.0
>
>
> {{UndertowComponent}} contains several places where {{undertow}} component
> name is hardcoded. That makes it hard to extend this component. This task is
> to extract the component name into a separate {{protected}} method.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)