Backend API. Server-side code: this runs in a Codename One backend, not in the app on the device.
package com.codename1.backend
The Codename One backend runtime: the server side of an application, written in the same Java as the app and compiled to a native server binary.
This package is server code. None of it is available in the app on the device; the classes an app and its server share are the ORM session API and the entity annotations, which live in the client packages and are documented in both references.
Backend is the entry point: it reads the Config, opens the database the
deployment names, and runs an HttpServer. Around it are the pieces a server
needs without a framework behind it – Database and DataSource over SQLite,
PostgreSQL and MySQL, Json, Jwt, WebSocket endpoints, StaticFiles,
distributed tracing through Tracing, and LambdaRuntime for AWS Lambda.
Controllers are ordinary classes annotated from
com.codename1.backend.annotations; the build generates the router, so
nothing is registered or scanned at start-up.
Types
class AsyncResult | A Future that is already complete: what an @Async method returns from its body. |
class Backend | A configured, running server: the twenty lines every main used to open with, written once. |
class Base64 | Standard base64 (RFC 4648 section 4), with padding. |
class Base64Url | Base64url without padding, as JSON Web Tokens use it. |
class ByteSink | A growable byte buffer that callers reuse. |
class Config | Where a server’s settings come from, in one resolution order. |
class Crypto | The crypto a server needs to authenticate a request. |
class DataAccessException | A database operation failed: a statement the engine refused, a connection that could not be opened or was lost, a query that returned more rows than one. |
class DataSource | A pool of connections to ONE database, whichever engine that database is. |
class Database | One database API over SQLite, PostgreSQL and MySQL, chosen by URL. |
class Db | SQLite persistence for server-side binaries, on the engine the translator already bundles. |
class DbPool | A fixed pool of connections to one SQLite database. |
class FileIo | The file-system calls a static handler needs, isolated so that everything else in StaticFiles – ranges, conditional requests, MIME types, the containment check – is pure Java and shared by every target. |
interface Handler | What a Lambda-style handler implements. |
class Http | A minimal HTTP/1.1 client over Tcp. |
class Http1Date | The one date format HTTP/1.1 requires on the wire (“Sun, 06 Nov 1994 08:49:37 GMT”), formatted and parsed from epoch milliseconds directly. |
class Http2 | One HTTP/2 connection, on nghttp2. |
class HttpServer | An HTTP/1.1 server built around a reactor and a bounded worker pool. |
class HttpSession | State kept for one client across requests, found again through a cookie. |
class Json | A self-contained JSON reader/writer for server-side binaries. |
class Jwt | HS256 JSON Web Tokens: issue one, and verify one you are handed. |
class LambdaRuntime | The AWS Lambda custom-runtime loop. |
class Migrations | Versioned schema migrations for the server’s database. |
class Reactor | Readiness notification over epoll (Linux) or kqueue (macOS/BSD). |
class ServerSocket | A listening TCP socket and the blocking read/write a worker uses once it owns a connection. |
interface SessionStore | Where HttpSessions are kept between requests. |
class Signals | Turns SIGTERM into an ordinary blocking call, so a server can shut down cleanly when its container asks it to. |
class Span | One timed operation inside a distributed trace. |
class StaticFiles | Serves files out of a document root, on the kernel’s zero-copy path. |
class TaskExecutor | A named place background work runs: a pool of platform threads, or virtual threads on the server’s hosts. |
class Tasks | Where background work runs: the named TaskExecutors, and two shorthands for running something once. |
class Tcp | Blocking TCP client socket for server-side (clean-target) binaries. |
class Tls | Server-side TLS. |
interface Tracer | Where spans come from and where they go. |
class Tracing | Distributed tracing for the server, and the hooks it is instrumented through. |
class TransactionException | A transaction could not begin, commit or roll back the way a @Transactional method asked. |
class Transactions | The transaction a @Transactional method runs in, bound to the calling thread. |
class VirtualThread | A thread of control that is not an OS thread. |
class Web | Outbound HTTP and HTTPS for server-side binaries. |
interface WebSocket | What an application implements to serve a websocket route. |
class WebSocketSession | One websocket connection: the decoder that turns bytes into messages, and the handle an application sends through. |