private static boolean isHtml(String responseContent) { return StringUtils.stripToEmpty(responseContent).startsWith("<!DOCTYPE html>"); } }
/** * Set the transfer, content encodings based on headers (if necessary). * * @param rec * Recorder for this request. * @param response * Method used for the request. */ protected void setOtherCodings(CrawlURI uri, final Recorder rec, final HttpResponse response) { if (response.getEntity() != null) { rec.setInputIsChunked(response.getEntity().isChunked()); Header contentEncodingHeader = response.getEntity().getContentEncoding(); if (contentEncodingHeader != null) { String ce = contentEncodingHeader.getValue().trim(); try { rec.setContentEncoding(ce); } catch (IllegalArgumentException e) { uri.getAnnotations().add("unsatisfiableContentEncoding:" + StringUtils.stripToEmpty(ce)); } } } }
unsatisfiableCharset = "<failed-to-parse>"; curi.getAnnotations().add("unsatisfiableCharsetInHeader:"+StringUtils.stripToEmpty(unsatisfiableCharset));
@Override public Comparable<?> parseForSort(String value) { return value == null ? null : StringUtils.stripToEmpty(value); } }
public void setValue(String value) { this.value = StringUtils.stripToEmpty(value); }
@Override public String get(final String key) { final String val = this.data.get(key); return StringUtils.stripToEmpty(val); }
@Override public String getError(final String key) { final String val = this.errors.get(key); return StringUtils.stripToEmpty(val); }
@Override public String getError(final String key) { final String val = this.errors.get(key); return StringUtils.stripToEmpty(val); }
@Override public String get(final String key) { final String val = this.data.get(key); return StringUtils.stripToEmpty(val); }
/** * Returns the string enclosed in HTML comments. Before enclosing the string will be whitespace trimmed. * * @param string a string (<code>null</code> is allowed) * @return trimmed string enclosed in HTML comments. */ public static String encloseInHTMLComment(String string) { return String.format("<!-- %s -->", StringUtils.stripToEmpty(string)); }
private static boolean isHtml(String responseContent) { return StringUtils.stripToEmpty(responseContent).startsWith("<!DOCTYPE html>"); } }
public String build(String name) { if (!isEmpty(prefix)) { name = capitalize(name); } return stripToEmpty(prefix) + name + stripToEmpty(suffix); }
public String build(String name) { if (!isEmpty(prefix)) { name = capitalize(name); } return stripToEmpty(prefix) + name + stripToEmpty(suffix); }
@Override public int compare(String s1, String s2) { s1 = StringUtils.stripToEmpty(s1); s2 = StringUtils.stripToEmpty(s2); if(s1.length() > s2.length()) { return -1; } else if(s1.length() < s2.length()) { return 1; } else { // Compare alphabeticaly if the same length return s1.compareTo(s2); } } }
@Override public int compare(String s1, String s2) { s1 = StringUtils.stripToEmpty(s1); s2 = StringUtils.stripToEmpty(s2); if(s1.length() > s2.length()) { return -1; } else if(s1.length() < s2.length()) { return 1; } else { // Compare alphabeticaly if the same length return s1.compareTo(s2); } } }
/** {@inheritDoc} */ protected List<Float> convert(final String s) throws Exception { List<Float> list = new ArrayList<Float>(); StringTokenizer st = new StringTokenizer(s, ","); while (st.hasMoreTokens()) { String token = StringUtils.stripToEmpty(st.nextToken()); Float f = Float.valueOf(token); list.add(f); } return list; } }
@NotNull public String getDescriptiveName(@NotNull PsiElement element) { if (element instanceof BashCommand) { return StringUtils.stripToEmpty(((BashCommand) element).getReferencedCommandName()); } if (element instanceof PsiNamedElement) { return StringUtils.stripToEmpty(((PsiNamedElement) element).getName()); } return ""; }
@Override public Comparable<?> parseForSort(String value) { String parsedValue = parse(value); return parsedValue == null ? null : StringUtils.stripToEmpty(parsedValue); }
private Set<String> getCategoriesParam(final SlingHttpServletRequest request) { final LinkedHashSet<String> categories = new LinkedHashSet<String>(); final RequestParameter requestParameter = request.getRequestParameter(PARAM_CATEGORIES); if (requestParameter != null) { final String[] segments = StringUtils.split(requestParameter.getString(), ","); for (final String segment : segments) { if (StringUtils.isNotBlank(segment)) { categories.add(StringUtils.stripToEmpty(segment)); } } } return categories; }
/** * Writes any image initializations; this should be invoked at the end of the render, after all * the related HTML will have already been streamed to the client and parsed by the web browser. * Earlier versions of Tapestry uses a <code>window.onload</code> event handler. * * @param writer * The markup writer to use. */ public void writeInitializationScript(IMarkupWriter writer) { if (!any(_initializationScript) && !any(_postInitializationScript)) return; String script = getContent(_initializationScript) + getContent(_postInitializationScript); _builder.writeInitializationScript(writer, StringUtils.stripToEmpty(script)); }