Book Image

Spring Web Flow 2 Web Development

By : Markus Stäuble, Sven Lüppken
Book Image

Spring Web Flow 2 Web Development

By: Markus Stäuble, Sven Lüppken

Overview of this book

<p>Many web applications need to take the user through a defined series of steps such as e-commerce checkouts or user registrations. Spring Web Flow works well for rich and flexible user interaction, additionally it helps you to describe the flow of websites in complex processes. Spring Web Flow 2 provides the perfect way to build these kinds of features, keeping them secure, reliable, and easy to maintain.<br /><br />This book provides a platform on which you can build your own applications and services. It gives detailed information on Spring basics and covers core topics involving testing, security, and so on. We develop a complete, robust web application using the latest version of Spring, where page navigation is done on-the-fly.<br /><br />This book teaches you how to work with Spring Web Flow. It covers both basic and advanced aspects and provides a detailed reference of the features Spring Web Flow. The book helps readers to extend the framework. <br /><br />The integration of Spring and Java Server Pages is clearly explained in the book. The book also explains the essential modules of the complete Spring framework stack and teaches how to manage the control flow of a Spring web application.<br /><br />The Spring Faces module will provide integration between Spring Web Flow and Java Server Faces (JSF). Testing, an important aspect of the software development process is covered towards the end; the question of how to test a Spring Web Flow application is answered.</p>
Table of Contents (14 chapters)
Spring Web Flow 2 Web Development
Credits
About the Authors
About the Reviewers
Preface
flow.trac:The Model for the Examples

Installation of the SpringSource dm Server


In this appendix, we want to describe the prerequisites, which are essential to install the SpringSource dm Server. These prerequisites for installation may change for future versions. This guide is for the release Version 1.0.0. The first step is to download the latest release of the SpringSource dm Server. You can download the latest version directly from the SpringSource at: http://www.springsource.com/download/dmserver. The first page on the download web site only offers the zip-archive (the name of the archive is springsource-dm-server-sources-1.0.0.RELEASE.zip) which contains the sources; the archive has a size of about 3.4 MB. The sources are available under the GNU General Public License Version 3. The license is available online at http://www.gnu.org/licenses/gpl-3.0.html. For the build of the archive, you need an installed JDK of the Version 1.5 or higher.

Note

Until the process of the SpringSource dm Server is built, the essential libraries for that build are downloaded with the help of Apache Ivy (http://ant.apache.org/ivy). The libraries are stored inside an S3 storage.

Additionally, you need an installed version of the build system Apache ANT (http://ant.apache.org) of the Version 1.7, or higher. It is recommended that you read the provided file, readme.txt, which contains a step-by-step instruction for the build of the SpringSource dm Server.

If you want to download a binary release, press on the Download Now! link.

Before you can finally download the binary release, you have to accept the SpringSource dm Server 1.0 LICENSE AGREEMENT. After you have accepted the mentioned license, you can download the binary ZIP archive. The name of the archive is springsource-dm-server-1.0.0.RELEASE.zip. For the installation of the SpringSource dm Server, just extract the archive inside an arbitrary folder. After the extraction, the folder looks like this:

To start the server, there is a script with the name startup.sh inside the bin folder of the SpringSource dm Server. To stop the server, you can use the script shutdown.sh inside the bin folder. After the start on the console, the script prints some messages. If there is an error on the startup, ensure that you have set the environment variable SERVER_HOME. The standard configuration needs four ports to run. The ports are used for the services which are listed in the following table:

Port

Name of the service

2401

The OSGi telnet console

For the first steps, you can use the help command inside the console; that command displays the available commands with their description; the command to close the console is exit

8009

The AJP/1.3 connector; that connector is for integration of the tomcat webcontainer inside the Apache HTTP server

8443

The connector which is used for HTTPS

8080

The connector which is used for HTTP

After the SpringSource dm Server is started, you can visit the start page with your favorite web browser. For that, just type http://localhost:8080 into the address line of the browser. The following screenshot shows the start page:

The distribution of the SpringSource dm Server comes with a link list to the following four documentation sets:

Note

The distribution of the SpringSource dm Server contains the User Guide (in the user-guide folder) and the Programmer Guide (in the programmer-guide folder) inside the docs folder of the distribution.

The folder layout of the docs folder is as shown in the following screenshot:

Beside the mentioned set of links on the start page, it contains a link to the admin console. If you want to directly start the admin console, just type the URL http://localhost:8080/admin in the address line of your browser. The username for the console is admin, and the password is springsource. After a successful login, the console will be shown. The screenshot of the admin console is shown here:

You can use the console to deploy new applications or to see the state of your existing applications. For each application, the URL of the application is shown as a link. Therefore, you can directly go to the specific application.

Beside the admin console, which is a very important feature, there is also the information part. This part contains the following two information blocks:

  • Server Properties

  • Serviceability Destinations (The serviceability summarizes the information as to where to find the log files for the specific applications.)

The following screenshot shows you the information part of the admin console. Both the screenshots shown here are in the same HTML page.

If you want to use the SpringSource dm Server, there are three examples provided for a testdrive of the server. These examples can be downloaded from the same page as the binary distribution of the SpringSource dm Server. The examples are:

  • Spring Travel Sample Application 1.1.0

  • Petclinic Sample Application 1.5.0

  • Formtags Sample Application 1.4.0

The examples are provided as a ZIP archive. Before we go further with the migration of an exisiting application, we want to show how to install one of the samples. We choose the Spring Travel Sample Application 1.1.0.

  1. 1. Download the 11.3 MB archive with the name, spring-travel-1.1.0.RELEASE.zip. Now, you can extract the archive into a temporary (it is not advisable to extract the archive directly inside the folder of the installed SpringSource dm Server) folder. The following screenshot shows the folder layout of the extracted archive of the sample application.

    As you can see, the folder contains a file, readme.txt, which contains valuable information about the installation process of the Spring Travel Application inside the SpringSource dm Server.

  2. 2. Copy all the files (the Version 1.1.0 contains 31 files) from the par-provided/bundles folder (bundles from a specific par archive) of the sample application into the repository/bundles/usr folder (folder for bundles which are provided from the user) of the SpringSource dm Server. It is wise to stop the SpringSource dm Server before you start with the second step of the installation process of the Spring Travel Application.

  3. 3. Copy all the files (the Version 1.1.0 contains 2 files) from the par-provided/libraries folder into the repository/libraries/usr folder of the SpringSource dm Server.

  4. 4. Copy the Platform Archive (PAR) from the dist folder into the pickup folder of the SpringSource dm Server. A platform archive is a standard JAR, which contains all the modules of your application.

  5. 5. Now, start your SpringSource dm Server with the script startup.sh and visit the admin console on your local machine with the URL http://localhost:8080/admin. The console should now have an entry for the installed Spring Travel Application. The following screenshot shows this entry. A hot deployment of the application is also possible.

As you can see, the entry contains a link to the installed application. You can directly click on that link. Alternatively, you can call the application by typing the URL http://localhost:8080/springtravel-faces in the address line of your browser. After that, the application is presented as illustrated in the following screenshot.

The application, which we have installed, is the reference application of Spring Web Flow 2. Therefore, now you have a running Spring Web Flow 2 application inside the Spring Source dm Server. The reference application can be tested online at http://richweb.springframework.org/swf-booking-faces/spring/intro.