@Test public void testBasePath() { assertThat(basePath(new PathMockup(null, "/")), is("/")); assertThat(basePath(new PathMockup("/my/application/path", "/")), is("/my/application/path/")); assertThat(basePath(new PathMockup("/my/application/path", "/path")), is("/my/application/")); assertThat(basePath(new PathMockup("/my/application/path", "/application/path")), is("/my/")); assertThat(basePath(new PathMockup("/my/application/path", "/my/application/path")), is("/")); }
static String basePath(HttpRequest.Path path) { String reqPath = path.toString(); String absPath = path.absolute().toString(); String basePath = absPath.substring(0, absPath.length() - reqPath.length() + 1); if (absPath.isEmpty() || basePath.isEmpty()) { return "/"; } else if (basePath.charAt(basePath.length() - 1) != '/') { return basePath + "/"; } else { return basePath; } }
JerseySupport implements Service { static String basePath(HttpRequest.Path path) { String reqPath = path.toString(); String absPath = path.absolute().toString(); String basePath = absPath.substring(0, absPath.length() - reqPath.length() + 1); if (absPath.isEmpty() || basePath.isEmpty()) { return "/"; } else if (basePath.charAt(basePath.length() - 1) != '/') { return basePath + "/"; } else { return basePath; } } }
JerseySupport implements Service { static String basePath(HttpRequest.Path path) { String reqPath = path.toString(); String absPath = path.absolute().toString(); String basePath = absPath.substring(0, absPath.length() - reqPath.length() + 1); if (absPath.isEmpty() || basePath.isEmpty()) { return "/"; } else if (basePath.charAt(basePath.length() - 1) != '/') { return basePath + "/"; } else { return basePath; } } private  JerseySupport(Builder builder); }
JerseySupport implements Service { static String basePath(HttpRequest.Path path) { String reqPath = path.toString(); String absPath = path.absolute().toString(); String basePath = absPath.substring(0, absPath.length() - reqPath.length() + 1); if (absPath.isEmpty() || basePath.isEmpty()) { return "/"; } else if (basePath.charAt(basePath.length() - 1) != '/') { return basePath + "/"; } else { return basePath; } } private  JerseySupport(Builder builder); @Override void update(Routing.Rules routingRules); void close(); static JerseySupport create(Application application); static Builder builder(); static Builder builder(Application application); }
JerseySupport implements Service { static String basePath(HttpRequest.Path path) { String reqPath = path.toString(); String absPath = path.absolute().toString(); String basePath = absPath.substring(0, absPath.length() - reqPath.length() + 1); if (absPath.isEmpty() || basePath.isEmpty()) { return "/"; } else if (basePath.charAt(basePath.length() - 1) != '/') { return basePath + "/"; } else { return basePath; } } private  JerseySupport(Builder builder); @Override void update(Routing.Rules routingRules); void close(); static JerseySupport create(Application application); static Builder builder(); static Builder builder(Application application); static final String REQUEST_SPAN_CONTEXT; }