Package com.ajjpj.asysmon.util

Examples of com.ajjpj.asysmon.util.AJsonSerHelper


        serveStaticResource("asysmon-aggregated.html", resp);
    }

    private void serveData(HttpServletResponse resp) throws IOException {
        final AJsonSerHelper json = new AJsonSerHelper(resp.getOutputStream());

        json.startObject();

        json.writeKey("title");
        json.writeStringLiteral(getTitle());
        json.writeKey("isStarted");
        json.writeBooleanLiteral(isStarted());

        json.writeKey("scalars");
        json.startObject();
        for(AScalarDataPoint scalar: getSysMon().getScalarMeasurements().values()) {
            writeScalar(json, scalar);
        }
        json.endObject();

        json.writeKey("columnDefs");
        json.startArray();
        for(ColDef colDef: getColDefs()) {
            writeColDef(json, colDef);
        }
        json.endArray();

        json.writeKey("traces");
        json.startArray();
        for(TreeNode n: getData()) {
            writeDataNode(json, n);
        }
        json.endArray();

        json.endObject();
    }
View Full Code Here


        serveStaticResource("asysmon-aggregated.html", resp);
    }

    private void serveData(HttpServletResponse resp) throws IOException {
        final AJsonSerHelper json = new AJsonSerHelper(resp.getOutputStream());

        json.startObject();

        json.writeKey("title");
        json.writeStringLiteral(getTitle());
        json.writeKey("isStarted");
        json.writeBooleanLiteral(isStarted());

        json.writeKey("scalars");
        json.startObject();
        for(AScalarDataPoint scalar: getSysMon().getScalarMeasurements().values()) {
            writeScalar(json, scalar);
        }
        json.endObject();

        json.writeKey("columnDefs");
        json.startArray();
        for(ColDef colDef: getColDefs()) {
            writeColDef(json, colDef);
        }
        json.endArray();

        json.writeKey("traces");
        json.startArray();
        for(TreeNode n: getData()) {
            writeDataNode(json, n);
        }
        json.endArray();

        json.endObject();
    }
View Full Code Here

    @Override public InputStream getContent() throws IOException, IllegalStateException {
        throw new UnsupportedOperationException();
    }

    @Override public void writeTo(OutputStream outstream) throws IOException {
        final AJsonSerHelper ser = new AJsonSerHelper(outstream);

        ser.startObject(); // start 'RootNode'

        ser.writeKey("sender");
        ser.writeStringLiteral(sender);

        ser.writeKey("senderInstance");
        ser.writeStringLiteral(senderInstance);

        ser.writeKey("senderTimestamp");
        ser.writeNumberLiteral(System.currentTimeMillis(), 0);

        ser.writeKey("traces");
        ser.startArray();
        for(AHierarchicalDataRoot trace: traces) {
            writeTraceRoot(ser, trace);
        }
        ser.endArray();

        ser.writeKey("scalars");
        ser.startArray();
        for(AScalarDataPoint scalar: scalarData) {
            writeScalar(ser, scalar);
        }
        ser.endArray();

        ser.endObject();
    }
View Full Code Here

    @Override protected String getDefaultHtmlName() {
        return "asysmon.html";
    }

    @Override protected boolean handleRestCall(List<String> restParams, HttpServletResponse resp) throws Exception {
        final AJsonSerHelper json = new AJsonSerHelper(resp.getOutputStream());

        final String pageId = restParams.remove(0);
        final String service = restParams.remove(0);

        final APresentationPageDefinition pageDef = pageDefs.get(pageId);
View Full Code Here

        final ServletOutputStream out = resp.getOutputStream();

        out.print("angular.module('ASysMonApp').constant('configRaw', ");
        out.flush();

        final AJsonSerHelper json = new AJsonSerHelper(out);
        json.startObject();

        json.writeKey("applicationId");
        json.writeStringLiteral(config.appInfo.getApplicationName());

        json.writeKey("applicationDeployment");
        json.writeStringLiteral(config.appInfo.getDeployment());

        json.writeKey("applicationNode");
        json.writeStringLiteral(config.appInfo.getNodeId());

        json.writeKey("applicationVersion");
        json.writeStringLiteral(config.appInfo.getVersion());

        json.writeKey("applicationInstanceHtmlColorCode");
        json.writeStringLiteral(config.appInfo.getHtmlColorCode());

        json.writeKey("defaultPage");
        json.writeStringLiteral(config.defaultPage);

        json.writeKey("menuEntries");
        json.startArray();
        for(APresentationMenuEntry menuEntry: config.presentationMenuEntries) {
            writeMenuEntry(menuEntry, json);
        }
        json.endArray();

        json.endObject();

        out.println(");");
    }
View Full Code Here

                }
                catch(Exception exc) {
                    try {
                        // special status code to indicate an exception that is reported as a JSON message
                        resp.setStatus(599);
                        writeExceptionToJson(new AJsonSerHelper(resp.getOutputStream()), exc);
                    }
                    catch(Exception e2) {
                        // throw the original exception if there is a problem in the special handling code
                        throw new ServletException(exc);
                    }
View Full Code Here

TOP

Related Classes of com.ajjpj.asysmon.util.AJsonSerHelper

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.