Skip to main content

What's new in version 24.20?

· 4 min read
webforJ Team
webforJ Development Team

cover image

webforJ version 24.20 is live and available for development. Learn more about what main features and fixes are included in this release.

As always, see the GitHub release overview for a more comprehensive list of changes. Highlighted below are some of the most exciting changes:

New features and enhancements 🎉

We’re excited to introduce version 24.20 which brings a game-changing update to webforJ - the shift to WAR deployment.

WAR Deployment in webforJ

In 24.20, webforJ fully embraces the WAR (Web Application Archive) pattern for packaging and deploying apps. WAR files are a tried-and-true standard in Java development, bundling everything your app needs - code, resources, and dependencies - into a single, deployable archive.

Updating your project for WAR deployment

Switching your project to use WAR deployment in webforJ is straightforward. To do so, ensure the following components are in place:

  1. Include the Maven Jetty Plugin:

Add the Maven Jetty plugin to your pom.xml to handle the deployment process. The Jetty plugin allows you to package and deploy your app as a WAR file effortlessly.

<plugin>
<groupId>org.eclipse.jetty.ee8</groupId>
<artifactId>jetty-ee8-maven-plugin</artifactId>
<version>12.0.14</version>
<configuration>
<webApp>
<contextPath>/</contextPath>
</webApp>
</configuration>
</plugin>
Replacing the webforJ install plugin

In projects using the webforJ install plugin, remove this plugin from your POM to ensure that it isn't triggered when running mvn install.

  1. Add the required configuration and resources:

Include the following essential files in your project to ensure it runs as a WAR:

  • webapp/WEB-INF/web.xml: Defines the app's deployment descriptor, specifying how the app should be deployed and managed by the server.

  • resources/webforj.conf: Centralized configuration file for customizing your app's behavior.

  • resources/certificate.bls: A license certificate file required to run your app. You’ll receive this file when registering for a license.

  • resources/blsclient.conf: Configuration file for license properties.

Once added, an example project structure may look like this:

src/main/
java/ # Java source files
resources/
webforj.conf # App configuration
blsclient.conf # License configuration
certificate.bls # License certificate
webapp/
WEB-INF/
web.xml # Deployment descriptor

Configuration with webforj.conf

The webforj.conf file centralizes app configuration in HOCON format. With this file, you can tweak key settings for your app, such as the app's entry point, and whether or not to run in DEBUG mode.

Here are some of the most useful settings you can define in webforj.conf:

PropertyDescriptionDefault
webforj.entryThe fully qualified name of the class that extends App, acting as the entry point for your app.Not Set
webforj.debugEnables debug mode, showing detailed errors in the browser and printing debug logs to the console.false
webforj.reloadOnServerErrorAutomatically reloads the app if the server temporarily becomes unavailable during development.on
webforj.clientHeartbeatRateSets the interval for client pings to the server to query availability. Use shorter intervals in development and longer ones in production.50s

Configuring the web.xml file

The web.xml file is a crucial part of Java web app deployment, serving as the deployment descriptor for your app. In webforJ, it defines key settings like the servlet configuration and URL mappings. This file must be located in the WEB-INF directory of your project’s deployment structure.

SettingExplanationDefault Value
<display-name>Sets the display name for the web app, typically derived from the project name. This name appears in app servers' management consoles.${project.name}
<servlet> and <servlet-mapping>Defines the WebforjServlet, the core servlet for handling webforJ requests. This servlet is mapped to all URLs (/*), making it the main entry point for web requests.WebforjServlet
<load-on-startup>Specifies that WebforjServlet should be loaded when the app starts. Setting this to 1 ensures the servlet loads immediately, improving initial request handling.1

To learn more about the various configuration options available, as well as other options for configuring your webforJ project, browse this article detailing configuration in webforJ.