Package org.mortbay.util.ajax

Examples of org.mortbay.util.ajax.JSON$Convertible


    String format = request.getParameter("format");
    Collection<MetricsContext> allContexts =
      ContextFactory.getFactory().getAllContexts();
    if ("json".equals(format)) {
      // Uses Jetty's built-in JSON support to convert the map into JSON.
      out.print(new JSON().toJSON(makeMap(allContexts)));
    } else {
      printMap(out, makeMap(allContexts));
    }
    out.close();
  }
View Full Code Here


      }
      if (mrc != null) {
        map.put("jobtracker_port", mrc.getJobTrackerPort());
      }
      FileWriter fw = new FileWriter(new File(writeDetails));
      fw.write(new JSON().toJSON(map));
      fw.close();
    }
  }
View Full Code Here

            if (_jsonOut == null)
            {
                _jsonOut = (JSON)_httpClient.getAttribute(__JSON);
                if (_jsonOut==null)
                {
                    _jsonOut = new JSON();
                    _httpClient.setAttribute(__JSON,_jsonOut);
                }
            }

            if (_timer == null)
View Full Code Here

        Object ext=_ext == null?get(Bayeux.EXT_FIELD):_ext;
        if (ext instanceof Map)
            return (Map<String,Object>)ext;
        if (ext instanceof JSON.Literal)
        {
            JSON json=_pool == null?JSON.getDefault():_pool.getMsgJSON();
            _ext=ext=json.fromJSON(ext.toString());
            super.put(Bayeux.EXT_FIELD,ext);
            return (Map<String,Object>)ext;
        }

        if (!create)
View Full Code Here

    /* ------------------------------------------------------------ */
    public String getJSON()
    {
        if (_json == null)
        {
            JSON json=_pool == null?JSON.getDefault():_pool.getMsgJSON();
            StringBuffer buf=new StringBuffer(json.getStringBufferSize());
            synchronized(buf)
            {
                json.appendMap(buf,this);
                _json=buf.toString();
            }
        }
        return _json;
    }
View Full Code Here

        Object ext = _ext==null?get(Bayeux.EXT_FIELD):_ext;
        if (ext instanceof Map)
            return (Map<String,Object>)ext;
        if (ext instanceof JSON.Literal)
        {
            JSON json=_pool==null?JSON.getDefault():_pool.getMsgJSON();
            _ext=ext=json.fromJSON(ext.toString());
            super.put(Bayeux.EXT_FIELD,ext);
            return (Map<String,Object>)ext;
        }

        if (!create)
View Full Code Here

    /* ------------------------------------------------------------ */
    public String getJSON()
    {
        if (_json==null)
        {
            JSON json=_pool==null?JSON.getDefault():_pool.getMsgJSON();
            StringBuffer buf = new StringBuffer(json.getStringBufferSize());
            synchronized(buf)
            {
                json.appendMap(buf,this);
                _json=buf.toString();
            }
        }
        return _json;
    }
View Full Code Here

    if ("json".equals(format)) {
      response.setContentType("application/json; charset=utf-8");
      PrintWriter out = response.getWriter();
      try {
        // Uses Jetty's built-in JSON support to convert the map into JSON.
        out.print(new JSON().toJSON(makeMap(allContexts)));
      } finally {
        out.close();
      }
    } else {
      PrintWriter out = response.getWriter();
View Full Code Here

      if (dfs != null) {
        map.put("namenode_port", dfs.getNameNodePort());
      }

      FileWriter fw = new FileWriter(new File(writeDetails));
      fw.write(new JSON().toJSON(map));
      fw.close();
    }
  }
View Full Code Here

      if (mr != null) {
        map.put("jobtracker_port", mr.getConfig().get("mapred.job.tracker")
            .split(":")[1]);
      }
      FileWriter fw = new FileWriter(new File(writeDetails));
      fw.write(new JSON().toJSON(map));
      fw.close();
    }
  }
View Full Code Here

TOP

Related Classes of org.mortbay.util.ajax.JSON$Convertible

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.