Skip to main content

HttpProcessor (Services)

The io-oidis-services package extends the GUI-level HTTP processing pipeline with JRE-aware navigation, DAO-based page configuration, and specialized error pages. This layer sits on top of io-oidis-gui's HttpProcessor and adds the service-specific capabilities required by Oidis desktop and web applications.

Package: io-oidis-services  |  Namespace: Io.Oidis.Services

Architecture​

                    ┌──────────────┐
│ Loader │ ← Singleton orchestrator
└──────┬───────┘
│ creates
┌──────▼───────┐
│ HttpResolver │ ← Route resolver factory
└──────┬───────┘
│ provides
┌──────▼───────┐
│ HttpManager │ ← JRE-aware navigation
└──────────────┘

Page Controllers Error Pages
┌──────────────────────┐ ┌────────────────────────┐
│ BasePageController │ │ AuthHttpResolver │
│ (sync, 1297 lines) │ │ ConnectionLostPage │
└──────────┬───────────┘ │ InitPage │
│ └────────────────────────┘
┌──────────▼──────────────┐
│ AsyncBasePageController │
│ (async + DAO lifecycle) │
└─────────────────────────┘

Core Classes​

Loader​

The Loader class is the singleton entry point for services-based applications. It extends the GUI Loader to provide services-specific HttpResolver and HttpManager instances.

MethodDescription
getInstance()Return the singleton Loader instance
getHttpResolver()Return the services HttpResolver
getHttpManager()Return the services HttpManager
initResolver()Create a new HttpResolver for the current project

HttpResolver​

Extends the GUI HttpResolver to inject the services-specific HttpManager class. This is the only customization — all route registration and resolution logic is inherited.

HttpManager​

Extends the GUI HttpManager with JRE-specific navigation support. In JRE environments (desktop applications), the ReloadTo() method uses TerminalConnector.Open() to launch URLs in the system default handler instead of browser-based navigation. The connector is lazily initialized on first use.

Page Controllers​

BasePageController​

The synchronous page controller base class (1297 lines) manages the full desktop application page lifecycle:

  • Window chrome — Drag bar, resize bars (8 directional), minimize/maximize/close buttons
  • Loading indicators — Animated loader icon, text, and progress percentage
  • DAO integration — Loads page configuration and localization via BasePageDAO
  • Viewer management — Creates ViewerManager to load the model class, handles caching
  • JRE window management — Integrates with WindowHandlerConnector for native window operations (move, resize, minimize, maximize, restore)
  • Developer tools — Context menu with cache generation, raw data viewer, echo output (dev-only)

Lifecycle​

  1. Process() — Validates browser, initializes Echo, delegates to resolver()
  2. resolver() — Builds window chrome, sets up event handlers, renders loading UI
  3. loadResources() — Loads DAO configuration for the current language
  4. PreparePageContent() — Sets page title, loader text from DAO
  5. ViewerManager loads the model → beforeLoad() → afterLoad() → onSuccess()
  6. On failure → onError()

Key Protected Methods​

MethodDescription
setModelClassName($value)Set the viewer model class to load
setDao($value)Set the BasePageDAO for configuration
setPageTitle($value)Set the page/window title
setPageIconSource($value)Set the favicon path
setResizeableType($value)Configure window resize behavior (NONE, HORIZONTAL, VERTICAL, BOTH)
setWindowMinimalSize($w, $h)Set minimum window dimensions
beforeLoad()Hook: before model instance loads
afterLoad()Hook: after model instance loads
onSuccess()Hook: after successful completion
onError()Hook: on model loading failure

AsyncBasePageController​

Extends AsyncBaseHttpController with DAO-based configuration and an async lifecycle with environment validation and access control.

Async Lifecycle​

  1. canResolve() — Checks environment readiness and access validation
  2. loadResources() — Loads DAO for the current language
  3. PreparePageContent() — Sets page title from DAO configuration
  4. beforeLoad() → afterLoad() → onSuccess() / onError()

Access Control​

  • Environment check — Override environmentCheckEnabled() to return true; redirects to /ServerError/NotReady if the environment is not loaded
  • Access validation — Override accessValidator() (from parent); redirects to /ServerError/Http/NotAuthorized if denied

Error Pages​

AuthHttpResolver​

Route: /ServerError/Http/NotAuthorized

Handles HTTP 401 responses with token-based authentication. Manages token persistence using CLIENT_IP-scoped storage and provides request re-invocation.

MethodDescription
LogOut()Static: destroy the persisted auth token
getToken()Static: return the current token or empty string
getTokenName()Static: return the persistence variable name
reinvokeRequest($token)Re-send the original failed protocol with a new token
setExpirationTime($value)Set the token expiration time

ConnectionLostPage​

Route: /ServerError/Http/ConnectionLost

Displayed when a WebSocket or HTTP connection to a backend service is lost. Shows the requesting component and target server URL.

MethodDescription
getOwner()Return the component that owns the failed connection
restart()Stop and re-establish the WebSocket communication

InitPage​

Route: /ServerError/NotReady

Displayed when a page controller detects the backend environment is not yet loaded. Shows a loading message, subscribes to the environment loading listener via EnvironmentConnector, and redirects to / when the environment becomes ready.

File Structure​

source/typescript/Io/Oidis/Services/
├── Loader.ts # Singleton orchestrator
├── HttpProcessor/
│ ├── HttpManager.ts # JRE-aware navigation
│ ├── HttpResolver.ts # Services resolver factory
│ └── Resolvers/
│ ├── BasePageController.ts # Sync page controller (window chrome, viewer mgmt)
│ ├── AsyncBasePageController.ts # Async page controller (DAO lifecycle)
│ ├── InitPage.ts # Environment not-ready page
│ └── AboutPackage.ts # Dev-only package info page
└── ErrorPages/
├── AuthHttpResolver.ts # HTTP 401 handler
└── ConnectionLostPage.ts # Connection lost handler

See also: Architecture Overview | HTTP Processing Pipeline | Routing | DAO Layer