Implementation:APIJSON APIJSON Demo DemoParser Solon
| 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
- Repository: APIJSON_APIJSON_Demo
- File: APIJSON-Java-Server/APIJSONDemo-Solon/src/main/java/apijson/demo/DemoParser.java
- Lines: 1-138
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);