List of usage examples for java.lang String concat
public String concat(String str)
From source file:org.iish.visualmets.util.ControllerUtils.java
/** * Determines the type of template: JSON or XML. * When the client uses a callback function with a tagname, it is assumed the response is JSON. * If NULL the XML template is selected. * * @param viewName Prefix of the template * @param callback JSONP tagname/*from w ww . j a v a2 s. co m*/ * @param response * @return the FreeMarker template */ public static ModelAndView createModelAndViewPage(String viewName, String callback, HttpServletResponse response) { String template = (callback == null) ? viewName.concat(".xml") : viewName.concat(".json"); ModelAndView mav = new ModelAndView(template); if (callback == null) { response.setContentType("text/xml; charset=utf-8"); } else { response.setContentType("application/json; charset=utf-8"); mav.addObject("callback", callback.trim()); } return mav; }
From source file:es.wolfi.passman.API.Core.java
public static void setAPIHost(String host) { Core.host = host.concat("/index.php/apps/passman/api/v2/"); }
From source file:com.github.zhanhb.ckfinder.connector.utils.PathUtils.java
/** * Adds slash character at the end of String provided as parameter. The slash * character will not be added if parameter is empty string or ends with * slash.// ww w . j a v a 2s . com * * @param string string to add slash character to * @return String with slash character at the end, {@code null} or empty * string. */ public static String addSlashToEnd(String string) { if (string == null || string.endsWith("/")) { return string; } return string.concat("/"); }
From source file:Main.java
/** * Looks for attribute value in XML String within a given range * //from ww w . ja v a2s .co m * @param inputXml Source XML String * @param attribute Attribute name * @param start Range start * @param end Range end * @return Value of the attribute */ private static String getAttributeInRange(final String inputXml, final String attribute, int start, int end) { final String attributes = inputXml.substring(start, end).trim(); start = attributes.indexOf(attribute.concat("=")); if (start == -1) { return null; } start += attribute.length() + 1; final char quote = attributes.charAt(start); start++; end = attributes.indexOf(quote, start); return attributes.substring(start, end); }
From source file:com.streamreduce.util.SecurityUtil.java
public static String issueRandomAPIToken() { // we need to see our tokens with a random value so the same one isn't generated // for the same user each time. RandomNumberGenerator rng = new SecureRandomNumberGenerator(); Object randomNumber = rng.nextBytes(); // we also use a user agent as a validation factor // so when we later validate the token, we also validate the user agent String secret = generateRandomString(); String salt = secret.concat(randomNumber.toString()); return new Sha256Hash(secret, salt, 1024).toBase64(); }
From source file:com.asual.summer.core.util.StringUtils.java
public static String wrap(String left, String center, String right) { return left.concat(center).concat(right); }
From source file:ezbake.common.openshift.OpenShiftUtil.java
public static String getConfigurationDir() { String repoDir = getRepoDir(); final String ezbakeConfigDir = "config"; String retVal;// w ww. jav a 2s . c o m if (repoDir.endsWith(File.separator)) { retVal = repoDir.concat(ezbakeConfigDir); } else { retVal = Joiner.on(File.separator).join(repoDir, ezbakeConfigDir); } return retVal; }
From source file:Main.java
private static String buildQueryString(String method, Map<String, String> args) { String qry = buildQueryString(method); Iterator it = args.entrySet().iterator(); while (it.hasNext()) { String key = (String) it.next(); String val = args.get(key); qry = qry.concat("?").concat(key).concat("=").concat(val); }/* ww w .j a v a2s .com*/ return qry; }
From source file:Main.java
public static String decodeLZW(int[] encodedText, HashMap<Integer, String> dict, int dictSize) { String decodedText = ""; for (int i = 0; i < encodedText.length; i++) { String nextString = ""; String currentEntry = dict.get(encodedText[i]); decodedText = decodedText.concat(currentEntry); if (i + 1 < encodedText.length && dict.size() < dictSize) { if (encodedText[i + 1] < dict.size()) nextString = dict.get(encodedText[i + 1]); else//from w w w . ja v a 2 s .c om nextString = currentEntry; String nextChar = String.valueOf(nextString.charAt(0)); if (!dict.containsValue(currentEntry.concat(nextChar))) { dict.put(dict.size(), currentEntry.concat(nextChar)); } } } return decodedText; }
From source file:Main.java
public static String addPadding(String t, String s, int num) { StringBuilder retVal;/*w w w . j a v a 2 s. co m*/ if (null == s || 0 >= num) { throw new IllegalArgumentException(INVALID_ARGUMENT); } if (s.length() <= num) { return s.concat(t); } retVal = new StringBuilder(s); for (int i = retVal.length(); i > 0; i -= num) { retVal.insert(i, t); } return retVal.toString(); }