|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectit.unimi.di.mg4j.query.HttpFileServer
public class HttpFileServer
A minimal, singleton server serving the whole filesystem.
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 HttpFileServer.
just retrieve and cache the result of getServer() (to
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.
It may happen that the server is not yet started when you call getPort(), in which case
an IllegalStateException will be thrown.
| Method Summary | |
|---|---|
static int |
getPort()
Returns the port assigned to the server. |
static HttpFileServer |
getServer()
Returns the only instance of an HTTP file server. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static HttpFileServer getServer()
Note that the instance should be cached by the application, to avoid garbage collection.
public static int getPort()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||