Source:
<code>protected Handler createAppServlet(Server server, JerseyEnvironment jersey, ObjectMapper objectMapper, Validator validator, MutableServletContextHandler handler, @Nullable Servlet jerseyContainer, MetricRegistry metricRegistry) { configureSessionsAndSecurity(handler, server); handler.addFilter(AllowedMethodsFilter.class, "/*", EnumSet.of(DispatcherType.REQUEST)) .setInitParameter(AllowedMethodsFilter.ALLOWED_METHODS_PARAM, Joiner.on(',').join(allowedMethods)); handler.addFilter(ThreadNameFilter.class, "/*", EnumSet.of(DispatcherType.REQUEST)); if (gzip.isEnabled()) { final FilterHolder holder = new FilterHolder(gzip.build()); handler.addFilter(holder, "/*", EnumSet.allOf(DispatcherType.class)); } if (jerseyContainer != null) { String urlPattern = jerseyRootPath; <START> if (!urlPattern.endsWith("/")) { <END> urlPattern += "/"; } if (!urlPattern.endsWith("*")) { urlPattern += "*"; } jersey.setUrlPattern(urlPattern); jersey.register(new JacksonMessageBodyProvider(objectMapper, validator)); if (registerDefaultExceptionMappers == null || registerDefaultExceptionMappers) { jersey.register(new LoggingExceptionMapper<Throwable>() { }); jersey.register(new ConstraintViolationExceptionMapper()); jersey.register(new JsonProcessingExceptionMapper()); jersey.register(new EarlyEofExceptionMapper()); } handler.addServlet(new NonblockingServletHolder(jerseyContainer), jersey.getUrlPattern()); } final InstrumentedHandler instrumented = new InstrumentedHandler(metricRegistry); instrumented.setServer(server); instrumented.setHandler(handler); return instrumented; }</code><technical_language>reading this wrong, if user provide a rootPath \* this add another /, add another *. add slash if ends *</technical_language>

Target:
protected Handler createAppServlet(Server server, JerseyEnvironment jersey, ObjectMapper objectMapper, Validator validator, MutableServletContextHandler handler, @Nullable Servlet jerseyContainer, MetricRegistry metricRegistry) { configureSessionsAndSecurity(handler, server); handler.addFilter(AllowedMethodsFilter.class, "/*", EnumSet.of(DispatcherType.REQUEST)) .setInitParameter(AllowedMethodsFilter.ALLOWED_METHODS_PARAM, Joiner.on(',').join(allowedMethods)); handler.addFilter(ThreadNameFilter.class, "/*", EnumSet.of(DispatcherType.REQUEST)); if (gzip.isEnabled()) { final FilterHolder holder = new FilterHolder(gzip.build()); handler.addFilter(holder, "/*", EnumSet.allOf(DispatcherType.class)); } if (jerseyContainer != null) { String urlPattern = jerseyRootPath; if (!urlPattern.endsWith("*") && !urlPattern.endsWith("/")) { urlPattern += "/"; } if (!urlPattern.endsWith("*")) { urlPattern += "*"; } jersey.setUrlPattern(urlPattern); jersey.register(new JacksonMessageBodyProvider(objectMapper, validator)); if (registerDefaultExceptionMappers == null || registerDefaultExceptionMappers) { jersey.register(new LoggingExceptionMapper<Throwable>() { }); jersey.register(new ConstraintViolationExceptionMapper()); jersey.register(new JsonProcessingExceptionMapper()); jersey.register(new EarlyEofExceptionMapper()); } handler.addServlet(new NonblockingServletHolder(jerseyContainer), jersey.getUrlPattern()); } final InstrumentedHandler instrumented = new InstrumentedHandler(metricRegistry); instrumented.setServer(server); instrumented.setHandler(handler); return instrumented; }