IoT CAS Frameworks/IOT_Server/Server_Admin_Framework/source/ConsumerAPI/src/java/AV_Action/AV_GetJsonHostInfo.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 szJsonHost = null;
        try {
            szJsonHost = GetJsonHostInfo.getHostInfo(request);
            if (szJsonHost == null) {
                log.debug("No data found");
                result.append("{\"error\":\"error\"}");
            } else {
                szJsonHost = "[" + szJsonHost + "]";
                String callback = request.getParameter("callback");
                result.append(callback + "('" + szJsonHost + "')");
            }
            System.out.println("Response==>" + result);
        } catch (Exception e) {
            e.printStackTrace();
            log.error("Error while performing action", e);
        }
        try {
            response.getWriter().write(result.toString());
        } catch (Exception e) {
            log.debug("exception while writing output", e);
        } finally {
            try {
                result = null;
                szJsonHost = null;
                if (out != null) {
                    out.close();
                    out = null;
                }
            } catch (NullPointerException npe) {
                npe.printStackTrace();
            } catch (Exception e) {
                e.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 szJsonHost = null;
        try {
            szJsonHost = GetJsonHostInfo.getHostInfo(request);
            if (szJsonHost == null) {
                log.debug("No data found");
                result.append("{\"error\":\"error\"}");
            } else {
                szJsonHost = "[" + szJsonHost + "]";
                String callback = request.getParameter("callback");
                result.append(callback + "('" + szJsonHost + "')");
            }
            System.out.println("Response==>" + result);
        } catch (Exception e) {
            e.printStackTrace();
            log.error("Error while performing action", e);
        }
        try {
            response.getWriter().write(result.toString());
        } catch (Exception e) {
            log.debug("exception while writing output", e);
        } finally {
            try {
                result = null;
                szJsonHost = null;
                if (out != null) {
                    out.close();
                    out = null;
                }
            } catch (NullPointerException npe) {
                npe.printStackTrace();
            } catch (Exception e) {
                e.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 szJsonHost = null ; try { szJsonHost = GetJsonHostInfo . getHostInfo ( request ) ; if ( szJsonHost == null ) { log . debug ( "No data found" ) ; result . append ( "{\"error\":\"error\"}" ) ; } else { szJsonHost = "[" + szJsonHost + "]" ; String callback = request . getParameter ( "callback" ) ; result . append ( callback + "('" + szJsonHost + "')" ) ; } System . out . println ( "Response==>" + result ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; log . error ( "Error while performing action" , e ) ; } try { response . getWriter ( ) . write ( result . toString ( ) ) ; } catch ( Exception e ) { log . debug ( "exception while writing output" , e ) ; } finally { try { result = null ; szJsonHost = null ; if ( out != null ) { out . close ( ) ; out = null ; } } catch ( NullPointerException npe ) { npe . printStackTrace ( ) ; } catch ( Exception e ) { e . 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 .