Important: This news article covers an old version of Javalin (v0.4.1). The current version is v6.1.3.
See the documentation page for up-to-date information.

Added more ctx.formParam-functions

Previously there was only ctx.formParam() to get a single form-param, now form-params have the same functionality as query-params:

formParam("key") // get one form-params
formParamOrDefault("key", "default") // get one form-params (or default if null)
formParams("key") // get multiple form-paramss
formParamMap() // get map of all form-params key/values

Added request-logging

You can enable request-logging by calling ctx.enableStandardRequestLogging(), or by calling requestLogLevel(LogLevel logLevel). The current LogLevels are:


Request-logging is off by default.


INFO - POST -> 200 (0.16 ms)


INFO - POST /endpoint-path -> 200 [text/plain;charset=utf-8] (took 0.15 ms)


The EXTENSIVE level wraps the ServletResponse and uses a custom PrintWriter to copy the content. This operation is somewhat expensive, so you shouldn’t use it if you need performance.

INFO - JAVALIN EXTENSIVE REQUEST LOG (this clones the response, which is an expensive operation):
Request: POST [/some-endpoint]
    Headers: {User-Agent=unirest-java/1.3.11, Connection=keep-alive, Host=localhost:51958, Accept-Encoding=gzip, Content-Length=4, Content-Type=text/plain; charset=UTF-8}
    Cookies: {}
    Body: body=mybody
    QueryString: qp=queryparam
    QueryParams: {qp=[queryparam]}
    FormParams: {body=[mybody]}
Response: [200], execution took 0.27 ms
    Headers: {Server=Javalin, Date=Sat, 19 Aug 2017 09:11:12 GMT, Content-Type=text/plain;charset=utf-8}
    Body: (starts on next line)