【发布时间】:2012-01-06 20:04:03
【问题描述】:
我从 Java 程序本身内部启动 Jetty。我只是想让它指向我放在包目录(/src/package/cgi-bin)下的一个 cgi 文件夹
问题是每次我启动服务器时,它都会抱怨“没有 CGI bin!”。放置 cgi-bin 并指向它的正确位置在哪里?这就是我所拥有的:
public static void main(String[] args) throws Exception {
// The core Jetty server running on 8080
Server server = new org.eclipse.jetty.server.Server(8080);
// Setup CGI routing
ServletContextHandler context2 = new ServletContextHandler(ServletContextHandler.SESSIONS);
context2.setContextPath("/");
context2.setInitParameter("commandPrefix", "perl");
// Where does this point to?
context2.setInitParameter("cgibinResourceBase", "cgi-bin");
server.setHandler(context2);
// Add the CGI Servlet
context2.addServlet(new ServletHolder(new Cgi()), "/cgi");
server.start();
server.join();
}
有关此问题的答案,请参阅 Jetty setInitParameter is NOT initializing any parameter。
【问题讨论】: