jsonrpc4j icon indicating copy to clipboard operation
jsonrpc4j copied to clipboard

Expose Request and Response objects to JSONRPC methods

Open JohannSig opened this issue 10 years ago • 0 comments

Hi :)

I'm interested in learning how/why not the Request and Response objects can be passed over from Servlet classes to Service/ServiceImpl methods. There are two unholy reasons for why I want this:

  1. I like storing logged-in-User-IDs in HttpSession object and I've so far found no elegant way to pass any server-side objects to the JSONRPC methods. Without them I have no way of verifying if the User is legit, has the right access level to use the method etc.

  2. I like dynamically updating page components by making JavaScript calls for JSP content as strings, followed by $(selector).html(content). Without the response object present in a JSONRPC method I can't include the JSPs.

I've already solved both of the above by hacking together a static object that pushes/gets/clears the Request and Response objects to a Thread-keyed Map but it felt so wrong that I have trouble sleeping at night.

My question therefore is: Can I/Would it be inherently BAD to expose the Request/Response objects to the JSONRPC methods through some proper channel?

JohannSig avatar Sep 17 '15 10:09 JohannSig