Package com.codename1.backend


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.

  • Class
    Description
    A Future that is already complete: what an @Async method returns from its body.
    A configured, running server: the twenty lines every main used to open with, written once.
     
    Where the handlers are built, once the things they need exist.
    Where a server's websocket endpoints come from.
    Standard base64 (RFC 4648 section 4), with padding.
    Base64url without padding, as JSON Web Tokens use it.
    A growable byte buffer that callers reuse.
    Where a server's settings come from, in one resolution order.
    The crypto a server needs to authenticate a request.
    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.
    One database API over SQLite, PostgreSQL and MySQL, chosen by URL.
    A unit of work run inside Database.transaction(Database.Work).
    A pool of connections to ONE database, whichever engine that database is.
    A unit of work run against one borrowed connection.
    SQLite persistence for server-side binaries, on the engine the translator already bundles.
    A unit of work run inside Db.transaction(Db.Work).
    A fixed pool of connections to one SQLite database.
    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.
    What a Lambda-style handler implements.
    A minimal HTTP/1.1 client over Tcp.
    One HTTP response: status line, headers and body.
    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.
    One HTTP/2 connection, on nghttp2.
    One request, once the client has finished sending it.
    An HTTP/1.1 server built around a reactor and a bounded worker pool.
     
    One part of a multipart/form-data request body: a form field, or an uploaded file when it has a filename.
    What a handler receives.
    What a handler returns.
    Chooses the websocket endpoint for an upgrade request, or null when this router does not serve that path.
    What a HttpServer.WebSocketRoutes callback puts its endpoints into.
    Where websocket routes come from.
    State kept for one client across requests, found again through a cookie.
    A self-contained JSON reader/writer for server-side binaries.
    A value that knows how to write itself as JSON.
    HS256 JSON Web Tokens: issue one, and verify one you are handed.
    Thrown for any token that is not valid and current.
    The AWS Lambda custom-runtime loop.
    Readiness notification over epoll (Linux) or kqueue (macOS/BSD).
    A listening TCP socket and the blocking read/write a worker uses once it owns a connection.
    Thrown when a read or write deadline expires.
    Where HttpSessions are kept between requests.
    Turns SIGTERM into an ordinary blocking call, so a server can shut down cleanly when its container asks it to.
    One timed operation inside a distributed trace.
    Serves files out of a document root, on the kernel's zero-copy path.
    A named place background work runs: a pool of platform threads, or virtual threads on the server's hosts.
    Where background work runs: the named TaskExecutors, and two shorthands for running something once.
    Blocking TCP client socket for server-side (clean-target) binaries.
    Server-side TLS.
    Where spans come from and where they go.
    Distributed tracing for the server, and the hooks it is instrumented through.
    A transaction could not begin, commit or roll back the way a @Transactional method asked.
    A MANDATORY method was called with no transaction, or a NEVER one inside one.
    The transaction ran past its timeout and was rolled back.
    A transaction was rolled back although its own method returned normally, because a method that joined it failed and marked it rollback-only.
    The transaction a @Transactional method runs in, bound to the calling thread.
    A thread of control that is not an OS thread.
    Outbound HTTP and HTTPS for server-side binaries.
    An outbound response: status, body, and libcurl's message when it failed.
    What an application implements to serve a websocket route.
    One websocket connection: the decoder that turns bytes into messages, and the handle an application sends through.