Jetty 7.4.2 + Quercus 4.0.18:如何從webapp目錄外部讀取PHP文件

[英]Jetty 7.4.2 + Quercus 4.0.18: How can I read PHP files from outside the webapp directory


Using this code...

使用此代碼......

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();
    }
}

... I can read PHP files from the webapp directory: C:\Documents and Settings\mydir\Local Settings\Temp\jetty-0.0.0.0-8080-quercus-4.0.18.war-_-any-\webapp

...我可以從webapp目錄中讀取PHP文件:C:\ Documents and Settings \ mydir \ Local Settings \ Temp \ jetty-0.0.0.0-8080-quercus-4.0.18.war -_- any- \ webapp

How can I configure Jetty to look for the PHP files in another directory? For example: C:\Projects\phpfiles

如何配置Jetty以在另一個目錄中查找PHP文件?例如:C:\ Projects \ phpfiles

With Apache, I would simply do something like this in the config:

使用Apache,我只需在配置中執行以下操作:

Alias /phpfiles "C:\Projects\phpfiles"
<Directory C:\Projects\phpfiles>
   Order allow,deny
   Allow from all
   AllowOverride All
</Directory>

1 个解决方案

#1


0  

You can change the war path to:

您可以將戰爭路徑更改為:

[...]
webapp.setContextPath("/");
webapp.setWar("C:/Projects/phpfiles");
[...]

The directory phpfiles will need to contains the structure of a web application (minimally include WEB-INF/web.xml). You'll need to either include the quercus dependencies in WEB-INF/lib or simply add the dependencies in your classpath (since it's embedded). The dependencies and web.xml can be found in quercus-*.war.

phpfiles目錄需要包含Web應用程序的結構(最低限度包括WEB-INF / web.xml)。您需要在WEB-INF / lib中包含quercus依賴項,或者只是在類路徑中添加依賴項(因為它是嵌入式的)。依賴項和web.xml可以在quercus - * .war中找到。

If you need to have multiple source directories of php files, which I don't think is support. You would need to extends QuercusServletImpl and implement/override getPath(HttpServletRequest req).

如果你需要有多個php文件的源目錄,我認為這不是支持。您需要擴展QuercusServletImpl並實現/覆蓋getPath(HttpServletRequest req)。


注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:https://www.itdaan.com/blog/2011/07/01/37f2ab48f805e685d01c290c009062b7.html



 
  © 2014-2022 ITdaan.com 联系我们: