Package org.apache.wicket.ajax.json

Examples of org.apache.wicket.ajax.json.JSONObject


  private JSONObject getClipArtListMessage(JSONArray array) throws JSONException {
    return new JSONObject().put("type", "clipArtList").put("json", array);
  }

  private JSONObject getDocumentListMessage(JSONArray array) throws JSONException {
    return new JSONObject().put("type", "documentList").put("json", array);
  }
View Full Code Here


  private JSONObject getDocumentListMessage(JSONArray array) throws JSONException {
    return new JSONObject().put("type", "documentList").put("json", array);
  }

  private JSONObject getDocumentComponentListMessage(JSONArray array) throws JSONException {
    return new JSONObject().put("type", "documentComponentList").put("json", array);
  }
View Full Code Here

   *
   * @return JSON object with field values added
   * @throws JSONException
   */
  public JSONObject getJSON() throws JSONException {
    JSONObject jsonObject = super.getJSON(new JSONObject());
    jsonObject.put("obj", obj);
    jsonObject.put("t", t);

    return jsonObject;
  }
View Full Code Here

   *
   * @return JSON object with field values added
   * @throws JSONException
   */
  public JSONObject getJSON() throws JSONException {
    JSONObject jsonObject = super.getJSON(new JSONObject());
    jsonObject.put("a", a);
    jsonObject.put("b", b);
    jsonObject.put("c", c);
    return jsonObject;
  }
View Full Code Here

  {
    // test JSON response
    tester.getRequest().setMethod("POST");
    tester.executeUrl("./api");

                JSONObject actual = new JSONObject(tester.getLastResponseAsString());
                Assert.assertEquals("Smith", actual.getString("surname"));
                Assert.assertEquals("Mary", actual.getString("name"));
                Assert.assertEquals("m.smith@gmail.com", actual.getString("email"));
  }
View Full Code Here

   *
   * @return JSON object with field values added
   * @throws JSONException
   */
  public JSONObject getJSON() throws JSONException {
    JSONObject jsonObject = super.getJSON(new JSONObject());
    jsonObject.put("p1", p1);
    jsonObject.put("p2", p2);
    jsonObject.put("p3", p3);
    return jsonObject;
  }
View Full Code Here

   *
   * @return JSON object with field values added
   * @throws JSONException
   */
  public JSONObject getJSON() throws JSONException {
    JSONObject jsonObject = super.getJSON(new JSONObject());
    jsonObject.put("a", a);
    jsonObject.put("b", b);
    jsonObject.put("c", c);
    return jsonObject;
  }
View Full Code Here

  }

  @Override
  public String serializeObject(Object targetObject, String mimeType)
  { 
    JSONObject jsonObject = new JSONObject(targetObject);
   
    return jsonObject.toString();
  }
View Full Code Here

  /**
   * Read the Request and construct an appropriate ResourceStream to respond with.
   */
  public void buildResourceStream()
  {
    JSONObject json;
    String cmd = null, id = null;
    JSONArray paramArray = null;

    HttpServletRequest req = ((ServletWebRequest)RequestCycle.get().getRequest()).getContainerRequest();
    BufferedReader reader = null;
    try
    {
      ServletInputStream sis = req.getInputStream();
      reader = new BufferedReader(new InputStreamReader(sis, "UTF-8"));
      // Used for debugging:
      // reader.mark(10);
      // if (reader.read() == -1) {
      // LOG.error("No request seen");
      // }
      // reader.reset();

      json = new JSONObject(new JSONTokener(reader));
      // LOG.debug("JSON Object: {}", json);

      id = json.getString("id");
      cmd = json.getString("method");
      paramArray = json.getJSONArray("params");

    }
    catch (IOException e)
    {
      jsonError("I/O exception while parsing");
View Full Code Here

    {
      while (words.hasNext())
        array.put(words.next());
    }

    JSONObject response = new JSONObject();
    try
    {
      response.put("id", id);
      response.put("error", (String)null);
      response.put("result", array);
      setResponse(response.toString());
    }
    catch (JSONException e)
    {
      jsonError("Failed to construct response");
    }
View Full Code Here

TOP

Related Classes of org.apache.wicket.ajax.json.JSONObject

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.