Category: Java

  • Java: Concatenate a string before the last occurrence of any character

    by

    in

    private String addToString(String source, char separator, String toBeInserted) { int index = source.lastIndexOf(separator); if(index >= 0 && index < source.length()) return source.substring(0, index) + toBeInserted + source.substring(index); else return null; }

  • CXF logging via interceptors

    by

    in

    In case you need to see what you’re passing to a web service via CXF, add the following in you web client XML (i.e. cucumber.xml): <property name=”inInterceptors”> <util:list> <bean class=”org.apache.cxf.interceptor.LoggingInInterceptor”/> </util:list> </property> <property name=”outInterceptors”> <util:list> <bean class=”org.apache.cxf.interceptor.LoggingOutInterceptor”/> </util:list> </property>

  • Accepted boolean XML inputs

    Adding for archival purposes: http://xformsinstitute.com/essentials/browse/re45.php true, 1, false, 0 are valid.

  • Playing with .jar files

    For archival purposes. Operation Command To create a JAR file jar cf jar-file input-file(s) To view the contents of a JAR file jar tf jar-file To extract the contents of a JAR file jar xf jar-file To extract specific files from a JAR file jar xf jar-file archived-file(s) To run an application packaged as a JAR file  (version 1.1)…