Get Started...

Book Index... (/book)

Commentary

This webapp demonstrates a technique to access resources with hierarchical relationships in Struts 2.

The model is a Book with a list of Chapters. Each Book has a unique URI:
eg. /book/1 (book #1)

Each chapter also has a unique URI:
eg. /book/1/chapter/2 (chapter #2 in book #1)

Following Struts2 conventions, the list of books and list of chapters in a book are also available:
eg. /book (list of books)
eg. /book/1/chapter (list of chapters in book #1)

View the source

Controllers

BookController.java
ChapterController.java

Models

Book.java
Chapter.java

Services

BookRepository.java

Configuration

struts.xml

Custom ActionMapper

HierarchicalRestActionMapper.java
URIActionMethodParser.java

Unit Tests

URIActionMethodParserTest.java

Related Resources

Blue Sky Minds
Struts 2.1.6-SNAPSHOT's
Struts 2 Rest Plugin
Struts 2 Convention Plugin