2.1. Architecture Overview

Nablarch provides functions for building web applications with HTML-based screen UI.

2.1.1. Structuring a web application

The use of the Servlet API is assumed when building a web application with Nablarch. Structure of the web application in Nablarch is shown below.

Nablarch Servlet Context Initialization Listener (NablarchServletContextListener)
Servlet context listener that performs the initialization process of the system repository, logs, etc.
Web Front Controller (WebFrontController)
Servlet filter that delegates the processing of the received request to the handler queue.

2.1.2. Web application process flow

The process flow of web applications, from processing a request to returning a response, is shown below.

  1. Web Front Controller (implementation class of javax.servlet.Filter) receives a request.
  2. Web Front Controller delegates the processing of the request to a handler queue (handler queue).
  3. DispatchHandler configured in the handler queue specifies the action class to be processed based on the URI and adds it to the end of the handler queue.
  4. The action class executes business logic using a form class and an entity class. For more information on each class, see Responsibility Assignment of the Application.
  5. The action class creates and returns a HttpResponse indicating the process result.
  6. The HTTP response handler (HttpResponseHandler) in the handler queue converts the HttpResponse into a response to be returned to the client. For example, JSP Servlet Forward.
  7. Response is returned.

2.1.3. Handler used by the web application

Nablarch provides several handlers required for building web applications. Build the handler queue in accordance with the requirements of the project. (a custom handler will have to be created for the project depending on the requirements)

For details of each handler, refer to the link.

Handlers that convert request and response
Handler for filtering requests
Handlers associated with database
Handlers for request verification
Error handling handler
Others Minimum handler configuration

When building a web application in Nablarch, the minimum required handler queue is as below: With this as the base, add standard handlers of Nablarch or custom handlers created in the project according to the project requirements.

Minimum handler configuration
No. Handler Request process Response process Exception handling
1 HTTP Character Encoding Control Handler Configure the character encoding for the request and response.    
2 Global Error Handler     Outputs the log for a runtime exception or error.
3 HTTP Response Handler   Performs any one of servlet forward, redirect, or response writing. Displays the default error page in the case of a runtime exception or error.
4 Secure Handler   Set the security-related response header in the response object(HttpResponse)  
5 Multipart Request Handler If the request is in multipart format, the request contents are saved to a temporary file. Deletes the temporary file that is saved.  
6 Session Variable Store Handler Read the content from the session store. Write content to the session store.  
7 Normalize Handler Performs normalization process of request parameter    
8 Internal Forward Handler   If the transition destination is an internal forward, the subsequent handlers are re-executed.  
9 HTTP Error Control Handler     Outputs the log output and generates response according to the exception type.
10 Nablarch Custom Tag Control Handler Performs pre-processing required for the Nablarch custom tag behavior.    
11 Database Connection Management Handler Acquires DB connection. Releases the DB connection.  
12 Transaction Control Handler Being a transaction. Commits the transaction. Rolls back a transaction.
13 Routing Adapter Determines the action to call based on the request path.