views:

24

answers:

0

I have a resource .../releases/343/file/21 Depending from where the user access the resource I need to implement a geo balancing mechanism, so I redirect him to a static web server or another. I have something like this :

   URI uri; 
   if( is_near(user, us) )
        uri = URI.create("http://us.static.myserver.com/myfile.tar.gz");
   else 
        uri = URI.create("http://default.static.myserver.com/myfile.tar.gz");

   return Response.
        status(300).entity(new Viewable("/geomirror.jsp")).
            location(uri).
              build();

I've added .entity(new Viewable("/geomirror.jsp")) because some browsers don't interpret correct the 300 http response. geomirror.jsp contains links to that two static servers My question is : Is this a good solution ? Can you show other methods ?