Achieve — High Level Logic Project. Creating a new meta design pattern.

Friendly in development. Fast in production. Just build your apps. Let Achieve do the rest.

← Back to technical specifications

Achieve JavaScript Servlet Session API

Created November 6, 2026 · Updated November 6, 2026 · Achieve 3.1.0 · Qualified runtime: Node.js 24.22.2

Achieve creates one session object for each JavaScript Servlet invocation. It joins the native Node.js request and response with Achieve's parsed parameters, application paths, response-completion choice, and servlet-relative module loader.

Request, response, and parameters

session.request and session.response are the native Node.js request and response objects for the exchange. A servlet can inspect request metadata, consume input that Achieve has not parsed, set response fields and status, or use Node's response methods directly.

session.params is the value Achieve prepared before invocation. GET query input and supported built-in POST form or JSON input are parsed as described in Request Input. Registered additional methods begin with an empty parameter object and retain their input on the request stream. The legacy session.parms alias refers to the same value as session.params.

Response ownership

session.autoEnd defaults to true. Achieve then examines the servlet's direct result or returned Promise and completes the managed response. Setting it to false before the servlet returns transfers normal completion responsibility to the application:

exports.servlet = function (session) {
  session.autoEnd = false;
  session.response.write("Hello ");
  session.response.end("World!");
};

session.allowAsync is a compatibility alias with inverse meaning: setting it to true makes autoEnd false, and setting it to false makes autoEnd true. If both properties are assigned, the last assignment determines ownership. Returning a Promise normally does not require application-owned completion; with autoEnd true, Achieve waits for it.

Application and servlet paths

session.appPath is the configured application-space root used for the selected servlet. session.dirPath is the directory containing that servlet, so it changes for nested servlet locations while appPath remains the application root. These are server filesystem paths, not request URLs.

Achieve's public routing remains contained by the application space, but servlet code is ordinary Node.js code. Possession of these paths does not sandbox the servlet or restrict deliberate filesystem access performed with Node APIs.

Servlet-relative module loading

session.load() resolves supported backend module filenames from session.dirPath. CommonJS modules load synchronously; ECMAScript modules return a Promise. File forms, reload checks, caching, and error behavior are described in Backend Module Loading.

Responsibility and verification

Achieve owns construction of the session, supported input preparation, managed result handling, and errors that propagate through the managed invocation. Applications own direct request-stream processing, response values they set, eventual completion after disabling autoEnd, and detached asynchronous work.

Session-path tests verify application and servlet directories across nested and replaced application spaces. Response-completion tests verify autoEnd, the inverse allowAsync alias, assignment order, native response behavior, and all four transports. Request-input, registered-method, Promise, servlet-module, and helper-cache suites verify the other documented paths. The parms alias is established by direct construction in the released implementation; no focused assertion currently exercises that alias.

See JavaScript Servlet Lifecycle for invocation and result processing and the HTTP Methods and Responses specification for status-specific completion rules.