Posts Tagged ‘json-rpc java rpc’

Dojo JSON-RPC + Java

Tuesday, May 6th, 2008

Dojo supports JSON-RPC, which is an easy to use JSON-based remote method call format. JSON-RPC can be utilized for an interoperable approach to distributed computing and communicating with servers. We will look at an example of interacting with Java on the server and invoking a Java method from JavaScript using Dojo’s RPC services. We will be begin by demonstrating a simple JSON-RPC handler written in Java. First we will create a servlet and write a POST handler that will read the content from the request:

public class JsonRPC extends HttpServlet {
    protected void doPost(HttpServletRequest req, HttpServletResponse resp)
                throws ServletException, IOException {
         String content = streamToString(req.getInputStream());
 

(more…)