Deploy to WildFly using curl (Tech Tip #10)

WildFly 8 provide multiple ways to deploy your web applications.

So far we’ve seen:

This tip will show how to use curl to deploy your applications to WildFly.

Deploying applications using curl is a two-step process.

Step 1: Upload your archive to WildFly using the following command:

This command:

  • Makes a POST request using form-encoded (“-F”) data with one field (“file”) defining the location of the WAR file
  • “target/javaee7-1.0-SNAPSHOT.war” is the location of the WAR file
  • “u1” is the administrative user with password “p1”
  • “localhost:9090” is the default management host and port for WildFly instance
  • WildFly management port uses digest authentication and that is defined using “–digest”
  • Prints the output as something like:
    {“outcome” : “success”, “result” : { “BYTES_VALUE” : “+Dg9u1ALXacrndNdLrT3DQSaqjw=” }}

Step 2: Deploy the archive

This command:

  • Sends a POST request (“-d”) with JSON payload
  • The value assigned to “result” name in the JSON response of previous command is used in this command
  • Content type of the payload is explicitly specified to be “application/json”
  • “add” command triggers the deployment of the archive
  • Application archive is enabled as well, as opposed to not by default
  • As earlier, “u1” is the administrative user with password “p1”
  • As earlier, “localhost:9090” is the default management host and port for WildFly instance
  • As earlier, WildFly management port uses digest authentication and that is defined using “–digest”

Now your application is available at http://localhost:8080/javaee7/EmployeeList or whatever the context root is!

That’s it!

Additional ways to deploy your applications will be discussed in subsequent blogs.

Be Sociable, Share!

3 thoughts on “Deploy to WildFly using curl (Tech Tip #10)

Leave a Reply

Your email address will not be published. Required fields are marked *