While dealing with Apache Camel, we normally comes with scenarios where we have to send only message body, but exchange header have lots of unwanted data. In this case we can remove all headers in one single method call. In some other scenarios, we have to remove all headers except…
Simple “Hello World” application using Apache Camel
I’ve learned this API few months back, and the initial days with this API was a real struggle. Now I’ve better grip on this API, and thought of sharing my experience here so that anyone comes across same situations as mine can make use of this. This article will cover preparing…
Null check in camel routes
In camel routes, null check of body content can be done as given below: If you are doing null check on a exchange header, this can be done using: Similarly you can do null check on exchange property using: We can use .isNotNull() to negate the above .isNull() check.
Apache Camel – Message History
Message history in Apache Camel is available since camel 2.12. Message history of a message will help to trace out the list of all applications that the message passed through since its origination. When a message is sent to an endpoint, that endpoint information is stored in message history.Message history…
List of JavaDoc tags
Java support different JavaDoc tags for documentation. Refer below table for details. Tag Available from Use @author 1.0 To mention author name of the class @deprecated 1.0 To notify that a given API is no longer supported and shouldn’t be used anymore @exception 1.0 To add Throws subheading to the…
JAXBContext and Thread safety
JAXBContext objects are thread safe, but initializing aΒ JAXBContext object is time consuming. This can affect the performance of applications. So we should avoid creating same JAXBContext object multiple times. Solution to address this issue is to use singleton pattern to initialize the JAXBContext object and reuse it. Now we can…
How to resolve maven dependency conflicts
When dealing with lots of maven dependencies we normally ends up with conflicts. This can be due to different versions of same library in classpath. In this case we have to manually identify the exact maven dependencies with which this library is added. Maven provides an option to list all the…
iframes in iPad
iframe is behaved differently in iPad compared to other web browsers in different platforms. iframe issue in iPad can be resolved by adding a wrapper and CSS styling. A demo of this solution can be viewed from the following link: http://demo.sastrija.com/iframe/
HTML form tag and new line
Sometimes the browser will display a new line character near a form tag in HTML. This can be fixed using below CSS.
Setting HTTPS certificate trusted in Java
After digging a lot in web, I found the following snippet is useful in some scenarios, where we tries to connect to a HTTPS URL from our java code. Warning! This solution will void the real purpose of HTTPS by disabling securities. So use it cautiously