class RedirectResourceFilter implements ContainerRequestFilter {

    @Override
    public void filter(ContainerRequestContext requestContext) throws IOException {
        final UriInfo uriInfo = requestContext.getUriInfo();

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

            URI redirectTo = builder.build();
            requestContext.setRequestUri(uriInfo.getBaseUri(), redirectTo);
        }
    }

}