public class HttpFileServer extends Object
For security reasons, some browsers (notably Firefox at the time of this writing) do not serve file: content from a non-file: page. The solution is a minimal server that has the root of the filesystem as document root.
To instantiate the server, you just need a variable of type
just retrieve and cache the result of
avoid class garbage collection). A port is randomly assigned to the server; it can be retrieved with
getPort(). In case you need a specific port, the system property
it.unimi.di.mg4j.query.HttpFileServer.port can be used to this purpose.
|Modifier and Type||Method and Description|
Returns the port assigned to the server.
Returns the only instance of an HTTP file server.
public static HttpFileServer getServer()
Note that the instance should be cached by the application, to avoid garbage collection.
public static int getPort()