# arthur607/undertow architecture

> Architecture diagram of the GitHub repository arthur607/undertow, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/arthur607/undertow
- Repository: https://github.com/arthur607/undertow

## Overview

##### Main Components Identification
- Core HTTP Server (non-blocking IO)
- Servlet Implementation (4.0/5.0/6.0)
- WebSocket Implementation (JSR-356/Jakarta 2.0)

##### Connection Flow
- Client requests flow
- Protocol negotiation
- Request handling paths
- Response paths

##### Integration Points
Highlight:
- SSL/TLS integration
- Authentication/Authorization points
- Protocol upgrade paths (HTTP to WebSocket)
- Servlet filter chain integration

##### Performance Aspects
Indicate:
- Buffer pools
- Thread pools
- Connection pools
- Async handling points

Remember to emphasize the non-blocking nature of the server as it's a key architectural feature of Undertow.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        C[Client]
    end

    subgraph "WebSocket Layer"
        WS["Core WebSocket"]:::websocket
        JSR["JSR Implementation"]:::websocket
        WSS["WebSocket Sessions"]:::websocket
        EP["Endpoint Management"]:::websocket
        
        WS --> JSR
        JSR --> WSS
        JSR --> EP
    end

    subgraph "Servlet Container Layer"
        SC["Servlet Container"]:::servlet
        DM["Deployment Management"]:::servlet
        SI["Security Integration"]:::servlet
        SM["Session Management"]:::servlet
        FC["Filter Chain"]:::servlet
        
        SC --> DM
        SC --> SI
        SC --> SM
        SC --> FC
    end

    subgraph "Server Layer"
        CM["Connection Management"]:::server
        SH["Security Handlers"]:::server
        RH["Resource Handlers"]:::server
        SSM["Server Session Management"]:::server
        
        CM --> SH
        CM --> RH
        CM --> SSM
    end

    subgraph "Protocol Layer"
        HTTP["HTTP/1.1 Handler"]:::protocol
        HTTP2["HTTP/2 Handler"]:::protocol
        AJP["AJP Protocol"]:::protocol
        SSL["SSL/TLS Support"]:::protocol
        
        HTTP --> SSL
        HTTP2 --> SSL
        AJP --> SSL
    end

    subgraph "Core Layer"
        IOH["IO Handlers"]:::core
        PH["Protocol Handlers"]:::core
        CHM["Channel Management"]:::core
        BPM["Buffer Pool Management"]:::core
        
        IOH --> PH
        PH --> CHM
        CHM --> BPM
    end

    C --> HTTP
    C --> HTTP2
    C --> AJP
    
    HTTP --> CM
    HTTP2 --> CM
    AJP --> CM
    
    CM --> SC
    CM --> WS
    
    %% Component Mappings
    click IOH "https://github.com/arthur607/undertow/tree/master/core/src/main/java/io/undertow/io/"
    click CHM "https://github.com/arthur607/undertow/tree/master/core/src/main/java/io/undertow/channels/"
    click BPM "https://github.com/arthur607/undertow/blob/master/core/src/main/java/io/undertow/connector/ByteBufferPool.java"
    click HTTP "https://github.com/arthur607/undertow/tree/master/core/src/main/java/io/undertow/protocols/http/"
    click HTTP2 "https://github.com/arthur607/undertow/tree/master/core/src/main/java/io/undertow/protocols/http2/"
    click AJP "https://github.com/arthur607/undertow/tree/master/core/src/main/java/io/undertow/protocols/ajp/"
    click SSL "https://github.com/arthur607/undertow/tree/master/core/src/main/java/io/undertow/protocols/ssl/"
    click CM "https://github.com/arthur607/undertow/tree/master/core/src/main/java/io/undertow/server/"
    click SH "https://github.com/arthur607/undertow/tree/master/core/src/main/java/io/undertow/security/"
    click RH "https://github.com/arthur607/undertow/tree/master/core/src/main/java/io/undertow/server/handlers/resource/"
    click SSM "https://github.com/arthur607/undertow/tree/master/core/src/main/java/io/undertow/server/session/"
    click SC "https://github.com/arthur607/undertow/tree/master/servlet/src/main/java/io/undertow/servlet/"
    click DM "https://github.com/arthur607/undertow/blob/master/servlet/src/main/java/io/undertow/servlet/core/DeploymentManagerImpl.java"
    click SI "https://github.com/arthur607/undertow/tree/master/servlet/src/main/java/io/undertow/servlet/handlers/security/"
    click WS "https://github.com/arthur607/undertow/tree/master/core/src/main/java/io/undertow/websockets/"
    click JSR "https://github.com/arthur607/undertow/tree/master/websockets-jsr/src/main/java/io/undertow/websockets/jsr/"
    click WSS "https://github.com/arthur607/undertow/blob/master/websockets-jsr/src/main/java/io/undertow/websockets/jsr/UndertowSession.java"
    click EP "https://github.com/arthur607/undertow/blob/master/websockets-jsr/src/main/java/io/undertow/websockets/jsr/EndpointSessionHandler.java"

    %% Styling
    classDef core fill:#2374ab
    classDef protocol fill:#48a9a6
    classDef server fill:#4b4e6d
    classDef servlet fill:#e4572e
    classDef websocket fill:#9c6615
    
    %% Legend
    subgraph Legend
        L1[Core Components]:::core
        L2[Protocol Handlers]:::protocol
        L3[Server Components]:::server
        L4[Servlet Components]:::servlet
        L5[WebSocket Components]:::websocket
    end
```
