REST return Response.temporaryRedirect - Redirect was blocked for CORS request

1.1k views Asked by At

I have the following in REST Java Server side, but I am getting Redirect was blocked for CORS request

How to fix this?

@POST
    @Path("/details")
    public void findDetails(@FormParam("productName")
        String productName, @Context
        HttpServletRequest request, @Context
        HttpServletResponse response) {
        URI location = new java.net.URI("http://www.google.com");


            if (productName != null) {
                return Response.temporaryRedirect(location).build();                    
            }
        }
1

There are 1 answers

0
allu On BEST ANSWER

Shouldn't

productName != null

be

userid != null 

Or rename to

@FormParam("productName") String productName