MapBusesRoute/src/java/src/GetRoute.java
/**
     * Processes requests for both HTTP <code>GET</code> and <code>POST</code>
     * methods.
     *
     * @param request servlet request
     * @param response servlet response
     * @throws ServletException if a servlet-specific error occurs
     * @throws IOException if an I/O error occurs
     */
Processes requests for both HTTP GET and POST
methods.

@param request servlet request
@param response servlet response
@throws ServletException if a servlet-specific error occurs
@throws IOException if an I/O error occurs
Processes requests for both HTTP GET and POST methods . @param request servlet request @param response servlet response @throws ServletException if a servlet - specific error occurs @throws IOException if an I / O error occurs
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        /*String routenumber = request.getParameter("text");
        ArrayList<BangaloreBusInfo> send=new ArrayList<BangaloreBusInfo>();
        ForBangalore fbr=new ForBangalore();
        ArrayList<ArrayList<String>> temp=fbr.bangaloreRouteData(routenumber);
        ArrayList<String> one=temp.get(0);
        ArrayList<String> two=temp.get(1);
        ArrayList<String> three=temp.get(2);
        for(int i=0;i<one.size();i++)
        {
            BangaloreBusInfo b=new BangaloreBusInfo(one.get(i), Double.parseDouble(two.get(i)), Double.parseDouble(three.get(i)));
            send.add(b);
            System.out.println(one.get(i));
        }
        request.setAttribute("send", send);
        request.getRequestDispatcher("ShowLineRoute.jsp").forward(request, response);*/
        TweetDisplay tl=new TweetDisplay();
        ArrayList<TweetInfo> tweetListSend=tl.getTweetDetail();
        String tweetHourlyCount=tl.getHourlyCount();
        request.setAttribute("tweetListSend", tweetListSend);
        request.setAttribute("tweetHourlyCount", tweetHourlyCount);
        request.getRequestDispatcher("Mainpage.jsp").forward(request, response);
        /*
        try {
            ArrayList<LatLong> send=new ArrayList<LatLong>();
            String routenumber = request.getParameter("text");
            BusData b = new BusData();
            ArrayList<String> al = b.getPoints(routenumber);
            for (String str : al) {
                str = str + " bus stop,delhi";
                String url = "https://maps.googleapis.com/maps/api/geocode/json?address=" + URLEncoder.encode(str) + "&sensor=false&key=AIzaSyC-SQ14QC6ZcilMloviU-KPU-EfmA8qnlY";
                URL url1=new URL(url);
                System.out.println(url);
                StringBuffer text = new StringBuffer();
                HttpURLConnection conn = (HttpURLConnection) url1.openConnection();
                conn.connect();
                InputStreamReader in = new InputStreamReader((InputStream) conn.getContent());
                BufferedReader buff = new BufferedReader(in);
                String st1 = buff.readLine();
                while (st1 != null) {
                    text.append(st1);
                    st1 = buff.readLine();
                }
                String data = text.toString();
                Object obj = JSONValue.parse(data);
                JSONObject jso = (JSONObject) obj;
                JSONArray arr1 = (JSONArray) jso.get("results");
                if(arr1.size()<=2)
                {
                String data1 = arr1.get(0).toString();
                Object obj1 = JSONValue.parse(data1);
                JSONObject jso1 = (JSONObject) obj1;
                String address_updated = jso1.get("formatted_address").toString();
                //System.out.println(address_updated);
                String data2 = jso1.get("geometry").toString();
                Object obj2 = JSONValue.parse(data2);
                JSONObject jso2 = (JSONObject) obj2;
                String data3 = jso2.get("location").toString();
                Object obj3 = JSONValue.parse(data3);
                JSONObject jso3 = (JSONObject) obj3;
                double lat = Double.parseDouble(jso3.get("lat").toString());
                double lng = Double.parseDouble(jso3.get("lng").toString());
                System.out.println(lat+"   "+lng);
                send.add(new LatLong(lat, lng));
                }
            }
            System.out.println(al);
            request.setAttribute("al", al);
            request.setAttribute("send", send);
            request.getRequestDispatcher("ShowLineRoute.jsp").forward(request, response);
        } catch (Exception ex) {
            Logger.getLogger(GetRoute.class.getName()).log(Level.SEVERE, null, ex);
        }*/
    }
