Examples of JSONTokener


Examples of org.codehaus.jettison.json.JSONTokener

        XMLToJSNNamespaceMap.put("", "");

        //input factory for "Mapped" convention
        MappedXMLInputFactory inputFactory = new MappedXMLInputFactory(XMLToJSNNamespaceMap);
        String jsonString = "{" + localName + ":" + this.getJSONString();
        return inputFactory.createXMLStreamReader(new JSONTokener(jsonString));
    }
View Full Code Here

Examples of org.codehaus.jettison.json.JSONTokener

        nsMap.put("", "");

        // input factory for "Mapped" convention
        MappedXMLInputFactory inputFactory = new MappedXMLInputFactory(nsMap);
        String jsonString = this.getJSONString();
        return inputFactory.createXMLStreamReader(new JSONTokener(jsonString));
    }
View Full Code Here

Examples of org.codehaus.jettison.json.JSONTokener

        nsMap.put("", "");

        // input factory for "Mapped" convention
        MappedXMLInputFactory inputFactory = new MappedXMLInputFactory(nsMap);
        String jsonString = this.getJSONString();
        return inputFactory.createXMLStreamReader(new JSONTokener(jsonString));
    }
View Full Code Here

Examples of org.json.JSONTokener

      http().executeMethod(null, postMethod, state);
      int statusCode= postMethod.getStatusCode();
      if (statusCode!=HttpStatus. SC_OK)
        throw new ClientError("HTTP Status - " +
          HttpStatus.getStatusText(statusCode) + " (" + statusCode + ")");
      JSONTokener tokener= new JSONTokener(postMethod.getResponseBodyAsString());
      Object rawResponseMessage= tokener.nextValue();
      JSONObject responseMessage= (JSONObject)rawResponseMessage;
      if (responseMessage==null)
        throw new ClientError("Invalid response type - " + rawResponseMessage.getClass());
      return responseMessage;   
    } catch (ParseException e) {
View Full Code Here

Examples of org.json.JSONTokener

     */
    public Widget getMetadata(String url) {
        Widget widget = new WidgetImpl();
        JSONObject jsonGadget = null;
        try {
            jsonGadget = (JSONObject) new JSONTokener(gadgetMetadataRepository.getGadgetMetadata(url)).nextValue();
            if (jsonGadget != null) {
                String query = jsonGadget.getString("modulePrefs");
                if (query != null) {
                    JSONObject jsonModulePrefsObject = (JSONObject) new JSONTokener(query).nextValue();
                    if (jsonModulePrefsObject != null) {
                        widget.setTitle(parseProperty(jsonModulePrefsObject, "title"));
                        widget.setTitleUrl(parseProperty(jsonModulePrefsObject, "titleUrl"));
                        widget.setDescription(parseProperty(jsonModulePrefsObject, "description"));
                        widget.setAuthor(parseProperty(jsonModulePrefsObject, "author"));
                        widget.setAuthorEmail(parseProperty(jsonModulePrefsObject, "authorEmail"));
                        widget.setThumbnailUrl(parseProperty(jsonModulePrefsObject, "thumbnail"));
                        widget.setScreenshotUrl(parseProperty(jsonModulePrefsObject, "screenshot"));
                        widget.setUrl(url);
                        widget.setType(getSupportedContext());
                    }
                }
            }
        } catch (JSONException e) {
            try {
                String query = jsonGadget.getString("error");
                if (query != null) {
                    JSONObject jsonModuleErrorObject = (JSONObject) new JSONTokener(query).nextValue();
                    if (jsonModuleErrorObject != null) {
                        String errorMessage = jsonModuleErrorObject.getString("message");
                        String errorCode = jsonModuleErrorObject.getString("code");
                        throw new IllegalArgumentException("HTTP error: " + errorCode + ". Message: " + errorMessage);
                    }
View Full Code Here

Examples of org.json.JSONTokener

                throw new HttpException("Got status code " + result + " for call to " + method.getURI());
            }

            input = method.getResponseBodyAsStream();

            JSONObject object = new JSONObject(new JSONTokener(new InputStreamReader(input)));

            JSONArray bundleData = object.getJSONArray("data");
            for (int i = 0; i < bundleData.length(); i++) {
                JSONObject bundle = bundleData.getJSONObject(i);
                String remotebundleSymbolicName = bundle.getString("symbolicName");
View Full Code Here

Examples of org.json.JSONTokener

  }

  @Override
  protected void loadPage() throws Exception {
    try {
      JSONTokener jsonTokener = new JSONTokener(new InputStreamReader(getInputStream()));
      char nextClean = jsonTokener.nextClean(); jsonTokener.back();
     
      switch (nextClean) {
      case '{':
        this.json = new ObjectNodeImpl(new JSONObject(jsonTokener));
        break;
View Full Code Here

Examples of org.json.JSONTokener

          new NameValuePair("sort_item", "letter"),
          new NameValuePair("sort_type", "desc") };
      String contactsUrl = lastUrl.substring(0, lastUrl.lastIndexOf("/"))
          + "/addr_member.php";
      String json = doPost(contactsUrl, params);
      JSONTokener jsonTokener = new JSONTokener(json);
      Object o = jsonTokener.nextValue();
      JSONObject jsonObj = (JSONObject) o;
      JSONObject jsonData = jsonObj.getJSONObject("data");
      JSONArray jsonContacts = jsonData.getJSONArray("contact");
      List<Contact> contacts = new ArrayList<Contact>();
      for (int i = 0; i < jsonContacts.length(); i++) {
View Full Code Here

Examples of org.json.JSONTokener

     * @return JSON对象
     * @throws org.json.JSONException
     */
    protected JSONObject parseJSON(String content, String startTag) throws JSONException {
        String json = content.substring(content.indexOf(startTag) + startTag.length());
        JSONTokener jsonTokener = new JSONTokener(json);
        Object o = jsonTokener.nextValue();
        return (JSONObject) o;
    }
View Full Code Here

Examples of org.json.JSONTokener

     * @throws org.json.JSONException
     */
    protected JSONObject parseJSON(String content, String startTag, String endTag) throws JSONException {
        String sub_content = content.substring(content.indexOf(startTag) + startTag.length());
        String json = sub_content.substring(0, sub_content.indexOf(endTag));
        JSONTokener jsonTokener = new JSONTokener(json);
        Object o = jsonTokener.nextValue();
        return (JSONObject) o;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.