Skip to content

Commit ed3ad83

Browse files
authored
faq update (#21804)
* CAMEL-16861: Cleanup docs
1 parent f0ee32d commit ed3ad83

16 files changed

Lines changed: 181 additions & 487 deletions

components/camel-cxf/camel-cxf-soap/src/main/docs/cxf-component.adoc

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1134,4 +1134,90 @@ ServletRequest request = (ServletRequest) cxfMessage.get("HTTP.REQUEST");
11341134
String remoteAddress = request.getRemoteAddr();
11351135
----
11361136

1137+
== How to switch the CXF consumer between HTTP and HTTPS without touching the Spring configuration?
1138+
1139+
You can find general information how to secure your Camel CXF Consumer with HTTPS in the
1140+
http://cxf.apache.org/docs/client-http-transport-including-ssl-support.html[Apache CXF Client HTTP transport documentation].
1141+
1142+
A simple Camel CXF Consumer configuration which use the `\http:conduit`
1143+
configuration to enable SSL and an external properties file for all
1144+
environment specific configurations could look like in Spring XML:
1145+
1146+
.Spring XML
1147+
[source,xml]
1148+
----
1149+
<beans xmlns="http://www.springframework.org/schema/beans"
1150+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1151+
xmlns:ctx="http://www.springframework.org/schema/context"
1152+
xmlns:camel="http://camel.apache.org/schema/spring"
1153+
xmlns:camel-cxf="http://camel.apache.org/schema/cxf"
1154+
xmlns:http="http://cxf.apache.org/transports/http/configuration"
1155+
xmlns:sec="http://cxf.apache.org/configuration/security"
1156+
xsi:schemaLocation="
1157+
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
1158+
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
1159+
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
1160+
http://camel.apache.org/schema/osgi http://camel.apache.org/schema/osgi/camel-osgi.xsd
1161+
http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd
1162+
http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd
1163+
http://cxf.apache.org/configuration/security http://cxf.apache.org/schemas/configuration/security.xsd
1164+
">
1165+
1166+
<import resource="classpath:META-INF/cxf/cxf.xml" />
1167+
<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
1168+
<import resource="classpath:META-INF/cxf/cxf-extension-http-jetty.xml" />
1169+
1170+
<ctx:property-placeholder location="classpath:orderEntry.cfg" />
1171+
1172+
<camel-cxf:cxfEndpoint id="orderEntryEndpoint"
1173+
address="${endpointUri}"
1174+
serviceClass="com.company.product.OrderEntryService"
1175+
endpointName="ssp:OrderEntry"
1176+
serviceName="ssp:OrderEntryService"
1177+
wsdlURL="META-INF/orderEntry/orderEntry.wsdl"
1178+
xmlns:ssp="http://www.company.com/product/orderEntry/service/1" />
1179+
1180+
<http:conduit name="{http://www.company.com/product/orderEntry/service/1}OrderEntry.http-conduit">
1181+
<http:tlsClientParameters disableCNCheck="true">
1182+
<sec:trustManagers>
1183+
<sec:keyStore type="JKS" password="${trustStore.password}" file="${trustStore.file}"/>
1184+
</sec:trustManagers>
1185+
<sec:cipherSuitesFilter>
1186+
<sec:include>.*_EXPORT_.*</sec:include>
1187+
<sec:include>.*_EXPORT1024_.*</sec:include>
1188+
<sec:include>.*_WITH_DES_.*</sec:include>
1189+
<sec:include>.*_WITH_NULL_.*</sec:include>
1190+
<sec:exclude>.*_DH_anon_.*</sec:exclude>
1191+
</sec:cipherSuitesFilter>
1192+
</http:tlsClientParameters>
1193+
</http:conduit>
1194+
1195+
<camel:camelContext trace="true">
1196+
<camel:routeBuilder ref="orderEntryRoute" />
1197+
</camel:camelContext>
1198+
1199+
<bean id="orderEntryRoute" class="com.company.product.OrderEntryRoute" />
1200+
</beans>
1201+
----
1202+
1203+
The environment specific configurations are externalized into a properties file:
1204+
1205+
*orderEntry.cfg*
1206+
[source,java]
1207+
----
1208+
endpointUri=https://localhost:8181/OrderEntry
1209+
trustStore.password=password
1210+
trustStore.file=etc/myApp.ts
1211+
----
1212+
1213+
With this configuration, you Camel CXF consumer connects with HTTPS to the web service provider.
1214+
1215+
If you need to change the protocol to HTTP, maybe for tracing/debugging
1216+
reasons, change the `endpointUri` property in your properties file to
1217+
e.g. `\http://localhost:8080/OrderEntry`.
1218+
1219+
Apache CXF detects that you _only_ use HTTP and instantiates a
1220+
`HttpURLConnectionFactoryImpl` instead of a `HttpsURLConnectionFactory`.
1221+
1222+
11371223
include::spring-boot:partial$starter.adoc[]

core/camel-core-engine/src/main/docs/modules/eips/pages/removeHeaders-eip.adoc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,20 @@ YAML::
109109
----
110110
====
111111

112+
== Leaking Camel headers when sending to an endpoint
113+
114+
When I send a message to a Camel endpoint such as the
115+
xref:components::mail-component.adoc[Mail] component, then the mail include some message
116+
headers I do not want. How can I avoid this?
117+
118+
This is a gotcha more people encounter. However, it's very easy to solve.
119+
To remove all headers (see above) use a `*` expression:
120+
121+
Most components will automatically remove all Camel specific headers (the header key starts with `Camel`) using
122+
the `DefaultHeaderFilterStrategy` which automatic removes these headers. However if you use a component that does
123+
not do this, such as a custom component, or a Camel component which has not been improved to do that, then you can
124+
remove all these Camel specific headers using `Camel*` with the `removeHeaders` EIP as shown previously on this page.
125+
112126
== See Also
113127

114128
Camel provides the following EIPs for removing headers or exchange properties:

docs/user-manual/modules/ROOT/pages/component.adoc

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,21 @@ Component-DSL is a builder API that allows using type-safe construction of Camel
139139

140140
This is an advanced topic and described in more detail in the xref:writing-components.adoc[Writing Components Guide].
141141

142+
=== Using HeaderFilterStrategy with components
143+
144+
Some components supports configuring a custom header filter strategy.
145+
146+
This allows you to implement the
147+
`org.apache.camel.spi.HeaderFilterStrategy` interface, where one can
148+
filter unwanted headers from the communication while not removing them from the
149+
`Exchange`.
150+
151+
Camel core offers a default filter strategy implementation, the
152+
`DefaultHeaderFilterStrategy`, to which one can provide a regular expression
153+
pattern or a set of header names to be filtered out.
154+
155+
156+
142157
== See Also
143158

144159
- List of all Camel xref:components::index.adoc[Components]

docs/user-manual/modules/ROOT/pages/endpoint.adoc

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,27 @@ So if you write the following XML it should work...
177177
</route>
178178
----
179179

180+
If you do not escape the & sign, then you can `org.xml.sax.SAXParseException` or other kind of XML parsing errors.
181+
182+
In the URIs used for specifying Camel endpoints, the `&` is used to
183+
separate the parameters. However, `&` also is a reserved character in XML.
184+
185+
Because of this, you have to replace all `&` in your URIs by `+&amp;+` when
186+
using the XML DSL to configure Camel routes.
187+
188+
An example: this snippet of code in Java DSL:
189+
190+
[source,java]
191+
----
192+
from("timer://myTimer?fixedRate=true&delay=0&period=2000")
193+
----
194+
195+
... matches this example in the XML syntax where `&` has been replaced with `+&amp;+`
196+
197+
[source,xml]
198+
----
199+
<from uri="timer://myTimer?fixedRate=true&amp;delay=0&amp;period=2000"/>
200+
----
180201

181202
=== Configuring parameter values using raw values, such as passwords
182203

docs/user-manual/modules/ROOT/pages/exception-clause.adoc

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -725,6 +725,51 @@ And the same example in YAML DSL
725725
uri: mock:result
726726
----
727727

728+
== Why is the exception null when I use onException ?
729+
730+
If you use `onException` to handle exceptions, and want to get the caused
731+
`Exception` from a `Processor` in Java code, such as shown below:
732+
733+
[source,java]
734+
----
735+
.onException(Exception.class)
736+
.handled(true)
737+
.process(new Processor() {
738+
@Override
739+
public void process(Exchange exchange) throws Exception {
740+
Exception cause = exchange.getException();
741+
// why cause exception is null ???
742+
}
743+
})
744+
.end()
745+
----
746+
747+
Then beware the caused exception is no longer available from `exchange.getException()`, because
748+
the message is processed by the `onException` block.
749+
750+
Instead, you can access the caused exception from exchange property on the
751+
exchange with the key `Exchange.EXCEPTION_CAUGHT`, as follows:
752+
753+
[source,java]
754+
----
755+
Exception cause = exchange.getProperty(Exchange.EXCEPTION_CAUGHT, Exception.class);
756+
----
757+
758+
The correct code to use in the example is there:
759+
760+
[source,java]
761+
----
762+
.onException(Exception.class).handled(true)
763+
.process(new Processor() {
764+
@Override
765+
public void process(Exchange exchange) throws Exception {
766+
Exception cause = exchange.getProperty(Exchange.EXCEPTION_CAUGHT, Exception.class);
767+
// we now have the caused exception
768+
}
769+
})
770+
.end()
771+
----
772+
728773
== Handling and Sending a Fixed Response Back to the Client
729774

730775
In the route above we handled the exception but routed it to a different

docs/user-manual/modules/faq/nav.adoc

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,10 @@
44
** xref:how-can-i-get-the-source-code.adoc[How can I get the source code?]
55
** xref:how-do-i-become-a-committer.adoc[How do I become a committer?]
66
** xref:how-do-i-edit-the-website.adoc[How do I edit the website?]
7-
** xref:running-camel-standalone.adoc[Running Camel standalone]
87
** xref:what-is-camel.adoc[What is Camel?]
98
** xref:ROOT:languages.adoc[What languages are supported?]
109
** xref:why-the-name-camel.adoc[Why the name Camel?]
11-
** xref:how-to-avoid-sending-some-or-all-message-headers.adoc[How to avoid sending some or all message headers?]
1210
** xref:how-to-remove-the-http-protocol-headers-in-the-camel-message.adoc[How to remove the http protocol headers in the camel message?]
13-
** xref:how-to-switch-the-cxf-consumer-between-http-and-https-without-touching-the-spring-configuration.adoc[How to switch the CXF consumer between HTTP and HTTPS without touching the Spring configuration?]
1411
** xref:how-to-use-a-dynamic-uri-in-to.adoc[How to use a dynamic URI in to()?]
1512
** xref:using-getin-or-getout-methods-on-exchange.adoc[Using getIn or getOut methods on Exchange]
16-
** xref:why-can-i-not-use-when-or-otherwise-in-a-java-camel-route.adoc[Why can I not use when or otherwise in a Java Camel route?]
17-
** xref:why-does-my-file-consumer-not-pick-up-the-file-and-how-do-i-let-the-file-consumer-use-the-camel-error-handler.adoc[Why does my file consumer not pick up the file, and how do I let the file consumer use the Camel error handler?]
18-
** xref:why-does-useoriginalmessage-with-error-handler-not-work-as-expected.adoc[Why does useOriginalMessage with error handler not work as expected?]
1913
** xref:why-is-my-message-body-empty.adoc[Why is my message body empty?]
20-
** xref:why-is-the-exception-null-when-i-use-onexception.adoc[Why is the exception null when I use onException?]
21-
** xref:exception-orgapachecamelnosuchendpointexception.adoc[Exception - org.apache.camel.NoSuchEndpointException]
22-
** xref:exception-orgxmlsaxsaxparseexception.adoc[Exception - org.xml.sax.SAXParseException]

docs/user-manual/modules/faq/pages/exception-orgapachecamelnosuchendpointexception.adoc

Lines changed: 0 additions & 24 deletions
This file was deleted.

docs/user-manual/modules/faq/pages/exception-orgxmlsaxsaxparseexception.adoc

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)