Git Product home page Git Product logo

ceylon-jboss-swarm's Introduction

WildFly Swarm and Ceylon

An example WildFly Swarm service written in Ceylon, demonstrating the use of JPA, CDI, and JAX-RS. You can also run the example on the WildFly application server, and probably on any other Java EE application server.

The project is based these WildFly Swarm examples.

Setup

Prerequisites

You'll need the following prerequisites to get started:

Now, go to the directory ceylon-wildfly-swarm-jaxrs, which contains the example project.

For the impatient

You can compile and run it using:

ceylon plugin install ceylon.swarm
ceylon compile && ceylon swarm --provided-module=javax.javaeeapi jaxrs.example && java -jar jaxrs.example-1.0.0-swarm.jar

And hit: http://localhost:8080/rest/employee

Now let's understand the individual steps...

Compiling

To compile the example, type:

ceylon compile

This will compile the module jaxrs.example into the modules subdirectory.

Assembling the executable jar

Make sure sure that the ceylon swarm plugin is installed:

ceylon plugin install ceylon.swarm

Next, assemble the module jaxrs.example as an executable jar by running:

ceylon swarm --provided-module=javax.javaeeapi jaxrs.example

This will create the file jaxrs.example-1.0.0-swarm.jar, which is an executable "fat" jar containing your service and all its dependencies.

Starting the service

Run the executable jar using java:

java -jar jaxrs.example-1.0.0-swarm.jar

You'll see lots of output from WildFly. The deployment is ready when you see this message:

INFO [org.jboss.as.server] (main) WFLYSRV0010: Deployed "jaxrs.example-1.0.0.war" (runtime-name : "jaxrs.example-1.0.0.war")

To check that it's working, go straight to:

http://localhost:8080/rest/employee

Testing the service

The service has the following endpoints:

You can use the Insomnia REST client to test it.

Hacking the example

Project metadata for both Eclipse and IntelliJ is included. Make sure you have Ceylon IDE for Eclipse or IntelliJ installed in your preferred IDE, and import the project from the folder ceylon-wildfly-swarm/ceylon-wildfly-swarm-jaxrs.

To run the project in IntelliJ, open the file

source/jaxrs/example/module.ceylon

and click the green triangle in the gutter.

To run the project in Eclipse, select the project or module in the Explorer, and select 'Run > Run As > Ceylon Java Application Packaged by WildFly Swarm'.

Running on WildFly application server

To run the example on the full WildFly application server, compile the module, and then assemble a Java web archive by typing:

ceylon war --static-metamodel --provided-module=javax.javaeeapi jaxrs.example

This creates the file jaxrs.example-1.0.0.war. Copy this file to your WildFly deployments directory:

copy jaxrs.example-1.0.0.war $JBOSS_HOME/standalone/deployments/

Start WildFly, if it's not already running:

standalone.sh --server-config=standalone.xml

And, finally, go to:

http://localhost:8080/jaxrs.example-1.0.0/rest/employee

ceylon-jboss-swarm's People

Contributors

diegocoronel avatar gavinking avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.