Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:APIJSON APIJSON Demo DemoParser Solon

From Leeroopedia
Knowledge Sources
Domains Web_Framework, Request_Parsing
Last Updated 2026-10-14 00:00 GMT

Overview

Concrete tool for parsing APIJSON requests with Solon framework SessionState integration instead of standard HttpSession.

Description

The DemoParser class (Solon variant) extends AbstractParser<Long, JSONObject, JSONArray> and integrates with the Solon framework's SessionState for session management. It overrides createObjectParser, createFunctionParser, createSQLConfig, createSQLExecutor, and createVerifier to wire in Solon-specific demo components. It maintains a static KEY_MAP of SessionState instances and provides setSession/getSession for Solon session access.

Usage

Use this class when running the APIJSON demo under the Solon framework instead of Spring Boot, to parse APIJSON requests with Solon session state.

Code Reference

Source Location

Signature

public class DemoParser extends AbstractParser<Long, JSONObject, JSONArray> {
    public static final Map<String, SessionState> KEY_MAP;
    private SessionState session;

    public DemoParser();
    public DemoParser(RequestMethod method);
    public DemoParser(RequestMethod method, boolean needVerify);

    public Parser<Long, JSONObject, JSONArray> setSession(SessionState session);
    public SessionState getSession();

    @Override
    public Parser<Long, JSONObject, JSONArray> createParser();
    @Override
    public ObjectParser<Long, JSONObject, JSONArray> createObjectParser(...);
    @Override
    public FunctionParser<Long, JSONObject, JSONArray> createFunctionParser();
    @Override
    public SQLConfig<Long, JSONObject, JSONArray> createSQLConfig();
    @Override
    public SQLExecutor<Long, JSONObject, JSONArray> createSQLExecutor();
    @Override
    public Verifier<Long, JSONObject, JSONArray> createVerifier();
}

Import

import apijson.demo.DemoParser;

I/O Contract

See Implementation:APIJSON_APIJSON_Demo_DemoParser for the I/O contract; the Solon variant replaces HttpSession with SessionState.

Usage Examples

// Use with Solon framework
DemoParser parser = new DemoParser(RequestMethod.GET);
parser.setSession(solonSessionState);
JSONObject response = parser.parseResponse(request);

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment