class RedirectResourceFilter implements ContainerRequestFilter {

    @Override
    public ContainerRequest filter(ContainerRequest containerRequest) {

        if(containerRequest.getPath().equals("controller")){
            UriBuilder builder = UriBuilder.fromUri(containerRequest.getBaseUri())
                    .path(SiteToSiteResource.class)
                    .replaceQuery(containerRequest.getRequestUri().getRawQuery());

            URI redirectTo = builder.build();
            containerRequest.setUris(containerRequest.getBaseUri(), redirectTo);
        }
        return containerRequest;
    }

}