From: Jim Procter Date: Thu, 5 Mar 2020 12:14:11 +0000 (+0000) Subject: JAL-3548 start an http server for posting gene ids to retrieve from ensembl and displ... X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=9e19bd7c9421b47f1e062a046c589a75c546026b;p=jalview.git JAL-3548 start an http server for posting gene ids to retrieve from ensembl and display in Jalview --- diff --git a/examples/groovy/simpleHttpServlet.groovy b/examples/groovy/simpleHttpServlet.groovy new file mode 100644 index 0000000..556f78b --- /dev/null +++ b/examples/groovy/simpleHttpServlet.groovy @@ -0,0 +1,45 @@ +import org.eclipse.jetty.server.Server +import org.eclipse.jetty.servlet.* +import groovy.servlet.* +import javax.servlet.http.* +import javax.servlet.api.* +import javax.servlet.ServletConfig + +class SimpleGroovyServlet extends HttpServlet { + def requestHandler + def context + void init(ServletConfig config) { + super.init(config) + context = config.servletContext + } + void service(HttpServletRequest request, HttpServletResponse response) { + requestHandler.binding = new ServletBinding(request, response, context) + use (ServletCategory) { + requestHandler.call() + } + } + static void run(int port, Closure requestHandler) { + ours = requestHandler; + def servlet = new SimpleGroovyServlet(requestHandler: requestHandler) + def jetty = new Server(port) +// def handler = new ServletHandler() +// jetty.setHandler(handler) + + def context = new ServletContextHandler(jetty, '/', ServletContextHandler.SESSIONS) + context.addServlet(new ServletHolder(servlet), '/*') + jetty.start() + } + static Closure ours; +} + +if ( SimpleGroovyServlet.ours == null ) { +SimpleGroovyServlet.run(8878, { -> + response.contentType = 'text/plain' + println "Retrieving ENSEMBL ${params.name}" +// println "my path is ${request.pathInfo}" +// println "my params are $params" + jalview.gui.SequenceFetcher.fetchAndShow("ENSEMBL",""+params.get("name")) +}) +} else { + print "Already running." +} \ No newline at end of file diff --git a/j11lib/jetty-security-9.2.11.v20150529.jar b/j11lib/jetty-security-9.2.11.v20150529.jar new file mode 100644 index 0000000..0d2ac23 Binary files /dev/null and b/j11lib/jetty-security-9.2.11.v20150529.jar differ diff --git a/j11lib/jetty-servlet-9.2.11.v20150529.jar b/j11lib/jetty-servlet-9.2.11.v20150529.jar new file mode 100644 index 0000000..d9fe378 Binary files /dev/null and b/j11lib/jetty-servlet-9.2.11.v20150529.jar differ diff --git a/j8lib/jetty-security-9.2.11.v20150529.jar b/j8lib/jetty-security-9.2.11.v20150529.jar new file mode 100644 index 0000000..0d2ac23 Binary files /dev/null and b/j8lib/jetty-security-9.2.11.v20150529.jar differ diff --git a/j8lib/jetty-servlet-9.2.11.v20150529.jar b/j8lib/jetty-servlet-9.2.11.v20150529.jar new file mode 100644 index 0000000..d9fe378 Binary files /dev/null and b/j8lib/jetty-servlet-9.2.11.v20150529.jar differ