public class JSONWebServer extends Object implements com.sun.net.httpserver.HttpHandler
Modifier and Type | Field and Description |
---|---|
private Result |
baseResult
Starting point.
|
private Database |
db
The database we use for obtaining object bundles.
|
private ResultHierarchy |
hier
The result tree we serve.
|
private static Logging |
LOG
Our logger.
|
static String |
PATH_JSON
The base path we serve data from.
|
private com.sun.net.httpserver.HttpServer |
server
Server instance.
|
Constructor and Description |
---|
JSONWebServer(int port,
ResultHierarchy hier,
Result baseResult)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
bundleToJSON(JSONBuffer re,
DBIDRef id)
Serialize an object bundle to JSON.
|
void |
handle(com.sun.net.httpserver.HttpExchange exchange) |
private void |
outlierMetaToJSON(JSONBuffer re,
OutlierScoreMeta meta)
Serialize outlier metadata as JSON.
|
protected void |
resultToJSON(JSONBuffer re,
String name)
Serialize an arbitrary result into JSON.
|
void |
stop()
Stop the web server.
|
private DBID |
stringToDBID(String query)
Parse a string into a DBID.
|
private static final Logging LOG
public static final String PATH_JSON
private com.sun.net.httpserver.HttpServer server
private ResultHierarchy hier
private Result baseResult
private Database db
public JSONWebServer(int port, ResultHierarchy hier, Result baseResult)
port
- Port to listen onhier
- Result hierarchy to servepublic void stop()
private DBID stringToDBID(String query)
query
- Query stringprotected void bundleToJSON(JSONBuffer re, DBIDRef id)
re
- Buffer to serialize toid
- Object IDprotected void resultToJSON(JSONBuffer re, String name)
re
- Buffer to serialize toname
- Result requestedprivate void outlierMetaToJSON(JSONBuffer re, OutlierScoreMeta meta)
re
- Output buffermeta
- Metadatapublic void handle(com.sun.net.httpserver.HttpExchange exchange) throws IOException
handle
in interface com.sun.net.httpserver.HttpHandler
IOException
Copyright © 2015 ELKI Development Team, Lehr- und Forschungseinheit für Datenbanksysteme, Ludwig-Maximilians-Universität München. License information.