// Path: opentracing-jaxrs2-itest/common/src/main/java/io/opentracing/contrib/jaxrs2/itest/common/rest/InstrumentedRestApplication.java
// public class InstrumentedRestApplication extends Application {
// 
//     private Client client;
//     private Tracer tracer;
//     private ServerTracingDynamicFeature serverTracingFeature;
// 
//     public InstrumentedRestApplication(@Context ServletContext context) {
//         this.serverTracingFeature = (ServerTracingDynamicFeature) context.getAttribute(
//                 AbstractJettyTest.SERVER_TRACING_FEATURE);
//         this.client = (Client) context.getAttribute(AbstractJettyTest.CLIENT_ATTRIBUTE);
//         this.tracer = (Tracer) context.getAttribute(AbstractJettyTest.TRACER_ATTRIBUTE);
// 
//         if (serverTracingFeature == null || client == null || tracer == null) {
//             throw new IllegalArgumentException("Instrumented application is not initialized correctly. serverTracing:"
//                     + serverTracingFeature + ", clientTracing: " + client);
//         }
//     }
// 
//     @Override
//     public Set<Object> getSingletons() {
//         Set<Object> objects = new HashSet<>();
// 
//         objects.add(serverTracingFeature);
//         objects.add(new TestHandler(tracer, client));
//         objects.add(new DisabledTestHandler(tracer));
//         objects.add(new ServicesImpl());
//         objects.add(new ServicesImplOverrideClassPath());
//         objects.add(new ServicesImplOverrideMethodPath());
//         objects.add(new DenyFilteredFeature());
//         objects.add(new MappedExceptionMapper());
// 
//         return Collections.unmodifiableSet(objects);
//     }
// 
//     /**
//      * A dynamic feature that introduces a request filter denying all requests to "filtered"
//      * endpoints.
//      *
//      * @author Maxime Petazzoni
//      */
//     private static final class DenyFilteredFeature implements DynamicFeature {
//         @Override
//         public void configure(ResourceInfo resourceInfo, FeatureContext context) {
//             context.register(new ContainerRequestFilter() {
//                 @Override
//                 public void filter(ContainerRequestContext requestContext) throws IOException {
//                     if (requestContext.getUriInfo().getPath().endsWith("filtered")) {
//                         throw new ForbiddenException();
//                     }
//                 }
//             }, Priorities.AUTHORIZATION);
//         }
//     }
// 
//     public static class MappedException extends WebApplicationException {
//     }
// 
//     private static class MappedExceptionMapper implements ExceptionMapper<MappedException> {
//         @Override
//         public Response toResponse(MappedException exception) {
//             return Response.status(405).build();
//         }
//     }
// }


import io.opentracing.contrib.jaxrs2.itest.common.rest.InstrumentedRestApplication;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder;
package io.opentracing.contrib.jaxrs2.itest.resteasy;


/**
 * @author Pavol Loffay
 */
public class RestEasyHelper {

    public static void initServletContext(ServletContextHandler context) {
        ServletHolder restEasyServlet = context.addServlet(
                org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.class, "/*");
        restEasyServlet.setInitOrder(0);

        restEasyServlet.setInitParameter(
// Path: opentracing-jaxrs2-itest/common/src/main/java/io/opentracing/contrib/jaxrs2/itest/common/rest/InstrumentedRestApplication.java
// public class InstrumentedRestApplication extends Application {
// 
//     private Client client;
//     private Tracer tracer;
//     private ServerTracingDynamicFeature serverTracingFeature;
// 
//     public InstrumentedRestApplication(@Context ServletContext context) {
//         this.serverTracingFeature = (ServerTracingDynamicFeature) context.getAttribute(
//                 AbstractJettyTest.SERVER_TRACING_FEATURE);
//         this.client = (Client) context.getAttribute(AbstractJettyTest.CLIENT_ATTRIBUTE);
//         this.tracer = (Tracer) context.getAttribute(AbstractJettyTest.TRACER_ATTRIBUTE);
// 
//         if (serverTracingFeature == null || client == null || tracer == null) {
//             throw new IllegalArgumentException("Instrumented application is not initialized correctly. serverTracing:"
//                     + serverTracingFeature + ", clientTracing: " + client);
//         }
//     }
// 
//     @Override
//     public Set<Object> getSingletons() {
//         Set<Object> objects = new HashSet<>();
// 
//         objects.add(serverTracingFeature);
//         objects.add(new TestHandler(tracer, client));
//         objects.add(new DisabledTestHandler(tracer));
//         objects.add(new ServicesImpl());
//         objects.add(new ServicesImplOverrideClassPath());
//         objects.add(new ServicesImplOverrideMethodPath());
//         objects.add(new DenyFilteredFeature());
//         objects.add(new MappedExceptionMapper());
// 
//         return Collections.unmodifiableSet(objects);
//     }
// 
//     /**
//      * A dynamic feature that introduces a request filter denying all requests to "filtered"
//      * endpoints.
//      *
//      * @author Maxime Petazzoni
//      */
//     private static final class DenyFilteredFeature implements DynamicFeature {
//         @Override
//         public void configure(ResourceInfo resourceInfo, FeatureContext context) {
//             context.register(new ContainerRequestFilter() {
//                 @Override
//                 public void filter(ContainerRequestContext requestContext) throws IOException {
//                     if (requestContext.getUriInfo().getPath().endsWith("filtered")) {
//                         throw new ForbiddenException();
//                     }
//                 }
//             }, Priorities.AUTHORIZATION);
//         }
//     }
// 
//     public static class MappedException extends WebApplicationException {
//     }
// 
//     private static class MappedExceptionMapper implements ExceptionMapper<MappedException> {
//         @Override
//         public Response toResponse(MappedException exception) {
//             return Response.status(405).build();
//         }
//     }
// }


// Path: opentracing-jaxrs2-itest/resteasy/src/test/java/io/opentracing/contrib/jaxrs2/itest/resteasy/RestEasyHelper.java
import io.opentracing.contrib.jaxrs2.itest.common.rest.InstrumentedRestApplication;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder;

package io.opentracing.contrib.jaxrs2.itest.resteasy;


/**
 * @author Pavol Loffay
 */
public class RestEasyHelper {

    public static void initServletContext(ServletContextHandler context) {
        ServletHolder restEasyServlet = context.addServlet(
                org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.class, "/*");
        restEasyServlet.setInitOrder(0);

        restEasyServlet.setInitParameter(
                "javax.ws.rs.Application", InstrumentedRestApplication.class.getCanonicalName());