List of usage examples for org.apache.commons.lang StringUtils startsWithIgnoreCase
public static boolean startsWithIgnoreCase(String str, String prefix)
Case insensitive check if a String starts with a specified prefix.
From source file:org.sonar.db.dialect.PostgreSql.java
@Override public boolean matchesJdbcURL(String jdbcConnectionURL) { return StringUtils.startsWithIgnoreCase(jdbcConnectionURL, "jdbc:postgresql:"); }
From source file:org.sonar.jpa.dialect.HsqlDb.java
public boolean matchesJdbcURL(String jdbcConnectionURL) { return StringUtils.startsWithIgnoreCase(jdbcConnectionURL, "jdbc:hsqldb:"); }
From source file:org.sonar.php.checks.ClassCouplingCheck.java
private static String getTypeName(NamespaceNameTree namespaceName) { String name = namespaceName.fullName(); String prefix = "namespace\\"; if (StringUtils.startsWithIgnoreCase(name, prefix)) { // fixme (SONARPHP-552): Handle namespaces properly name = name.substring(prefix.length() - 1); }/*from w w w.j a v a 2s .c o m*/ return name; }
From source file:org.sonar.plugins.web.checks.dependencies.IllegalNamespaceCheck.java
@Override public void startElement(TagNode element) { if (visited || namespaces == null) { return;/*from w w w .j av a 2s .c o m*/ } for (Attribute a : element.getAttributes()) { if (StringUtils.startsWithIgnoreCase(a.getName(), "xmlns")) { for (String namespace : namespaces) { if (a.getValue().equalsIgnoreCase(namespace)) { createViolation(element); } } } } }
From source file:org.sonar.plugins.xml.schemas.SchemaResolver.java
/** * ResourceResolver tries to resolve schema's and dtd's with built-in resources or external files. *//*from w w w . ja va 2s . c om*/ public LSInput resolveResource(String type, String namespaceURI, String publicId, String systemId, String baseURI) { InputStream input = null; // try as DTD if (publicId != null && publicId.contains("//DTD")) { input = getBuiltinDTD(publicId); } else { // try as namespace input = getBuiltinSchemaByNamespace(systemId); // try as built-in XML schema if (input == null) { input = getBuiltinSchemaByFileName(systemId); } // try as built-in entity if (input == null) { if (StringUtils.startsWithIgnoreCase(systemId, "html")) { input = getBuiltinDTDByFileName("html4/" + systemId); } else { input = getBuiltinDTDByFileName("xhtml1/" + systemId); } } } if (input == null) { LOG.debug("Could not resolve resource: " + systemId); return null; } else { return createLSInput(input); } }
From source file:org.sonar.server.authentication.LogOAuthWarning.java
@Override public void start() { if (providers.length == 0) { return;/*from w ww. ja va 2 s. com*/ } String publicRootUrl = server.getPublicRootUrl(); if (StringUtils.startsWithIgnoreCase(publicRootUrl, "http:")) { Loggers.get(getClass()).warn( "For security reasons, OAuth authentication should use HTTPS. You should set the property 'Administration > Configuration > Server base URL' to a HTTPS URL."); } }
From source file:org.thelq.pircbotx.commands.ListenerUtils.java
public static boolean isCommand(String message, String command) { return StringUtils.startsWithIgnoreCase(message, PREFIX + command); }
From source file:org.zaproxy.zap.extension.ascanrules.TestExternalRedirect.java
/** * Check if the payload is a redirect//ww w. j av a2 s . co m * * @param value the value retrieved * @param payload the url that should perform external redirect * @return true if it's a valid open redirect */ private boolean checkPayload(String value, String payload) { // Check both the payload and the standard url format return (value != null) && (StringUtils.startsWithIgnoreCase(value, payload) || StringUtils.startsWithIgnoreCase(value, "http://" + REDIRECT_SITE)); }
From source file:org.zaproxy.zap.utils.HarUtils.java
public static HarRequest createHarRequest(HttpMessage httpMessage) { HttpRequestHeader requestHeader = httpMessage.getRequestHeader(); HarCookies harCookies = new HarCookies(); try {// w w w . ja v a 2 s. c om for (HttpCookie cookie : requestHeader.getHttpCookies()) { harCookies.addCookie(new HarCookie(cookie.getName(), cookie.getValue())); } } catch (IllegalArgumentException e) { LOGGER.warn("Ignoring cookies for HAR (\"request\") \"cookies\" list. Request contains invalid cookie: " + e.getMessage()); } HarQueryString harQueryString = new HarQueryString(); for (HtmlParameter param : httpMessage.getUrlParams()) { harQueryString.addQueryParam(new HarQueryParam(param.getName(), param.getValue())); } HarPostData harPostData = null; HttpRequestBody requestBody = httpMessage.getRequestBody(); if (requestBody.length() >= 0) { HarPostDataParams params = new HarPostDataParams(); String text = ""; String contentType = requestHeader.getHeader(HttpHeader.CONTENT_TYPE); if (contentType == null) { contentType = ""; text = requestBody.toString(); } else { if (StringUtils.startsWithIgnoreCase(contentType.trim(), HttpHeader.FORM_URLENCODED_CONTENT_TYPE)) { for (HtmlParameter param : httpMessage.getFormParams()) { params.addPostDataParam(new HarPostDataParam(param.getName(), param.getValue())); } } else { text = requestBody.toString(); } } harPostData = new HarPostData(contentType, params, text, null); } return new HarRequest(requestHeader.getMethod(), requestHeader.getURI().toString(), requestHeader.getVersion(), harCookies, createHarHeaders(requestHeader), harQueryString, harPostData, requestHeader.toString().length(), httpMessage.getRequestBody().length(), null); }
From source file:org.zoolu.tools.Parser.java
/** * Whether next chars equal to a specific String <i>s</i> ignoring case. * * @param s//from www . ja v a 2 s . c o m * @return */ public boolean startsWithIgnoreCase(String s) { return StringUtils.startsWithIgnoreCase(str, s); }