@Test public void filter_PrefixedProxyResourceGiven_ShouldNotUpdateBaseUri() throws IOException { DynamicProxyBasePathFilter filter = createFilter("/base-path/{proxy+}"); ContainerRequestContext containerRequest = createContainerRequest("/", "/whatever"); filter.filter(containerRequest); verify(containerRequest).setRequestUri(URI.create("/base-path/"), URI.create("/whatever")); }
@Override public void filter(ContainerRequestContext requestContext) throws IOException { String dynamicApplicationPath = getDynamicBasePath(); if (dynamicApplicationPath != null && !dynamicApplicationPath.isEmpty()) { UriInfo uriInfo = requestContext.getUriInfo(); URI baseUri = uriInfo.getBaseUriBuilder() .path(dynamicApplicationPath) .path("/") .build(); URI requestUri = uriInfo.getRequestUri(); requestContext.setRequestUri(baseUri, requestUri); } }
DynamicProxyBasePathFilter implements ContainerRequestFilter { @Override public void filter(ContainerRequestContext requestContext) throws IOException { String dynamicApplicationPath = getDynamicBasePath(); if (dynamicApplicationPath != null && !dynamicApplicationPath.isEmpty()) { UriInfo uriInfo = requestContext.getUriInfo(); URI baseUri = uriInfo.getBaseUriBuilder() .path(dynamicApplicationPath) .path("/") .build(); URI requestUri = uriInfo.getRequestUri(); requestContext.setRequestUri(baseUri, requestUri); } } }
DynamicProxyBasePathFilter implements ContainerRequestFilter { @Override public void filter(ContainerRequestContext requestContext) throws IOException { String dynamicApplicationPath = getDynamicBasePath(); if (dynamicApplicationPath != null && !dynamicApplicationPath.isEmpty()) { UriInfo uriInfo = requestContext.getUriInfo(); URI baseUri = uriInfo.getBaseUriBuilder() .path(dynamicApplicationPath) .path("/") .build(); URI requestUri = uriInfo.getRequestUri(); requestContext.setRequestUri(baseUri, requestUri); } }  }
DynamicProxyBasePathFilter implements ContainerRequestFilter { @Override public void filter(ContainerRequestContext requestContext) throws IOException { String dynamicApplicationPath = getDynamicBasePath(); if (dynamicApplicationPath != null && !dynamicApplicationPath.isEmpty()) { UriInfo uriInfo = requestContext.getUriInfo(); URI baseUri = uriInfo.getBaseUriBuilder() .path(dynamicApplicationPath) .path("/") .build(); URI requestUri = uriInfo.getRequestUri(); requestContext.setRequestUri(baseUri, requestUri); } }  @Override void filter(ContainerRequestContext requestContext); }
DynamicProxyBasePathFilter implements ContainerRequestFilter { @Override public void filter(ContainerRequestContext requestContext) throws IOException { String dynamicApplicationPath = getDynamicBasePath(); if (dynamicApplicationPath != null && !dynamicApplicationPath.isEmpty()) { UriInfo uriInfo = requestContext.getUriInfo(); URI baseUri = uriInfo.getBaseUriBuilder() .path(dynamicApplicationPath) .path("/") .build(); URI requestUri = uriInfo.getRequestUri(); requestContext.setRequestUri(baseUri, requestUri); } }  @Override void filter(ContainerRequestContext requestContext);  }