Launch Jetty 9 programmatically

Does anyone know how to run Jetty9 with a simple core in a Java class ??? For example, I saw programs such as:

public static void main(String[] args) throws Exception { Server server = new Server(8080); WebAppContext webAppContext = new WebAppContext("./src/main/webapp", "/recruiting"); webAppContext.setLogUrlOnStart(true); webAppContext.setInitParameter(ContextLoader.CONTEXT_CLASS_PARAM, RecruitingAppContext.class.getName()); webAppContext.addServlet(DispatcherServlet.class, "/"); webAppContext.setWelcomeFiles(new String[]{"index.jsp"}); webAppContext.addEventListener(new RequestContextListener()); webAppContext.configure(); server.setHandler(webAppContext); server.start(); System.out.println("Server started"); server.join(); } 

But I still could not successfully launch Jetty9. Anyway, I'm trying to do this with spring. Someone let me see some examples to do this ??? Thank you very much: -)

+6
source share
1 answer

I just documented one of our examples a couple of weeks ago. We will document more of our examples and add some of them as we receive requests and how people present their own ...

in any case, this should make you :)

http://www.eclipse.org/jetty/documentation/current/embedded-examples.html#embedded-one-webapp

+9
source

Source: https://habr.com/ru/post/947365/


All Articles