Response.seeOther returns a blank screen

I need to redirect to a specific external url in my jersey web service.

and I use this method:

    public static Response redirectTo(String path) {
    URI uri;
    try {
        uri = new URI(path);
        return Response.seeOther(uri).build();
    } catch (URISyntaxException e) {
        e.printStackTrace();
        return null;
    }
}

But it goes to the white screen page, not to stackoverflow.com.

Why is this happening and how to fix it?

This method is called inside this method.

@GET
    @Path("/login")
    @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
    public Response login(@Context UriInfo info, @Context HttpServletRequest request) {
...
String url = "http://stackoverflow.com";
redirectTo(url); 
}

The login method URL is called when an event is triggered from AppDirect (via a browser)

+4
source share
1 answer

In the end, I added the @Context HttpServletResponseres parameter to my method and named this methodres.sendRedirect(urlApp);

This works as expected.

+1
source

All Articles