@Test public void filter_AppPathGiven_ShouldUpdateBaseUri() throws IOException { ContainerRequestContext reqContext = mockRequestContext(EXISTING_BASE_URI, REQUEST_URI); createApplicationPathFilter(new ApplicationPathTest()).filter(reqContext); verify(reqContext, times(1)).setRequestUri(TEST_UPDATED_BASE_URI, REQUEST_URI); verify(reqContext, never()).setRequestUri(any()); }
@Override public void filter(ContainerRequestContext requestContext) throws IOException { String applicationPath = getApplicationPath(); if (applicationPath != null) { UriInfo requestUriInfo = requestContext.getUriInfo(); UriBuilder baseUriBuilder = requestUriInfo.getBaseUriBuilder(); baseUriBuilder.path(applicationPath); baseUriBuilder.path("/"); URI updatedBaseUri = baseUriBuilder.build(); URI requestUri = requestUriInfo.getRequestUri(); requestContext.setRequestUri(updatedBaseUri, requestUri); } }
ApplicationPathFilter implements ContainerRequestFilter { @Override public void filter(ContainerRequestContext requestContext) throws IOException { String applicationPath = getApplicationPath(); if (applicationPath != null) { UriInfo requestUriInfo = requestContext.getUriInfo(); UriBuilder baseUriBuilder = requestUriInfo.getBaseUriBuilder(); baseUriBuilder.path(applicationPath); baseUriBuilder.path("/"); URI updatedBaseUri = baseUriBuilder.build(); URI requestUri = requestUriInfo.getRequestUri(); requestContext.setRequestUri(updatedBaseUri, requestUri); } } }
ApplicationPathFilter implements ContainerRequestFilter { @Override public void filter(ContainerRequestContext requestContext) throws IOException { String applicationPath = getApplicationPath(); if (applicationPath != null) { UriInfo requestUriInfo = requestContext.getUriInfo(); UriBuilder baseUriBuilder = requestUriInfo.getBaseUriBuilder(); baseUriBuilder.path(applicationPath); baseUriBuilder.path("/"); URI updatedBaseUri = baseUriBuilder.build(); URI requestUri = requestUriInfo.getRequestUri(); requestContext.setRequestUri(updatedBaseUri, requestUri); } }  }
ApplicationPathFilter implements ContainerRequestFilter { @Override public void filter(ContainerRequestContext requestContext) throws IOException { String applicationPath = getApplicationPath(); if (applicationPath != null) { UriInfo requestUriInfo = requestContext.getUriInfo(); UriBuilder baseUriBuilder = requestUriInfo.getBaseUriBuilder(); baseUriBuilder.path(applicationPath); baseUriBuilder.path("/"); URI updatedBaseUri = baseUriBuilder.build(); URI requestUri = requestUriInfo.getRequestUri(); requestContext.setRequestUri(updatedBaseUri, requestUri); } }  @Override void filter(ContainerRequestContext requestContext); }
ApplicationPathFilter implements ContainerRequestFilter { @Override public void filter(ContainerRequestContext requestContext) throws IOException { String applicationPath = getApplicationPath(); if (applicationPath != null) { UriInfo requestUriInfo = requestContext.getUriInfo(); UriBuilder baseUriBuilder = requestUriInfo.getBaseUriBuilder(); baseUriBuilder.path(applicationPath); baseUriBuilder.path("/"); URI updatedBaseUri = baseUriBuilder.build(); URI requestUri = requestUriInfo.getRequestUri(); requestContext.setRequestUri(updatedBaseUri, requestUri); } }  @Override void filter(ContainerRequestContext requestContext); static final int PRIORITY; }