// Path: completable-future-jaxrs-cdi-cxf/src/main/java/org/iproduct/demo/profiler/server/app/ProfilerApplication.java
// @ApplicationPath("api")
// @ApplicationScoped
// public class ProfilerApplication extends Application {
//     @Inject private StatsRestResource statsRestService;
// //	   @Inject private StatsRestServiceRxJava2 statsRestService;
// 	@Inject private ProcessesRestResource processesRestService;
// 
//     @Override
//     public Set<Object> getSingletons() {
//         final Set<Object> singletons = new HashSet<>();
//         singletons.add(new SseFeature());
//         singletons.add(statsRestService);
//         singletons.add(processesRestService);
//         singletons.add(new JacksonJsonProvider());
//         return singletons; 
//     }
// }


import org.jboss.weld.environment.servlet.BeanManagerResourceBindingListener;
import org.jboss.weld.environment.servlet.Listener;
import java.net.URI;
import javax.ws.rs.core.UriBuilder;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.handler.HandlerList;
import org.eclipse.jetty.servlet.DefaultServlet;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder;
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.servlet.ServletContainer;
import org.iproduct.demo.profiler.server.app.ProfilerApplication;

/**
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements. See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership. The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License. You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied. See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */
package org.iproduct.demo.profiler.server;




//--add-modules=java.se.ee --permit-illegal-access  --patch-module java.xml.ws.annotation=./myannotation.jar

public final class ProfilerStreamingServer {
	private static final URI BASE_URI = UriBuilder.fromUri("http://localhost:8080/rest").port(8080).build();

	public static void main(final String[] args) throws Exception {
		
		final Server server = new Server(8080);
		
		final ServletContainer jerseyServlet = new ServletContainer();
		final ServletHolder jerseyServletHolder = new ServletHolder(jerseyServlet);

// Path: completable-future-jaxrs-cdi-cxf/src/main/java/org/iproduct/demo/profiler/server/app/ProfilerApplication.java
// @ApplicationPath("api")
// @ApplicationScoped
// public class ProfilerApplication extends Application {
//     @Inject private StatsRestResource statsRestService;
// //	   @Inject private StatsRestServiceRxJava2 statsRestService;
// 	@Inject private ProcessesRestResource processesRestService;
// 
//     @Override
//     public Set<Object> getSingletons() {
//         final Set<Object> singletons = new HashSet<>();
//         singletons.add(new SseFeature());
//         singletons.add(statsRestService);
//         singletons.add(processesRestService);
//         singletons.add(new JacksonJsonProvider());
//         return singletons; 
//     }
// }


// Path: completable-future-jaxrs-cdi-jersey/src/main/java/org/iproduct/demo/profiler/server/ProfilerStreamingServer.java
import org.jboss.weld.environment.servlet.BeanManagerResourceBindingListener;
import org.jboss.weld.environment.servlet.Listener;
import java.net.URI;
import javax.ws.rs.core.UriBuilder;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.handler.HandlerList;
import org.eclipse.jetty.servlet.DefaultServlet;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder;
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.servlet.ServletContainer;
import org.iproduct.demo.profiler.server.app.ProfilerApplication;

/**
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements. See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership. The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License. You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied. See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */
package org.iproduct.demo.profiler.server;




//--add-modules=java.se.ee --permit-illegal-access  --patch-module java.xml.ws.annotation=./myannotation.jar

public final class ProfilerStreamingServer {
	private static final URI BASE_URI = UriBuilder.fromUri("http://localhost:8080/rest").port(8080).build();

	public static void main(final String[] args) throws Exception {
		
		final Server server = new Server(8080);
		
		final ServletContainer jerseyServlet = new ServletContainer();
		final ServletHolder jerseyServletHolder = new ServletHolder(jerseyServlet);

		jerseyServletHolder.setInitParameter("javax.ws.rs.Application", ProfilerApplication.class.getName());
