// Path: opentracing-jaxrs2-itest/common/src/main/java/io/opentracing/contrib/jaxrs2/itest/common/rest/InstrumentedRestApplication.java
// public static class MappedException extends WebApplicationException {
// }


import io.opentracing.Scope;
import io.opentracing.Span;
import io.opentracing.SpanContext;
import io.opentracing.Tracer;
import io.opentracing.contrib.jaxrs2.itest.common.rest.InstrumentedRestApplication.MappedException;
import io.opentracing.noop.NoopTracer;
import java.net.URI;
import java.util.Random;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.client.Client;
import javax.ws.rs.container.AsyncResponse;
import javax.ws.rs.container.Suspended;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.eclipse.microprofile.opentracing.Traced;
import org.junit.Assert;
                } catch (InterruptedException e) {
                    e.printStackTrace();
                } finally {
                    // this exception is not propagated to AsyncListener
                    asyncResponse.resume(new RuntimeException("asyncError"));
                }
            }
        }).start();
    }

    @GET
    @Path("/redirect")
    public Response redirect(@Context HttpServletRequest request) {
        assertActiveSpan();
        String url = String.format("localhost:%d/%s/hello/1", request.getLocalPort(),
            request.getContextPath()).replace("//", "/");
        return Response.seeOther(URI.create("http://" + url)).build();
    }

    @GET
    @Path("/exception")
    public Response exception(@Context HttpServletRequest request) {
        assertActiveSpan();
        throw new IllegalStateException("error");
    }

    @GET
    @Path("/mappedException")
    public Response customException(@Context HttpServletRequest request) {
        assertActiveSpan();
// Path: opentracing-jaxrs2-itest/common/src/main/java/io/opentracing/contrib/jaxrs2/itest/common/rest/InstrumentedRestApplication.java
// public static class MappedException extends WebApplicationException {
// }


// Path: opentracing-jaxrs2-itest/common/src/main/java/io/opentracing/contrib/jaxrs2/itest/common/rest/TestHandler.java
import io.opentracing.Scope;
import io.opentracing.Span;
import io.opentracing.SpanContext;
import io.opentracing.Tracer;
import io.opentracing.contrib.jaxrs2.itest.common.rest.InstrumentedRestApplication.MappedException;
import io.opentracing.noop.NoopTracer;
import java.net.URI;
import java.util.Random;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.client.Client;
import javax.ws.rs.container.AsyncResponse;
import javax.ws.rs.container.Suspended;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.eclipse.microprofile.opentracing.Traced;
import org.junit.Assert;

                } catch (InterruptedException e) {
                    e.printStackTrace();
                } finally {
                    // this exception is not propagated to AsyncListener
                    asyncResponse.resume(new RuntimeException("asyncError"));
                }
            }
        }).start();
    }

    @GET
    @Path("/redirect")
    public Response redirect(@Context HttpServletRequest request) {
        assertActiveSpan();
        String url = String.format("localhost:%d/%s/hello/1", request.getLocalPort(),
            request.getContextPath()).replace("//", "/");
        return Response.seeOther(URI.create("http://" + url)).build();
    }

    @GET
    @Path("/exception")
    public Response exception(@Context HttpServletRequest request) {
        assertActiveSpan();
        throw new IllegalStateException("error");
    }

    @GET
    @Path("/mappedException")
    public Response customException(@Context HttpServletRequest request) {
        assertActiveSpan();
        throw new MappedException();