Category: Java

XPath fetch dynamic http header values

Following is an XPath that can come in handy to read name value pair elements. Basically this is done for reading tibco dynamic headers which comes as a repeated header containing name and value elements but the below xpath can be used for any XML document processing. Below is the XML and XPath example The
Read More »

AES encryption helper

Recently I used AES encryption using Java. AES is an efficient algorithm for encryption. You can benefit from the helper class I wrote to perform the encryption and decryption using AES. To read mode about the AES encryption please follow this link AES Encryption Wiki Following is link to AES Helper source code AES Helper
Read More »

Apache tomcat easy deployment script

Following is the script that can be used to deploy application to Apache tomcat running on a Linux machine. Also this script can be called from a Jenkins to automate the deployment process. The script file can be downloaded from HotDeployScript #/bin/bash#/bin/bash # . ~/.profile export APP_ID=$1export URL1="http://localhost:8257/myWebApp/mvc/" export CHECK_URLS="$URL1" export CATALINA_HOME=/opt/myWebApp/tomcat7/ export CATALINA_BASE=$CATALINA_HOME echo CATALINA_HOME:
Read More »

Hotswap for Java using DCEVM+Hotswap Agent

Here is an opensource setup that does the job as JRebel which offcourse is not free. Download HotswapAgent latest release from this url https://github.com/HotswapProjects/HotswapAgent/releases Download DCEVM jar from the following url https://github.com/dcevm/dcevm/releases Install DCEVM as an administrator java -jar DCEVM-light-8u112-installer.jar Create a new run configuration in intelliJ with following VM option -XXaltjvm=dcevm -javaagent:C:\Dev\sw\HotswapAgent-0.3\hotswap-agent.jar -Xms1G -Xmx5G
Read More »

TDD with java a good overview book

Was contacted recently by PACKT publishing to act as technical reviewer for Test driven java development book by Viktor Farcic and Alex Garcia. I accepted the challenge and reviewed around 10 chapters. It a nice overview book which touch almost all the concerns in test driven application development without diving deep into details and you
Read More »

XML Schema generation from Java 8 code and Gradle integration

Using Java 8 and Gradle I had to generate XSD schema. Most of the Gradle plugins out there are not compatible with Java 8 yet. So I tweaked my way and following is how I did it. I had following model class supporting both JAXB and JSON. @XmlType(namespace = "http://com.invalid/1.0/request/schema") @XmlAccessorType(XmlAccessType.FIELD) @XmlRootElement(name = "Person") @JsonRootName(value
Read More »