使用此代码......
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.webapp.WebAppContext;
public class OneWebApp
{
public static void main(String[] args) throws Exception
{
String jetty_home = "C:/Software/jetty";
Server server = new Server(8080);
WebAppContext webapp = new WebAppContext();
webapp.setContextPath("/");
webapp.setWar(jetty_home+"/quercus-4.0.18.war");
server.setHandler(webapp);
server.start();
server.join();
}
}
...我可以从webapp目录中读取PHP文件:C:\ Documents and Settings \ mydir \ Local Settings \ Temp \ jetty-0.0.0.0-8080-quercus-4.0.18.war -_- any- \ webapp
如何配置Jetty以在另一个目录中查找PHP文件?例如: C:\Projects\phpfiles
使用Apache,我只需在配置中执行以下操作:
Alias /phpfiles "C:\Projects\phpfiles"
<Directory C:\Projects\phpfiles>
Order allow,deny
Allow from all
AllowOverride All
</Directory>
1 回答
您可以将战争路径更改为:
目录phpfiles将需要包含Web应用程序的结构(最低限度包括WEB-INF / web.xml) . 您需要在WEB-INF / lib中包含quercus依赖项,或者只是在类路径中添加依赖项(因为它是嵌入式的) . 依赖项和web.xml可以在quercus - * .war中找到 .
如果你需要有多个php文件的源目录,我认为这不是支持 . 您需要扩展 QuercusServletImpl 并实现/覆盖getPath(HttpServletRequest req) .