public static String join(Object[] items, String delimiter) { StringBuilder builder = new StringBuilder(); join(builder, items, delimiter); return builder.toString(); }
private String getETag(byte[] bytes) throws ServletException { try { byte[] digest = MessageDigest.getInstance("MD5").digest(bytes); return StringUtils.bytesToHex(digest); } catch (NoSuchAlgorithmException exception) { throw new ServletException("Could not create message digest.", exception); } }
public static void addXmlNodeProperty(JsonObjectBuilder builder, String propertName, String item, Node node) { try { builder.add(propertName, DomUtils.writeToString(node)); } catch (IOException exception) { builder.add(propertName, "Exception occurred during serialization of " + item + ": " + StringUtils.getAllMessages(exception)); } }
public static String getAllMessages(Throwable throwable) { return join(getAllMessagesAsArray(throwable), "\n"); }
public static String getSubmitPath(VoiceXmlDialogueContext voiceXmlDialogueContext, int turnIndex, String turnName) { return getServletPathWithSessionId(voiceXmlDialogueContext) + "/" + turnIndex + "/" + StringUtils.replaceAll(URI_PATH_REPLACEMENT_CHAR, turnName, "_"); }
public static void addNamelist(Element parentElement, Element namelistHolderElement, VariableList variables) { if (variables == null) return; if (variables.isEmpty()) return; List<String> variableNames = new ArrayList<String>(); for (Entry<String, String> entry : variables) { variableNames.add(entry.getKey()); createVarElement(parentElement, entry.getKey(), entry.getValue()); } namelistHolderElement.setAttribute(NAME_LIST_ATTRIBUTE, StringUtils.join(variableNames, " ")); }
private static Element createSubmitElement(Element parent, VoiceXmlDialogueContext voiceXmlDialogueContext, SubmitMethod method, VoiceXmlOutputTurn outputTurn, String... nameList) { Element submitElement = DomUtils.appendNewElement(parent, SUBMIT_ELEMENT); submitElement.setAttribute(NEXT_ATTRIBUTE, getSubmitPathForTurn(voiceXmlDialogueContext, outputTurn)); submitElement.setAttribute(NAME_LIST_ATTRIBUTE, StringUtils.join(nameList, " ")); submitElement.setAttribute(METHOD_ATTRIBUTE, method.name()); applyDocumentFetchConfiguration(submitElement, voiceXmlDialogueContext); return submitElement; }
Object[] array = (Object[]) propertyValue; insertPropertyName(propertyName, true); StringUtils.join(mBuffer, array, ", "); close(true); } else if (componentType == Boolean.TYPE) { boolean[] array = (boolean[]) propertyValue; insertPropertyName(propertyName, true); StringUtils.join(mBuffer, array, ", "); close(true); } else if (componentType == Character.TYPE) { char[] array = (char[]) propertyValue; insertPropertyName(propertyName, true); StringUtils.join(mBuffer, array, ", "); close(true); } else if (componentType == Double.TYPE) { double[] array = (double[]) propertyValue; insertPropertyName(propertyName, true); StringUtils.join(mBuffer, array, ", "); close(true); } else if (componentType == Float.TYPE) { float[] array = (float[]) propertyValue; insertPropertyName(propertyName, true); StringUtils.join(mBuffer, array, ", "); close(true); } else if (componentType == Long.TYPE) { long[] array = (long[]) propertyValue; insertPropertyName(propertyName, true); StringUtils.join(mBuffer, array, ", "); close(true);
subdialogueElement.setAttribute(NAME_LIST_ATTRIBUTE, StringUtils.join(submitNameList, " "));
objectElement.setAttribute(ARCHIVE_ATTRIBUTE, StringUtils.join(archives, " "));