# 13.1 Overview

JFinal adopts a microkernel-based, full-range extensible architecture. "Full-range" refers to the spatial expression of its extension methods. JFinal is composed of five main components: Handler, Interceptor, Controller, Render, and Plugin. This chapter will provide a brief introduction to this architecture and some commonly used extensions based on it.

# Five Main Components

  1. Handler: Responsible for the pre-processing and post-processing of incoming HTTP requests. Handlers can be used for tasks such as URL rewriting, filtering, and more.

  2. Interceptor: A mechanism that allows you to add behavior to methods inside Controllers. They can be used for logging, security checks, transactions, etc.

  3. Controller: The core component where the business logic resides. It maps URLs to specific methods and handles client requests.

  4. Render: Responsible for the view rendering process. JFinal supports multiple view technologies, and you can easily extend it to support others.

  5. Plugin: Used for extending JFinal's capabilities, like adding support for databases, queues, and other services.

# Extensibility

The architecture is designed to be highly extensible, allowing developers to easily add custom functionalities or modify existing ones. Whether you need to add a custom authentication mechanism, integrate a new view rendering engine, or extend the Controller with new functionalities, JFinal's architecture makes it straightforward.

# Typical Extensions

Some of the typical extensions that can be built based on this architecture include:

  1. Custom Handlers: For tasks like URL rewriting, request and response modification.

  2. Custom Interceptors: For things like logging, security checks, or method-level annotations.

  3. Custom Controllers: For implementing specific business logic or RESTful APIs.

  4. Custom Renders: To integrate different view technologies other than the ones provided by default.

  5. Custom Plugins: For integrating different databases, messaging queues, or any third-party libraries.

The next sections will delve deeper into these components and provide examples and best practices for extending them.

Last Updated: 9/22/2023, 7:51:24 AM