Webulizor

Webapp micro-framework.

License

License

GroupId

GroupId

com.github.davidcarboni
ArtifactId

ArtifactId

webulizor
Last Version

Last Version

0.7.5
Release Date

Release Date

Type

Type

war
Description

Description

Webulizor
Webapp micro-framework.
Project URL

Project URL

https://github.com/davidcarboni/Webulizor
Source Code Management

Source Code Management

https://github.com/davidcarboni/Webulizor

Download webulizor

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.davidcarboni/webulizor/ -->
<dependency>
    <groupId>com.github.davidcarboni</groupId>
    <artifactId>webulizor</artifactId>
    <version>0.7.5</version>
    <type>war</type>
</dependency>
// https://jarcasting.com/artifacts/com.github.davidcarboni/webulizor/
implementation 'com.github.davidcarboni:webulizor:0.7.5'
// https://jarcasting.com/artifacts/com.github.davidcarboni/webulizor/
implementation ("com.github.davidcarboni:webulizor:0.7.5")
'com.github.davidcarboni:webulizor:war:0.7.5'
<dependency org="com.github.davidcarboni" name="webulizor" rev="0.7.5">
  <artifact name="webulizor" type="war" />
</dependency>
@Grapes(
@Grab(group='com.github.davidcarboni', module='webulizor', version='0.7.5')
)
libraryDependencies += "com.github.davidcarboni" % "webulizor" % "0.7.5"
[com.github.davidcarboni/webulizor "0.7.5"]

Dependencies

compile (10)

Group / Artifact Type Version
org.hsqldb : hsqldb jar 2.2.9
org.apache.velocity : velocity jar 1.7
commons-lang : commons-lang jar 2.6
javax.mail : mail jar 1.4.5
com.github.davidcarboni : resource-utils jar 1.0.7
commons-io : commons-io jar 2.4
org.reflections : reflections jar 0.9.8
org.apache.httpcomponents : httpclient jar 4.3.1
ch.qos.logback : logback-classic jar 1.0.9
oro : oro jar 2.0.8

provided (1)

Group / Artifact Type Version
javax.servlet : servlet-api jar 2.5

test (2)

Group / Artifact Type Version
junit : junit jar 4.10
org.mockito : mockito-all jar 1.9.0

Project Modules

There are no modules declared in this project.

Build Status Webulizor

I am no longer maintaining Webulizor. If you've arrived here looking for an efficient Java webapp framework, take a look at Restolino

What is it?

Webulizor is a Java webapp micro-framework. It's built on a couple of ideas:

  • in a world of continuous delivery the best place to put most configuration is directly in the code. If you need to change configuration it's safer to push a release than edit files on a live system.
  • refactoring code shouldn't break links. Why should you have to manually keep things in synch across code, configuration and HTML?
  • finally, /servlet/ in your URLs is visual noise and just plain ugly. Webulizor lets you put your controllers at the top level whilst forwarding anything that has a file extension to the default servlet (.css, .js, .png, etc.)

Webulizor provides you with a couple of helpful bootstrap defaults:

  • HSQLDB so you can get on with prototyping instead of installing a database
  • Apache Velocity for response rendering

Defaults can be overridden or ignored and you're free to configure your own front-controller servlet receive requests dispatched by the Webulizor filter, just copy and tweak the web.xml included with Webulizor.

The basics

Webulizor assumes that URLs with a file extension are static content and URLs without a file extension are controllers. It uses a servlet filter to dispatch requests to either the default servlet or the application servlet. Using a filter means there's no /servlet/ in your URLs, so everything can be top-level.

Controllers are defined using annotations such as @Route and @HomeAction. @Route allows you to specify the URI for a controller and @HomeAction indicates the default controller. A few base classes are provided to get you started: AbstractAction, RedirectAction and ViewAction. By default you get Apache Velocity for templating. ViewAction defaults to looking for a .html resource in the same package structure as your controller, or you're free to define a different resource path. The default database is HSQLDB, which can be changed. Controllers that use a database connection are transactional by default but can be marked as non-transactional where necessary.

Getting started

The quickest way to get started is:

  • add Webulizor to your project as a WAR overlay (<type>war</type>)
  • reference the -classes JAR in your dependencies (<classifier>classes</classifier>)
  • create a class that extends ViewAction and annotate it with @Route and @HomeAction
  • create a Velocity template to match your package structure and the name of your class with a .html extension.

Example pom configuration

Here are some pom.xml snippets to get you started:

  • Webulizor artifact details:
    <properties>
        <webulizor.groupid>com.github.davidcarboni</webulizor.groupid>
        <webulizor.artifactid>webulizor</webulizor.artifactid>
        <webulizor.version>0.7.4</webulizor.version>
    </properties>
  • Webulizor dependencies:
    <dependencies>
    
        <!-- Webulizor: -->
        <dependency>
            <groupId>${webulizor.groupid}</groupId>
            <artifactId>${webulizor.artifactid}</artifactId>
            <type>war</type>
            <version>${webulizor.version}</version>
        </dependency>
        <dependency>
            <groupId>${webulizor.groupid}</groupId>
            <artifactId>${webulizor.artifactid}</artifactId>
            <version>${webulizor.version}</version>
            <classifier>classes</classifier>
        </dependency>
    
        <!-- You'll probably want the Servlet API: -->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.5</version>
            <scope>provided</scope>
        </dependency>
        <!-- or -->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>3.1.0</version>
        </dependency>
            
    </dependencies>
  • WAR overlay configuration:
     <build>
        <finalName>mywebapp</finalName>
        
        <plugins>
            
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.3</version>
                <configuration>
                    
                    <!-- If you inherit the webulizor web.xml you won't one: -->
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                    
                    <overlays>
                        <overlay>
                            <groupId>${webulizor.groupid}</groupId>
                            <artifactId>${webulizor.artifactid}</artifactId>
                        </overlay>
                    </overlays>
                    
                </configuration>
            </plugin>
                
        </plugins>
        
    </build>

Versions

Version
0.7.5
0.7.4
0.7.3
0.7.2
0.7.1
0.6.6
0.6.4
0.6.3