IoT CAS Frameworks/IOT_Server/Server_Admin_Framework/source/ConsumerAPI/src/java/AV_Action/AV_GetServices.java
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        response.setContentType("application/json;charset=UTF-8");
        PrintWriter out = response.getWriter();
        StringBuffer result = new StringBuffer();
        String servInfo = null;
        String customer = null;
        try {
            customer = request.getParameter("customer");
            Connection con = DatabaseConnection.getAVSAConnection(request);
            servInfo=new DeviceManagment().getServices(con, customer);
            
            
            if (servInfo == null) {
                log.debug("No data found");
                result.append("{\"error\":\"error\"}");
            } 
            /* Commented By ananddw
            servInfo = GetServices.getInstallationsInfo(request, customer);
            if (servInfo == null) {
                log.debug("No data found");
                result.append("{\"error\":\"error\"}");
            } else {
                if (servInfo.equals("null")) {
                    servInfo = "[]";
                } else {
                    servInfo = "[" + servInfo + "]";
                }
                }
            */
                String callback = request.getParameter("callback");
                result.append(callback + "('" + servInfo + "')");
            
            //System.out.println("Response==>>" + result);
            con.close();
        } catch (Exception ex) {
            ex.printStackTrace();
            log.error("Error while performing action", ex);
        }
        try {
            response.getWriter().write(result.toString());
        } catch (Exception ex) {
            log.debug("exception while writing output", ex);
        } finally {
            try {
                if (result != null) {
                    result = null;
                }
                if (servInfo != null) {
                    servInfo = null;
                }
                if (customer != null) {
                    customer = null;
                }
                if (out != null) {
                    out.close();
                }
            } catch (NullPointerException npe) {
                npe.printStackTrace();
            } catch (Exception ex) {
                ex.printStackTrace();
            }
        }
    }
/**
     * 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 {
        response.setContentType("application/json;charset=UTF-8");
        PrintWriter out = response.getWriter();
        StringBuffer result = new StringBuffer();
        String servInfo = null;
        String customer = null;
        try {
            customer = request.getParameter("customer");
            Connection con = DatabaseConnection.getAVSAConnection(request);
            servInfo=new DeviceManagment().getServices(con, customer);
            if (servInfo == null) {
                log.debug("No data found");
                result.append("{\"error\":\"error\"}");
            } 
            /* Commented By ananddw
            servInfo = GetServices.getInstallationsInfo(request, customer);
            if (servInfo == null) {
                log.debug("No data found");
                result.append("{\"error\":\"error\"}");
            } else {
                if (servInfo.equals("null")) {
                    servInfo = "[]";
                } else {
                    servInfo = "[" + servInfo + "]";
                }
                }
            */
                String callback = request.getParameter("callback");
                result.append(callback + "('" + servInfo + "')");
            con.close();
        } catch (Exception ex) {
            ex.printStackTrace();
            log.error("Error while performing action", ex);
        }
        try {
            response.getWriter().write(result.toString());
        } catch (Exception ex) {
            log.debug("exception while writing output", ex);
        } finally {
            try {
                if (result != null) {
                    result = null;
                }
                if (servInfo != null) {
                    servInfo = null;
                }
                if (customer != null) {
                    customer = null;
                }
                if (out != null) {
                    out.close();
                }
            } catch (NullPointerException npe) {
                npe.printStackTrace();
            } catch (Exception ex) {
                ex.printStackTrace();
            }
        }
    }
protected void processRequest ( HttpServletRequest request , HttpServletResponse response ) throws ServletException , IOException { response . setContentType ( "application/json;charset=UTF-8" ) ; PrintWriter out = response . getWriter ( ) ; StringBuffer result = new StringBuffer ( ) ; String servInfo = null ; String customer = null ; try { customer = request . getParameter ( "customer" ) ; Connection con = DatabaseConnection . getAVSAConnection ( request ) ; servInfo = new DeviceManagment ( ) . getServices ( con , customer ) ; if ( servInfo == null ) { log . debug ( "No data found" ) ; result . append ( "{\"error\":\"error\"}" ) ; } /* Commented By ananddw
            servInfo = GetServices.getInstallationsInfo(request, customer);
            if (servInfo == null) {
                log.debug("No data found");
                result.append("{\"error\":\"error\"}");
            } else {
                if (servInfo.equals("null")) {
                    servInfo = "[]";
                } else {
                    servInfo = "[" + servInfo + "]";
                }
                }
            */ String callback = request . getParameter ( "callback" ) ; result . append ( callback + "('" + servInfo + "')" ) ; con . close ( ) ; } catch ( Exception ex ) { ex . printStackTrace ( ) ; log . error ( "Error while performing action" , ex ) ; } try { response . getWriter ( ) . write ( result . toString ( ) ) ; } catch ( Exception ex ) { log . debug ( "exception while writing output" , ex ) ; } finally { try { if ( result != null ) { result = null ; } if ( servInfo != null ) { servInfo = null ; } if ( customer != null ) { customer = null ; } if ( out != null ) { out . close ( ) ; } } catch ( NullPointerException npe ) { npe . printStackTrace ( ) ; } catch ( Exception ex ) { ex . printStackTrace ( ) ; } } }
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 .
//System.out.println("Response==>>" + result);