出于(JUnit)测试的目的,我想创建一个简单的应用程序,它将成为使用Spring HttpInvoker调用的服务器。我不想让一个真正的webapp部署在任何servlet容器中,只想做一些独立的东西。
你有什么想法让它尽可能的简单吗?(首选没有嵌入Tomcat或其他东西的解决方案。)
发布于 2011-10-25 22:19:45
这对你会很有帮助的-- 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);
}您可以在@BeforeClass方法中启动服务器,记录服务器启动的baseUrl,并使用此url测试您的客户端。
发布于 2011-10-25 22:09:01
http://code.google.com/p/jianwikis/wiki/SpringHttpRemotingWithEmbeddedJettyServer
https://stackoverflow.com/questions/7820116
复制相似问题