import java.io.IOException;
import java.io.PrintWriter;
import java.util.*;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class RandomRedirectServlet extends HttpServlet
{
	List l= new ArrayList();
	public void init()
	{
		l.add("http://www.Devmanuals.com");
		l.add("http://www.facebook.com");
		l.add("http://www.Google.com");
		l.add("http://www.rediffmail.com");
		l.add("http://www.gmail.com");
	}
	public void doGet(HttpServletRequest req, HttpServletResponse res)
		throws IOException, ServletException
		{
		res.setContentType("text/html");
		Random rndm = new Random();
		int listIndex = ((int)(Math.random()*l.size()));
		String site = (String)l.get(listIndex);
		res.setStatus(res.SC_MOVED_TEMPORARILY);
		res.setHeader("Location", site);
		}
}
