How to write web applications using Ceylon?
I've started looking up the documentation for details how to create a WAR deployable application with Ceylon where i have some REST endpoints serving stuff to the browser side. I was not expecting Spring WebMVC support although this would be my final goal. For my surprise i didn't find anything useful in this topic. Is there any recommendations how to use Ceylon when i try to target a Servlet engine like Jetty or Tomcat the way i've described?
Right now i'm doing the following in a Java application:
- Create a Maven webapp project
- Write some Spring MVC controllers to server JSON resources
A similar thing would be great where the client code is transposed from Ceylon code aswell. As i see Ceylon uses it's very own project layout and build system although i would be more happy to use Maven or Gradle to not steer away too much from existing projects.
Now that the language and its compilers have hit 1.0, we're able to shift some of our attention to development of things like web frameworks. Right now, Ceylon doesn't have a finished web framework.
What it does have is:
- A simple HTTP server based on JBoss Undertow, as part of the module ceylon.net. This makes it really easy to create a little web server, especially in conjunction with ceylon.html for rendering HTML pages.
- Julien Viet's vert.x bridge and promises module, which provide a wrapper for vert.x.
- A cartridge for Red Hat's OpenShift, that lets you deploy a Ceylon web application on Red Hat's cloud.
I understand that this is not a full solution to your question of how can you run Ceylon on a traditional servlet engine. The truth is that you actually can take a compiled Ceylon module archive, embed it in a .war and use it inside Tomcat or Jetty or JBoss or whatever. A .car is, after all, just a .jar with some extra metadata. The problem with that is that you will lose the advantages of Ceylon's module runtime that you usually have when you use ceylon run. You'll need to:
- manually make sure all the dependencies your module uses are are available in the .war, and
- you won't get the classloader isolation.
If you can live with that, then, go for it. It will work. But from my point of view the vision we have is to get away from the legacy servlet engines and run something like Undertow (ceylon.net) or vert.x on top of the module runtime. Remember that this "module runtime" we're talking about is anyway just JBoss Modules, the tiny core of JBoss itself.
There is initial work on Ceylon's own web server:
And some simple example / demo / test:
I realize this is an old question, but as I was just looking for the same, almost 2 years later, it seems that someone is building one (called Cayla):