da1ade63 by Ean Schuessler

Fix null user loop in JSON-RPC requests

- Add web facade initialization to handleJsonRpc method
- This prevents Moqui UserFacade null user session warnings
- Ensures proper HTTP session linkage for JSON-RPC requests
- JSON-RPC requests now work consistently like SSE connections

The null user loop was caused by ExecutionContext not having proper
web facade initialization for JSON-RPC requests, while SSE connections
were properly initialized. This fix ensures both request types have
consistent session management.
1 parent 68d02281
......@@ -513,6 +513,16 @@ logger.info("Handling Enhanced SSE connection from ${request.remoteAddr}")
private void handleJsonRpc(HttpServletRequest request, HttpServletResponse response, ExecutionContextImpl ec)
throws IOException {
// Initialize web facade for proper session management (like SSE connections)
// This prevents the null user loop by ensuring HTTP session is properly linked
try {
ec.initWebFacade(webappName, request, response)
logger.debug("JSON-RPC web facade initialized for user: ${ec.user?.username}")
} catch (Exception e) {
logger.warn("JSON-RPC web facade initialization failed: ${e.message}")
// Continue anyway - we may still have basic user context from auth
}
String method = request.getMethod()
String acceptHeader = request.getHeader("Accept")
String contentType = request.getContentType()
......