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.
    One call of an @Async method, and the Future its caller holds.
    A configured, running server: the twenty lines every main used to open with, written once.
    The build-generated wiring of an application: every bean, constructed and injected by straight-line code the build wrote, and the lifecycle calls around them.
     
    What an Backend.Application is built from.
    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.
    When a cron job fires: six sets of allowed values, held as bit masks.
    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 packaged runtime's half of DevConsole: it cannot redirect the process's console, so it captures nothing and says so.
    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.
     
    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.
    What the JSON codecs the build generates call: typed reads that refuse a value with a message naming where it was, and the date form.
    Where a value sits in a body.
    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.
    A @ManagedResource bean as the build describes it: its attributes and operations by index, read and invoked through direct calls the build generated.
    The server's management endpoints: health for the load balancer, metrics for a scraper, and the jobs and managed beans for an operator.
    Readiness notification over epoll (Linux) or kqueue (macOS/BSD).
    The last requests the server answered, kept for the development MCP tools: what came in, what went out, how long it took and what was thrown.
    Runs the @Scheduled methods of a server.
    One registered job and what has happened to it.
    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.
    How a server keeps HttpSessions: the cookie, the lifetime and the store, read from configuration when the server starts.
    Sessions in the server's database, in cn1_http_session, so every instance of a server sees every session.
    Sessions in this process's memory.
    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.
    What the build-generated wiring calls: configuration placeholders, the conversions a @Value needs, and the conditions of conditional beans.
    Where a request- or session-scoped bean's current instance comes from, for the generated class that stands in for it in a singleton.