0

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

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

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

Alias /phpfiles "C:\Projects\phpfiles"
<Directory C:\Projects\phpfiles>
   Order allow,deny
   Allow from all
   AllowOverride All
</Directory>
braveterry
  • 3,724
  • 8
  • 47
  • 59

1 Answers1

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.

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).

h3xStream
  • 6,293
  • 2
  • 47
  • 57
  • I want to deploy the war in one place and pull the PHP files from another, so the first option is no good. I'll look into extending QuercusServletImpl. – braveterry Jul 14 '11 at 14:04