protected void processRequest ( HttpServletRequest request , HttpServletResponse response ) throws ServletException , IOException { /*String routenumber = request.getParameter("text");
        ArrayList<BangaloreBusInfo> send=new ArrayList<BangaloreBusInfo>();
        ForBangalore fbr=new ForBangalore();
        ArrayList<ArrayList<String>> temp=fbr.bangaloreRouteData(routenumber);
        ArrayList<String> one=temp.get(0);
        ArrayList<String> two=temp.get(1);
        ArrayList<String> three=temp.get(2);
        for(int i=0;i<one.size();i++)
        {
            BangaloreBusInfo b=new BangaloreBusInfo(one.get(i), Double.parseDouble(two.get(i)), Double.parseDouble(three.get(i)));
            send.add(b);
            System.out.println(one.get(i));
        }
        request.setAttribute("send", send);
        request.getRequestDispatcher("ShowLineRoute.jsp").forward(request, response);*/ TweetDisplay tl = new TweetDisplay ( ) ; ArrayList < TweetInfo > tweetListSend = tl . getTweetDetail ( ) ; String tweetHourlyCount = tl . getHourlyCount ( ) ; request . setAttribute ( "tweetListSend" , tweetListSend ) ; request . setAttribute ( "tweetHourlyCount" , tweetHourlyCount ) ; request . getRequestDispatcher ( "Mainpage.jsp" ) . forward ( request , response ) ; /*
        try {
            ArrayList<LatLong> send=new ArrayList<LatLong>();
            String routenumber = request.getParameter("text");
            BusData b = new BusData();
            ArrayList<String> al = b.getPoints(routenumber);
            for (String str : al) {
                str = str + " bus stop,delhi";
                String url = "https://maps.googleapis.com/maps/api/geocode/json?address=" + URLEncoder.encode(str) + "&sensor=false&key=AIzaSyC-SQ14QC6ZcilMloviU-KPU-EfmA8qnlY";
                URL url1=new URL(url);
                System.out.println(url);
                StringBuffer text = new StringBuffer();
                HttpURLConnection conn = (HttpURLConnection) url1.openConnection();
                conn.connect();
                InputStreamReader in = new InputStreamReader((InputStream) conn.getContent());
                BufferedReader buff = new BufferedReader(in);
                String st1 = buff.readLine();
                while (st1 != null) {
                    text.append(st1);
                    st1 = buff.readLine();
                }
                String data = text.toString();
                Object obj = JSONValue.parse(data);
                JSONObject jso = (JSONObject) obj;
                JSONArray arr1 = (JSONArray) jso.get("results");
                if(arr1.size()<=2)
                {
                String data1 = arr1.get(0).toString();
                Object obj1 = JSONValue.parse(data1);
                JSONObject jso1 = (JSONObject) obj1;
                String address_updated = jso1.get("formatted_address").toString();
                //System.out.println(address_updated);
                String data2 = jso1.get("geometry").toString();
                Object obj2 = JSONValue.parse(data2);
                JSONObject jso2 = (JSONObject) obj2;
                String data3 = jso2.get("location").toString();
                Object obj3 = JSONValue.parse(data3);
                JSONObject jso3 = (JSONObject) obj3;
                double lat = Double.parseDouble(jso3.get("lat").toString());
                double lng = Double.parseDouble(jso3.get("lng").toString());
                System.out.println(lat+"   "+lng);
                send.add(new LatLong(lat, lng));
                }
                
            }
            System.out.println(al);
            request.setAttribute("al", al);
            request.setAttribute("send", send);
            request.getRequestDispatcher("ShowLineRoute.jsp").forward(request, response);
        } catch (Exception ex) {
            Logger.getLogger(GetRoute.class.getName()).log(Level.SEVERE, null, ex);
        }*/ }
Processes requests for both HTTP <code>GET</code> and <code>POST</code>
 methods.
Processes requests for both HTTP <code > GET< / code > and <code > POST< / code > methods .
//ForMumbai fr=new ForMumbai(); //String routenumber = request.getParameter("text"); //ArrayList<MumbaiBusInfo> send=fr.main(routenumber); //request.setAttribute("send", send);