/** * Make a pretty printed JSON text of this JSONArray.<p> * * Warning: This method assumes that the data structure is acyclical.<p> * * @param indentFactor the number of spaces to add to each level of * indentation * @return a printable, displayable, transmittable * representation of the object, beginning * with <code>[</code> <small>(left bracket)</small> and ending * with <code>]</code> <small>(right bracket)</small> * @throws JSONException if something goes wrong */ public String toString(int indentFactor) throws JSONException { return toString(indentFactor, 0); }
/** * Make a pretty printed JSON text of this JSONArray.<p> * * Warning: This method assumes that the data structure is acyclical.<p> * * @param indentFactor the number of spaces to add to each level of * indentation * @return a printable, displayable, transmittable * representation of the object, beginning * with <code>[</code> <small>(left bracket)</small> and ending * with <code>]</code> <small>(right bracket)</small> * @throws JSONException if something goes wrong */ public String toString(int indentFactor) throws JSONException { return toString(indentFactor, 0); }
/** * Encode a list of strings as base64 data to be used in a request parameter.<p> * * @param strings the strings to encode * @return the resulting base64 data */ public static String encodeStringsAsBase64Parameter(List<String> strings) { JSONArray array = new JSONArray(); for (String string : strings) { array.put(string); } byte[] bytes; try { // use obfuscateBytes here to to make the output look more random bytes = obfuscateBytes(array.toString().getBytes("UTF-8")); } catch (UnsupportedEncodingException e) { // should never happen e.printStackTrace(); throw new RuntimeException(e); } String result = Base64.encodeBase64String(bytes); result = StringUtils.replaceChars(result, BASE64_EXTRA, BASE64_EXTRA_REPLACEMENTS); return result; }
jsCall.append("'").append(CmsEncoder.escape(newElements.toString(), CmsEncoder.ENCODING_UTF_8)).append("'"); jsCall.append(");"); action.append(index); action.append(", '").append( CmsEncoder.escape(newElements.toString(), CmsEncoder.ENCODING_UTF_8)).append("'"); action.append(");"); btAction = action.toString();
user.setAdditionalInfo(listKey, data.toString()); cms.writeUser(user);
/** * Writes the user quick launch apps setting to the user additional info.<p> * * @param cms the cms context * @param apps the app ids * * @throws CmsException in case writing the user fails */ protected void setUserQuickLaunchApps(CmsObject cms, List<String> apps) throws CmsException { JSONArray appIds = new JSONArray(apps); CmsUser user = cms.getRequestContext().getCurrentUser(); user.setAdditionalInfo(QUICK_LAUCH_APPS_KEY, appIds.toString()); cms.writeUser(user); }
/** * Returns the available sub choices for a nested choice element.<p> * * @return the available sub choices for a nested choice element as JSON array string */ public String buildSubChoices() { String elementPath = getParamElementName(); // we have to add a choice element, first check if the element to add itself is part of a choice or not boolean choiceType = Boolean.valueOf(getParamChoiceType()).booleanValue(); I_CmsXmlSchemaType elemType = m_content.getContentDefinition().getSchemaType(elementPath); if (!choiceType || (elemType.isChoiceOption() && elemType.isChoiceType())) { // this is a choice option or a nested choice type to add, remove last element name from xpath elementPath = CmsXmlUtils.removeLastXpathElement(elementPath); } elementPath = CmsXmlUtils.concatXpath(elementPath, getParamChoiceElement()); return buildElementChoices(elementPath, choiceType, false).toString(); }
out.print(categories.toString()); } catch (IOException e) { if (LOG.isErrorEnabled()) {
JspWriter out = getJsp().getJspContext().getOut(); try { out.print(jsonArr.toString()); } catch (IOException e) { if (LOG.isErrorEnabled()) {
try { out.print(jsonArr.toString()); } catch (IOException e) { if (LOG.isErrorEnabled()) {
return jsonArr.toString();
JspWriter out = getJsp().getJspContext().getOut(); try { out.print(jsonArr.toString()); } catch (IOException e) { if (LOG.isErrorEnabled()) {
out.print(galleries.toString()); } catch (IOException e) { if (LOG.isErrorEnabled()) {
try { out.print(items.toString()); } catch (IOException e) { if (LOG.isErrorEnabled()) {