All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.citec.scie.web.Server Maven / Gradle / Ivy

Go to download

Module providing the webservice interface based on the Jetty embedded webserver and the FreeMarker template engine. Defines a simple format for providing textual annotations and produced output in HTML or JSON. This module has no dependencies to the other SCIE modules (except for the PDF text extractor) or the UIMA framework and thus can be used in any context, where text is annotated by an algorithm and should be presented to an end user.

The newest version!
/*
 * SCIE -- Spinal Cord Injury Information Extraction
 * Copyright (C) 2013, 2014
 * Raphael Dickfelder, Jan Göpfert, Benjamin Paaßen, Andreas Stöckel
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 * 
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see .
 */

package de.citec.scie.web;

import de.citec.scie.web.analysis.AbstractAnalysis;
import java.net.InetSocketAddress;

/**
 * Contains convenience function for starting a SCIE embedded web server using a
 * given analysis handler.
 *
 * @author Andreas Stöckel -- [email protected]
 */
public class Server {

	/**
	 * Starts a new web frontend which uses the given analysis.
	 *
	 * @param analysis is the analysis which should be run on documents which
	 * were uploaded by the user.
	 * @param host is the host on which the http server should listen. Set to
	 * "[::]" or "0.0.0.0" to listen to all addresses.
	 * @param port is the port at which the http server should listen.
	 * @throws Exception if the server fails.
	 */
	public static void startServer(AbstractAnalysis analysis, String host,
			int port) throws Exception {
		org.eclipse.jetty.server.Server server
				= new org.eclipse.jetty.server.Server(
						new InetSocketAddress(host, port));
		server.setHandler(new ServerHandler(analysis));
		server.start();
		server.join();
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy