javaembedded-jettyrestlet-2.0

Restlet 2.3 How to set temp directory


I am using Restlet 2.3 with the Jetty ext. How do you set the temp directory that the jar is unpacked to?

Using just jetty in another project it can be achieved using:

private void resetTempDirectory(WebAppContext context, String currentDir) {
        File tmpDir = new File(currentDir, ".tmp");
        tmpDir.deleteOnExit();
        tmpDir.mkdir();
        context.setTempDirectory(tmpDir);
    }

Solution

  • You can find here all the supported parameters for the Jetty server connector: http://restlet.com/technical-resources/restlet-framework/javadocs/2.3/jse/ext/. It appears that there is no parameter for the temp directory.

    For information here is the way to configure a server connector using context: http://restlet.com/technical-resources/restlet-framework/guide/2.3/core/base/connectors.

    I have a look at the Jetty extension. Restlet leverages the class Server and JettyServerCall to respectively create the Jetty server and handle requests. I can't see any use of a class WebAppContext.

    That said, I'm not sure Jetty / Restlet unpack things ;-) Could you give me hints about the way you configure / use Jetty in your other project? Thanks!

    Hope it helps you, Thierry