Class HttpQueryServer
- java.lang.Object
-
- it.unimi.di.big.mg4j.query.HttpQueryServer
-
public class HttpQueryServer extends Object
A very basic HTTP server answering queries.The main method of this class starts a very basic HTTP server answering queries. If a matching document collection is provided, the server will also display some intervals satisfying the queries.
Queries are served by the
QueryServlet
; by default, the servlet listen on port 4242, and the servlet is deployed under the path /Query. A servlet displaying single documents from the collection is deployed under the path /Item. The server and the servlet are fully multithreaded.If you want to start this server from the command line, you must use the main method of
Query
, providing the suitable option. Changes to theQueryEngine
made through the text interface will be reflected in the web interface, making it possible to experiment with different settings.
-
-
Field Summary
Fields Modifier and Type Field Description org.mortbay.jetty.Server
server
The underlying Jetty server.
-
Constructor Summary
Constructors Constructor Description HttpQueryServer(QueryEngine queryEngine, DocumentCollection collection, Class<? extends HttpServlet> itemClass, String itemMimeType, int port, BigList<? extends CharSequence> titleList)
Creates a new HTTP query server.
-
Method Summary
Modifier and Type Method Description static org.apache.commons.collections.ExtendedProperties
setLiberalResourceLoading(org.apache.commons.collections.ExtendedProperties p)
Sets the given extended properties so that velocity finds its files either by classpath, or by absolute filename, or by relative filename.
-
-
-
Constructor Detail
-
HttpQueryServer
public HttpQueryServer(QueryEngine queryEngine, DocumentCollection collection, Class<? extends HttpServlet> itemClass, String itemMimeType, int port, BigList<? extends CharSequence> titleList) throws Exception
Creates a new HTTP query server.- Parameters:
queryEngine
- the query engine that will be used (actually, copied) by the servlets run by this query server.collection
- the document collection (related to the indices contained inqueryEngine
) that will be used to display documents.itemClass
- a class implementing anHttpServlet
and responsible for displaying documents (see, e.g.,GenericItem
.itemMimeType
- the default MIME type of a displayed item.port
- the port exposing the server.titleList
- an optional list of titles for all documents, ornull
.- Throws:
Exception
-
-
Method Detail
-
setLiberalResourceLoading
public static org.apache.commons.collections.ExtendedProperties setLiberalResourceLoading(org.apache.commons.collections.ExtendedProperties p)
Sets the given extended properties so that velocity finds its files either by classpath, or by absolute filename, or by relative filename.- Parameters:
p
- the extended properties of the servlet, obtained via super.loadConfiguration().- Returns:
p
the additional items setting a liberal scheme for resource loading.
-
-