Gracelets
Gracelets Server embeds Tomcat 6.0.12 along with custom servlet and tomcat implementations in order to streamline the development of a gracelets application.

It boots up a simple application with Gracelets, JSF, Facelets and JBoss Seam in six seconds with absolutely no configuration needed. Of course, just about everything inside the server is customizable. But to get up and going is as easy as downloading, unzipping and running.

No web.xml, faces-config.xml or server.xml to maintain. You can configure the server with a groovy script and can configure your web app with one as well.

The Gracelets Server is also a good way to get familiar with Gracelets. It comes with the latest version of Gracelets since release and has some live demo applications showing alot of the features in Gracelets.

The following are some characteristics of Gracelets Server:

Directory Structure

The Gracelets Server has the following basic directory structure:
/
lib
extension
server
support
web_context
server
application
base
config
scl.properties
startup.jar

The lib/server, lib/support and lib/extension directory contains all of the server-level clsses in order for it to boot properly. The lib/web_context is a common web application level class area, in other words, every web application deployed in a Gracelets Server will have the jars in this directory automatically in its web level class loader.

The server directory is kind of a central place for the server, although as will be revealed with time, your gracelet applications can be anywhere in your file system and do not need to be placed here. The server/application directory is where the default application that is deployed is at, and you can code anywhere under it to start learning how to write gracelet pages, controllers and libraries.

The server/config directory contains logging configuration and a special groovy script called server.cfg.groovy.

Server Configuration

The following is what is in your current config script:
1 engine.defaultHost = "localhost" 
2  
3 config.addHttpConnector("127.0.0.1", 8080) 
4 config.addHost("localhost") 
5  
6 config.base = "server/base" 
7 config.home = "server/home" 
8  
9 config.addContext("localhost", "manager", "/", "server/application") 
You can add as many connectors, hosts and contexts right in this script to setup more applications or change your server profile.

Web Applications

Instead of writing a web.xml, faces-config.xml and the like, you have the option to write a config.groovy file in the WEB-INF directory of your web applications.

It is not necesary to write anything or even have the file existing if you are doing a standard gracelet setup (JSF/Facelets/Groovy/Seam). Soon we will have here the configuration options available when using a config.groovy file to configure your application.

Special Features

On the root of your app, it will auto-redirect to index.jsf when someone goes to the root of your app without specifying a file (i.e., /).

Also, if you setup web container security as follows (in your WEB-INF/config.groovy):
1  webXml.addStandardSecurity("SomeRoleName")  
you can then use JSF level authentication. For instance inside of a web app you could do this (with standard security, you must use login.groovy as your login page):

1 server = ns."http://gracelets/server" 
2  
3 g.form { 
4     print "Username: "; h.inputText(value: Value { someBean.username }) 
5     print "Password: "; h.inputSecret(value: Value { someBean.password }) 
6  
7     br() 
8  
9     server.login(label: "Login", authenticate: { someBean.auth() }, 
10         roles: { someBean.roles() }, error: { someBean.error() }) 
11 }  
Basically we are saying above that when the user hits the login button, call the someBean.auth() method to authenticate. It must return a string (or a principal) which will be used as the userPrincipal. Then if that is successful (non-null) it will call the someBean.roles() method to get the roles corresponding the authenticated user. If the authentication fails, it will call the optional error binding, (someBean.error() in this case) and add that to the faces messages. Thats all now for Gracelets Server. This documentation will grow over time, so keep checking back periodically if you are interested in know more about it.