Setting the SameSite Attribute on the JSESSIONID cookie for Java based deployments

SameSite is a requirement in latest Chrome starting Feb 2020 Read a very good and easy-to-understand explainer on SameSite Turns out none of  Java-based ecosystem : Servlet/Grails/Spring/Wicket/JBoss/Tomcat/WildFly etc are up to this simple and basic task that is easily handled by all other non-java frameworks like rails, django etc.  Bottomline is Servlet API has not … Continue reading Setting the SameSite Attribute on the JSESSIONID cookie for Java based deployments

How to serialize a POJO (java/groovy class) into JSON string using Grails

Usually grails is easy to work with but I found this simple task to be a frustratingly hair-pulling java-like experience. Steps: 1.You have a Person object that you want to serialize into a json string.  reference. Person personPojo = Person.find(1) grails.converters.JSON jsonConverter = personPojo as JSON String jsonString = jsonConverter.toString() 2. Problem is JSON converter will … Continue reading How to serialize a POJO (java/groovy class) into JSON string using Grails

How to add an external library or JAR file that is not a grails plugin to your Grails project

There are two options to add an external library or JAR file that is not a grails plugin to your Grails project: 1.You can download and drop the jar file into the grails-app/lib directory. [NOT RECOMMENDED] This should be your last option because the library has to be carefully maintained by you. Other developers working … Continue reading How to add an external library or JAR file that is not a grails plugin to your Grails project

How to enable TLSv1.2 on JBoss

Simple! If you are using Java8 the default is TLSv1.2 If using Java7 you need to change the default as follows by editing JBoss run.conf and adding JVM params: JAVA_OPTS="$JAVA_OPTS -Dhttps.protocols=TLSv1.2 -Djdk.tls.client.protocols=TLSv1.2" JAVA_OPTS="$JAVA_OPTS -Djavax.net.debug=ssl:handshake:verbose" the second JVM param logs all SSL handshake details including the protocol used for each call to STDOUT so you can … Continue reading How to enable TLSv1.2 on JBoss

How to write STDOUT console output to log file in JBoss

If you are using JBoss you can configure jboss-log4j.xml to print all STDOUT messages to stdout.log. Excerpt of solution from : https://access.redhat.com/solutions/68949 Add the following to $JBOSS_HOME/server/$PROFILE/conf/jboss-log4j.xml <appender name="STDOUTLOG" class="org.jboss.logging.appender.DailyRollingFileAppender"> <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/> <param name="File" value="${jboss.server.log.dir}/stdout.log"/> <param name="Append" value="false"/> <param name="DatePattern" value="'.'yyyy-MM-dd"/> <layout class="org.apache.log4j.PatternLayout"> <!-- The default pattern: Date Priority [Category] (Thread) Message\n --> <param name="ConversionPattern" value="%d … Continue reading How to write STDOUT console output to log file in JBoss

Chinese characters garbled on Jboss web application

On my personal Mac I could see Chinese characters rendered correctly on Web Page But when the application is deployed on a server it was showing garbled chars like below In my case.. my server provider had done some recent security upgrade. So my production web app was displaying chinese characters before the upgrade. In … Continue reading Chinese characters garbled on Jboss web application

How to write console output to a log file in development

Thanks to http://simonpalmer.com/grails-logging/ grails-app/conf/Config.groovy // log4j configuration log4j = { // Example of changing the log pattern for the default console // appender: // //appenders { // console name:'stdout', layout:pattern(conversionPattern: '%c{2} %m%n') //} appenders { file name:'file', file:'/Users/naren/Downloads/logfile.log', append: false console name:'stdout' } debug 'grails.app', 'alerts', 'grails.app.jobs' //for quartz jobs error 'org.codehaus.groovy.grails.web.servlet', // controllers 'org.codehaus.groovy.grails.web.pages', // … Continue reading How to write console output to a log file in development

Step by Step instructions to integrate Shopify Embedded SDK

We are Storebuilder and we make Inventory Management apps on Shopify. This is our experience converting our Wipeout app to Embedded SDK Thankfully the Shopify App DEveloper community has gone over & beyond to create useful frameworks and instructions. See "Helpful Resources" at the end of this post. Special Thanks to Rafael Xavier of microapps for creating … Continue reading Step by Step instructions to integrate Shopify Embedded SDK