Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

Using RPCManager constructor in a Servlet throws Exception

$
0
0
Hi Isomorphic,

I'm trying to use the serverside RPCManager constructor in a standalone servlet (cron-job triggered mail processing, see this thread). Right now, I'm hitting the servlet with a browser.

I registered the Servlet in web.xml and it is accessed as expected. My code is:
Code:

import java.io.IOException;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.isomorphic.datasource.DSRequest;
import com.isomorphic.datasource.DSResponse;
import com.isomorphic.datasource.DataSource;
import com.isomorphic.rpc.ClientMustResubmitException;
import com.isomorphic.rpc.RPCManager;
import com.isomorphic.sql.SQLTransaction;

public class SendMail extends HttpServlet {
        private static final long serialVersionUID = -7397909713823548814L;

        @Override
        public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//                response.setContentType("text/html");
//                response.setCharacterEncoding("UTF-8");
                try {
                        RPCManager rpcManager = new RPCManager(request, response); //exception
                        rpcManager.setUserId("2");
                        ...
                        } catch (ClientMustResubmitException exception) {
                        return;
                } catch (Exception e) {
                        response.getWriter().append(e.getMessage());
                }
        }

        @Override
        public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
                doGet(request, response);
        }
}

For the line "RPCManager rpcManager = new RPCManager(request, response);" I get the exception "Non-RPC request ignored.", but from the linked javadocs I think this is how to use the constructor.

Am I doing anything wrong (I'm using v9.1p_2014-08-17)?

Thank you,
Blama

Viewing all articles
Browse latest Browse all 4756

Trending Articles