Class 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 the QueryEngine made through the text interface will be reflected in the web interface, making it possible to experiment with different settings.

    • Field Detail

      • server

        public final org.mortbay.jetty.Server server
        The underlying Jetty server. Access to this field is useful to tune or stop the server.
    • 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 in queryEngine) that will be used to display documents.
        itemClass - a class implementing an HttpServlet 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, or null.
        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.