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}") ...@@ -513,6 +513,16 @@ logger.info("Handling Enhanced SSE connection from ${request.remoteAddr}")
513 private void handleJsonRpc(HttpServletRequest request, HttpServletResponse response, ExecutionContextImpl ec) 513 private void handleJsonRpc(HttpServletRequest request, HttpServletResponse response, ExecutionContextImpl ec)
514 throws IOException { 514 throws IOException {
515 515
516 // Initialize web facade for proper session management (like SSE connections)
517 // This prevents the null user loop by ensuring HTTP session is properly linked
518 try {
519 ec.initWebFacade(webappName, request, response)
520 logger.debug("JSON-RPC web facade initialized for user: ${ec.user?.username}")
521 } catch (Exception e) {
522 logger.warn("JSON-RPC web facade initialization failed: ${e.message}")
523 // Continue anyway - we may still have basic user context from auth
524 }
525
516 String method = request.getMethod() 526 String method = request.getMethod()
517 String acceptHeader = request.getHeader("Accept") 527 String acceptHeader = request.getHeader("Accept")
518 String contentType = request.getContentType() 528 String contentType = request.getContentType()
......