Kohei Nozaki's blog 

Enabling RequestDumpingHandler of Undertow


Posted on Friday Mar 20, 2015 at 05:01PM in WildFly


Tested with WildFly 8.2.0.Final. Issue following command via jboss-cli and restart the server:

/subsystem=undertow/configuration=filter/custom-filter=request-dumper:add(class-name=io.undertow.server.handlers.RequestDumpingHandler, module=io.undertow.core)
/subsystem=undertow/server=default-server/host=default-host/filter-ref=request-dumper:add

Following log will be dumped to the console:

----------------------------REQUEST---------------------------
               URI=/batcheetest/jbatch/batchee/execution/start/myjob
 characterEncoding=null
     contentLength=95
       contentType=[application/json]
            header=Accept=*/*
            header=Content-Type=application/json
            header=Content-Length=95
            header=User-Agent=curl/7.30.0
            header=Host=localhost:8080
            locale=[]
            method=POST
          protocol=HTTP/1.1
       queryString=
        remoteAddr=/127.0.0.1:57668
        remoteHost=localhost
            scheme=http
              host=localhost:8080
        serverPort=8080
--------------------------RESPONSE--------------------------
     contentLength=-1
       contentType=application/json
            header=Connection=keep-alive
            header=X-Powered-By=Undertow/1
            header=Server=WildFly/8
            header=Transfer-Encoding=chunked
            header=Content-Type=application/json
            header=Date=Fri, 20 Mar 2015 07:58:13 GMT
            status=200
==============================================================

I’m disappointed that there is no dump of request body :(


Disabling color escape sequences in WildFly's console logging for IDE


Posted on Wednesday Mar 18, 2015 at 11:31AM in WildFly


I’m using IntelliJ IDEA for developing Java EE applications on WildFly. its built-in WildFly console appears as follows:

...
[0m11:20:28,608 INFO  [org.jboss.as.server] (Controller Boot Thread) JBAS015888: Creating http management service using socket-binding (management-http)
11:20:28,625 INFO  [org.xnio] (MSC service thread 1-9) XNIO version 3.3.0.Final
11:20:28,631 INFO  [org.xnio.nio] (MSC service thread 1-9) XNIO NIO Implementation Version 3.3.0.Final
...

You can see strange characters in the head of every lines. they are color escape sequences that works fine with terminal emulators but not for IntelliJ IDEA’s console output. to disable color escape sequences, issue following command in jboss-cli:

/subsystem=logging/console-handler=CONSOLE:write-attribute(name=named-formatter, value=PATTERN)

Now strange characters disappeared from IntelliJ IDEA’s console as follows:

...
2015-03-18 11:26:11,800 INFO  [org.jboss.as.server] (Controller Boot Thread) JBAS015888: Creating http management service using socket-binding (management-http)
2015-03-18 11:26:11,812 INFO  [org.xnio] (MSC service thread 1-4) XNIO version 3.3.0.Final
2015-03-18 11:26:11,817 INFO  [org.xnio.nio] (MSC service thread 1-4) XNIO NIO Implementation Version 3.3.0.Final
...


Deploying an application to WildFly with Ant + Cargo


Posted on Wednesday Mar 04, 2015 at 04:49PM in WildFly


I created an Ant script which deploys an application to WildFly through ssh tunnel. it creates ssh tunnel using Ant’s sshtunnel target. the script works well with a Jenkins job.


Setting longer startup / shutdown timeout to wildfly-init-redhat.sh


Posted on Friday Feb 27, 2015 at 03:27PM in WildFly


I’m using bin/init.d/wildfly-init-redhat.sh to operate WildFly instance via service command on CentOS. it has some timeout defaults as follows:

if [ -z "$STARTUP_WAIT" ]; then
        STARTUP_WAIT=30
fi

if [ -z "$SHUTDOWN_WAIT" ]; then
        SHUTDOWN_WAIT=30
fi

If startup or shutdown takes longer than 30 seconds, the service commands will stop waiting and finished. this brings trouble to some automation mechanism such as shell scripts for deployment on cheaper environment. these variables can be set more longer in /etc/default/wildfly.conf as follows.

## The amount of time to wait for startup
STARTUP_WAIT=1800

## The amount of time to wait for shutdown
SHUTDOWN_WAIT=1800

There’s a template for this file at bin/init.d/wildfly.conf in WildFly distribution.


Building latest WildFly against latest Undertow


Posted on Wednesday Feb 25, 2015 at 09:34PM in WildFly


Today I had to make some modification to WildFly and Undertow. I’ve got stucked at build most, and had to make many try and error so I leave about it as note. I’m bad at using Maven so I spent most of time at making WildFly to reference latest Undertow package. I tried something like mvn clean install -Dversion.io.undertow=1.2.0.Beta9-SNAPSHOT in wildfly package but it didn’t work. eventually, I installed following packages into my Maven repository.

wildfly-core

Obtain same version as specified in version.org.wildfly.core property in pom.xml of wildfly package (it can be obtained using git tag).

The pom.xml file in this package keeps version.io.undertow property. wildfly package references this property so you need to modify it to desired version of Undertow. I modified it to 1.2.0.Beta9-SNAPSHOT before install it to local Maven repository. note that -Dmaven.test.skip=true makes build fail but -DskipTests=true might work.

undertow

This package doesn’t have annoying dependencies so you just need to make modification you desired and install to your local repository. keep version element in pom.xml and ensure that it is same to version.io.undertow property in wildfly-core.

wildfly

This package has dependency to wildfly-core. ensure that version.io.undertow in wildfly-core is desired one. the build will be made in wildfly/build/target/wildfly-9.0.0.Alpha2-SNAPSHOT.zip.

My final recipe is following:

  1. Run mvn clean install for undertow (1.2.0.Beta9-SNAPSHOT). changes to java code here but no changes to pom here.

  2. Run mvn clean install for wildfly-core (1.0.0.Alpha19). before install, I updated <version.io.undertow> to 1.2.0.Beta9-SNAPSHOT.

  3. Run mvn clean install for wildfly (9.0.0.Alpha2-SNAPSHOT). changes to java code here but no changes to pom here.