The 55 Minutes Wicket project is a set of tools and libraries we use for enhancing our productivity with the Apache Wicket Java web framework. We've made our code available as open source to share with the Wicket community.
This project requires JDK 6 and Wicket 1.5. Refer to the fiftyfive-wicket-2.x project if you need an older release that can be used with Wicket 1.4.
Please note that this project is not compatible with Wicket 6. Currently there is no ETA for Wicket 6 compatibility.
The quickest way to get started with the 55 Minutes Wicket library is use our Maven archetype. This assumes that you have maven installed, preferably version 3.0.
First, make sure you have compass
and its related ruby gems installed.
gem install compass compass-colors sassy-buttons
Then run the following command:
mvn archetype:generate -U \
-DarchetypeGroupId=com.55minutes \
-DarchetypeArtifactId=fiftyfive-wicket-archetype \
-DarchetypeRepository=http://opensource.55minutes.com/maven-snapshots \
-DarchetypeVersion=4.0-SNAPSHOT
This creates a project directory with all the Java, Maven POM and web.xml scaffolding you need for a Wicket application with Compass, Shiro and Spring integration, plus high-quality starters for your HTML5, CSS and JavaScript. As with most maven archetypes, you'll be prompted for the project name, group ID, artifact ID, version and package.
Next, to run the resulting project, simply change into the project directory and run:
mvn jetty:run
That's it! Your project is up and running at http://localhost:8080/. Explore the code included with the archetype and then continue reading this page to learn about what is included in fiftyfive-wicket.
The fiftyfive-wicket archetype includes stylesheets that are written in Sass using the SCSS syntax, which are then compiled down to standard CSS using Compass. This gives you powerful tools like variables and mixins, and improves browser performance by merging separate CSS files into a single response.
We've integrated Compass with the Maven build process, meaning mvn compile
also compiles SCSS
to CSS, and mvn clean
also deletes the compiled CSS. We recommend stylesheet authors run
compass watch
as part of their workflow so that CSS files are automatically regenerated the instant you save an SCSS file.
Read more about how we use Compass by visiting our css3-foundation project.
We've identified the most commonly reused patterns when authoring Wicket pages and created static helper methods for making this code much more concise. We call these Shortcuts.
For example, often you will want to specify a CSS class for a Wicket component in Java. Here's how you normally would do this in Wicket:
add(new AttributeAppender("class", foo).setSeparator(" "));
With Shortcuts:
add(cssClass(foo));
Or maybe you want your component to include a CSS file? Typical Wicket:
@Override
public void renderHead(IHeaderResponse response)
{
response.renderCSSReference(
new PackageResourceReference(Application.get().getClass(), "screen.css"));
}
With Shortcuts:
add(cssReference("screen.css"));
Or creating a LoadableDetachableModel? Normally in Wicket:
new LoadableDetachableModel<User>() {
@Override
protected User load()
{
return userService.currentUser();
}
};
With Shortcuts:
loadedModel(userService, "currentUser");
The fiftyfive-wicket-core library includes a bunch of small but useful components for making Wicket development much easier. Here are some examples:
The fiftyfive-wicket-test library contains extra tools for writing good unit tests for Wicket pages and components. Here are some highlights:
The fiftyfive-wicket-shiro library provides simple and powerful login, logout and authorization features by integrating Wicket with the Apache Shiro security framework. The fiftyfive-wicket archetype generates a project with two hard-coded user accounts, one of which has the "admin" role. See the security system in action by trying to visit the administration page in the sample project.
Projects generated by the fiftyfive-wicket archetype include:
web.xml
and WicketApplication.java
src/main/resources/shiro.ini
BasePage.java
AdminstrationPage.java
BaseWicketUnitTest.java
, which extends AbstractShiroJUnit4Tests to allow Shiro
security state (logged in, logged out, current roles, permissions) to be mocked during testing of
your secured Wicket pages and componentsRefer to the fiftyfive-wicket-shiro documentation for more information.
We've streamlined how JavaScript works with Wicket by building the fiftyfive-wicket-js library. This library focuses on solving three big problems that Wicket developers encounter:
Here are the solutions we offer:
Our archetype includes the necessary Jetty magic in the pom.xml
file, enabling you to run
the project with a simple mvn jetty:run
. Plus:
mvn jetty:run
, Wicket will be placed into development mode by default. However,
when you package the project as a WAR, it will run in deployment mode. If for some reason you wish
to run locally in deployment mode, use mvn jetty:run -Dwicket.configuration=deployment
.Start.java
. If you are using an IDE like Eclipse, you can
right-click this class and choose Debug…
to run the project in your IDE debugger via Jetty. Not
only do you get debugging tools, but in many cases changes to Java files will be picked up on the
fly without requiring a server restart.The dependency injection pattern is a key part of making Wicket applications easy to test and maintain. Spring is well supported by Wicket and is our framework of choice for this purpose. You'll find the following Spring integration in the fiftyfive-wicket archetype:
WicketApplication.java
initializes
@SpringBean
support, thereby allowing Spring-managed beans to be injected into your Wicket pages
and components at runtime.BaseWicketUnitTest.java
establishes a pattern for testing these Wicket pages and components in
isolation by making it easy to provide Mockito mocks of @SpringBean
injected objects.web.xml
.src/main/resources/<project-name>-context.xml
.
Your bean definitions go here.<project-name>.properties
in the project root.
During deployment, place appropriate deployment configuration in a <project-name>.properties
file and instruct the servlet container to include this in the classpath.See the official Wicket wiki for a good explanation of how Spring and Wicket work together.
The latest, bleeding-edge source code for fiftyfive-wicket is developed in the master
branch at GitHub. The version number of code in the master branch will always end with -SNAPSHOT
.
Stable releases follow the semantic versioning pattern and are made available as tags at GitHub. Unstable -SNAPSHOT
code contains the latest ongoing patches to each X.Y
version, following the conventions of the Apache Wicket project. Here are some examples:
3.0
: the first release of the 3.x series3.0.1
: a minor bug fix to 3.03.0.2
: a minor bug fix to 3.0.13.0-SNAPSHOT
: the latest code in 3.0.x series (i.e. what will become 3.0.3)3.1
: new feature(s) added; backwards-compatible with 3.0.x3.1-SNAPSHOT
: the latest code in 3.1.x series (i.e. what will become 3.1.1)4.0
: major changes; incompatible with 3.x4.0-SNAPSHOT
: the latest code in 4.0.x series (i.e. what will become 4.0.1)If you aren't using the fiftyfive-wicket archetype (as described in the quick start section above), you can add the core 55 Minutes Wicket library to an existing project using the following maven dependency:
<dependency>
<groupId>com.55minutes</groupId>
<artifactId>fiftyfive-wicket-core</artifactId>
<version>4.0-SNAPSHOT</version>
</dependency>
Repeat for the other artifacts of fiftyfive-wicket you wish to use:
Note that since our artifacts aren't in the central maven repository, you'll need to include the following snippet:
<repository>
<id>fiftyfive-opensource-snapshots</id>
<name>55 Minutes Open Source Maven Snapshots Repository</name>
<url>http://opensource.55minutes.com/maven-snapshots</url>
<releases><enabled>false</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
<repository>
<id>fiftyfive-opensource-releases</id>
<name>55 Minutes Open Source Maven Releases Repository</name>
<url>http://opensource.55minutes.com/maven-releases</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>false</enabled></snapshots>
</repository>