IoT CAS Frameworks/IOT_Server/Server_Admin_Framework/source/ConsumerAPI/src/java/AV_Action/AV_GetMetricUOM.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 metricUOM = null;
        String customer = null;
        String service = null;
        String resourcetype = null;
        String metrictype = null;
        try {
            customer = request.getParameter("customer");
            service = request.getParameter("service");
            resourcetype = request.getParameter("resourcetype");
            metrictype = request.getParameter("metrictype");
            metricUOM = GetMetricUOM.getMetricUOM(request, customer, service, resourcetype, metrictype);
            if (metricUOM == null) {
                log.debug("No data found");
                result.append("{\"error\":\"error\"}");
            } else {
                if (metricUOM.equals("null")) {
                    metricUOM = "[ ]";
                } else {
                    metricUOM = "[" + metricUOM + "]";
                }
                String callback = request.getParameter("callback");
                result.append(callback + "('" + metricUOM + "')");
            }
            System.out.println("Response==>" + result);
        } 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 {
                metricUOM = null;
                customer = null;
                service = null;
                resourcetype = null;
                metrictype = null;
                result = null;
                if (out != null) {
                    out.close();
                    out = null;
                }
            } 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 metricUOM = null;
        String customer = null;
        String service = null;
        String resourcetype = null;
        String metrictype = null;
        try {
            customer = request.getParameter("customer");
            service = request.getParameter("service");
            resourcetype = request.getParameter("resourcetype");
            metrictype = request.getParameter("metrictype");
            metricUOM = GetMetricUOM.getMetricUOM(request, customer, service, resourcetype, metrictype);
            if (metricUOM == null) {
                log.debug("No data found");
                result.append("{\"error\":\"error\"}");
            } else {
                if (metricUOM.equals("null")) {
                    metricUOM = "[ ]";
                } else {
                    metricUOM = "[" + metricUOM + "]";
                }
                String callback = request.getParameter("callback");
                result.append(callback + "('" + metricUOM + "')");
            }
            System.out.println("Response==>" + result);
        } 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 {
                metricUOM = null;
                customer = null;
                service = null;
                resourcetype = null;
                metrictype = null;
                result = null;
                if (out != null) {
                    out.close();
                    out = null;
                }
            } 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 metricUOM = null ; String customer = null ; String service = null ; String resourcetype = null ; String metrictype = null ; try { customer = request . getParameter ( "customer" ) ; service = request . getParameter ( "service" ) ; resourcetype = request . getParameter ( "resourcetype" ) ; metrictype = request . getParameter ( "metrictype" ) ; metricUOM = GetMetricUOM . getMetricUOM ( request , customer , service , resourcetype , metrictype ) ; if ( metricUOM == null ) { log . debug ( "No data found" ) ; result . append ( "{\"error\":\"error\"}" ) ; } else { if ( metricUOM . equals ( "null" ) ) { metricUOM = "[ ]" ; } else { metricUOM = "[" + metricUOM + "]" ; } String callback = request . getParameter ( "callback" ) ; result . append ( callback + "('" + metricUOM + "')" ) ; } System . out . println ( "Response==>" + result ) ; } 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 { metricUOM = null ; customer = null ; service = null ; resourcetype = null ; metrictype = null ; result = null ; if ( out != null ) { out . close ( ) ; out = null ; } } 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 .