Search code examples
javaspringremotinghttpinvoker

Simplest remoting server using Spring HttpInvoker


For (JUnit) testing purposes I'd like to make a simple application that would be the server to be invoked using Spring HttpInvoker. I don't want to make a real webapp to be deployed in any servlet container, only something standalone.

Do you have any ideas how to make it as simply as possible? (Solutions without embedded Tomcat or stuff are preferred..)


Solution

  • This will work out well for you - http://docs.codehaus.org/display/JETTY/ServletTester

        @BeforeClass
    public static void initServletContainer() throws Exception {
        tester = new ServletTester();
        tester.setContextPath("/");
        tester.addServlet(DummyServlet.class, "/dummy");
        baseUrl = tester.createSocketConnector(true);
        tester.start();
        System.out.println(baseUrl);
    }
    

    You can start up the server in your @BeforeClass method, record the baseUrl where the server starts up and use this url to test your client.