8.4.2. Initial Setup of RESTful Web Service Project for Container

The following is procedures of initial setup of the RESTful web service project for container:

  • Generating RESTful web service project for container
  • Confirm communications of RESTful web service project
  • Create a container image
  • Run Container Image

8.4.2.1. Preliminary preparations

Install one of the following for use with Communication confirmation.

  • Firefox
  • Chrome

8.4.2.2. Overview of the generated project

The overview of the project generated by this procedure is as follows.

Item Description
Project Type Maven project
Project composition Single project composition
DB used H2 Database Engine (embedded in the application)
Built-in adapter
What is included in the generated project?

The following is included in the generated project:

  • Basic configuration for the Nablarch RESTful web service application
  • RESTful web service for communication confirmation
  • Initial configuration of the tool that operates in conjunction with Maven (is imported by referring to nablarch-archetype-parent (parent project)).

For relationship with other projects and directories, see Maven Archetype Configuration.

8.4.2.3. Create blank project

Generate a blank project using the archetypes provided by Nablarch.

8.4.2.3.1. Execute the mvn command

Use Maven Archetype Plugin(external site) to generate a blank project.

Change the current directory to the directory where the blank project (can be any directory) is to be created, and place the following file.

Batch file

After placing the file, specify the necessary parameters in the arguments and execute the bat file.

generateContainerWebServiceProject.bat 5u24 <<groupId>> <<artifactId>> <<version>> <<package(optional)>>

The parameters configured in the above command are as follows. If you want to change the version of Nablarch, change 5u24.

Input item Description Configuration example
groupId Group ID (normally, enter the package name) com.example
artifactId Artifact ID myapp-container-jaxrs
version Version number 0.1.0
package Package (normally the same as group ID) com.example

Important

Item groupId and package are mapped to the Java package name. Use lowercase letters, numbers, and dots for these input values, and do not use hyphens.

If the command ends normally, a blank project is created under the current directory.

8.4.2.4. Communication confirmation

The communication confirmation mechanism and procedures are the same as for a normal RESTful web service project. Thus, see Initial Setup of RESTful Web Service Project.

Note

Artifact ID should be replace with myapp-container-jaxrs to specify the directory or command.

8.4.2.5. Create a container image

The way to create a container image is the same as in a web project for containers, so see Initial Setup of Web Project for Container.

Note

Artifact ID should be replace with myapp-container-jaxrs to specify the directory or command.

8.4.2.6. Run a container image

The way to run the container image is the same as in a web project for containers, so see Initial Setup of Web Project for Container.

Note

Artifact ID should be replace with myapp-container-jaxrs to specify the directory or command.

Note

The operation can be checked at the following URL.

  • http://localhost:8080/find/json
  • http://localhost:8080/find/xml

8.4.2.7. Supplementary notes

For information on the method of confirming the data of H2 and tools included in the blank project, see Initial Setup Procedure Supplementary Information.