在Jetty上运行CGI [英] Running CGI on Jetty

查看:186
本文介绍了在Jetty上运行CGI的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从Java程序本身内部启动Jetty.我只是想让它指向放置在包目录(/src/package/cgi-bin)下的一个cgi文件夹

I'm starting Jetty from inside the Java program itself. I'm simply trying to get it to point at a cgi-folder that I've placed underneath the package directory (/src/package/cgi-bin)

问题在于每次我启动服务器时,都会抱怨没有CGI bin!".放置cgi-bin并指向它的正确位置在哪里?这就是我所拥有的:

The problem is that every time I start up the server, it complains "no CGI bin!". Where is the correct location to put your cgi-bin and point at it? This is what I have:

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没有初始化任何参数为该问题的答案.

See Jetty setInitParameter is NOT initializing any parameter for the answer to this question.

推荐答案

通过 Jetty setInitParameter没有初始化任何参数

问题是当我应该在ServletHolder

这篇关于在Jetty上运行CGI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