List of usage examples for org.apache.commons.lang3 StringUtils contains
public static boolean contains(final CharSequence seq, final CharSequence searchSeq)
Checks if CharSequence contains a search CharSequence, handling null .
From source file:com.hubspot.jinjava.tree.ExpressionNode.java
@Override public OutputNode render(JinjavaInterpreter interpreter) { Object var = interpreter.resolveELExpression(master.getExpr(), getLineNumber()); String result = Objects.toString(var, ""); if (!StringUtils.equals(result, master.getImage()) && StringUtils.contains(result, "{{")) { try {// ww w. j a v a 2s . c o m result = interpreter.renderFlat(result); } catch (Exception e) { Logging.ENGINE_LOG.warn("Error rendering variable node result", e); } } if (interpreter.getContext().isAutoEscape()) { result = EscapeFilter.escapeHtmlEntities(result); } return new RenderedOutputNode(result); }
From source file:io.wcm.handler.link.testcontext.DummyMediaSource.java
@Override public Media resolveMedia(Media media) { String mediaUrl = media.getMediaRequest().getMediaRef(); if (StringUtils.contains(mediaUrl, "image")) { mediaUrl += ".gif"; } else if (StringUtils.contains(mediaUrl, "pdf")) { mediaUrl += ".pdf"; } else {// www. j a v a 2s. com mediaUrl = null; } media.setUrl(mediaUrl); return media; }
From source file:com.chessoft.filter.AuthenticationFilter.java
@Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest httpRequest = (HttpServletRequest) request; HttpServletResponse httpResponse = (HttpServletResponse) response; HttpSession session = httpRequest.getSession(false); String uri = httpRequest.getRequestURI(); if (StringUtils.contains(uri, "/login.xhtml") || (session != null && session.getAttribute("login") != null) || StringUtils.contains(uri, "javax.faces.resource") || StringUtils.contains(uri, "org/apache/myfaces/tobago/renderkit")) { chain.doFilter(request, response); } else {// ww w .j a va 2 s. c om httpResponse.sendRedirect(httpRequest.getContextPath() + "/login.xhtml"); } }
From source file:com.threewks.thundr.view.velocity.VelocityView.java
private String completeViewName(String view) { if (!StringUtils.startsWith(view, "/")) { view = "/WEB-INF/vm/" + view; }/*from w w w . ja v a2 s. c om*/ if (!StringUtils.contains(view, ".")) { view = view + ".vm"; } return view; }
From source file:com.atomicleopard.thundr.freemarker.FreemarkerView.java
private String completeViewName(String view) { if (!StringUtils.startsWith(view, "/")) { view = "/ftl/" + view; }/*from w ww .ja v a 2 s . com*/ if (!StringUtils.contains(view, ".")) { view = view + ".ftl"; } return view; }
From source file:forge.util.PredicateString.java
/** * Op.// w ww . j ava 2s . c om * * @param op1 * the op1 * @param op2 * the op2 * @return true, if successful */ protected final boolean op(final String op1, final String op2) { switch (this.getOperator()) { case CONTAINS_IC: return StringUtils.containsIgnoreCase(op1, op2); case CONTAINS: return StringUtils.contains(op1, op2); case EQUALS: return op1.equals(op2); case EQUALS_IC: return op1.equalsIgnoreCase(op2); default: return false; } }
From source file:com.github.dozermapper.core.util.ResourceLoader.java
public URL getResource(String resource) { resource = resource.trim();/*from ww w. j ava 2 s .com*/ URL result = Thread.currentThread().getContextClassLoader().getResource(resource); // Could not find resource. Try with the classloader that loaded this class. if (result == null) { ClassLoader classLoader = ResourceLoader.class.getClassLoader(); if (classLoader != null) { result = classLoader.getResource(resource); } } // Last ditch attempt searching classpath if (result == null) { result = ClassLoader.getSystemResource(resource); } // one more time if (result == null && StringUtils.contains(resource, ":")) { try { result = new URL(resource); } catch (MalformedURLException e) { MappingUtils.throwMappingException(e); } } return result; }
From source file:com.thoughtworks.go.matchers.ConsoleOutMatcherJunit5.java
public ConsoleOutMatcherJunit5 contains(final String str) { if (!StringUtils.contains(actual, str)) { failWithMessage("Expected console to contain [<%s>] but was <%s>.", str, actual); }/*from w w w.j av a 2 s . c o m*/ return this; }
From source file:ch.cyberduck.core.DefaultIOExceptionMappingService.java
@Override public BackgroundException map(final IOException failure) { final Throwable[] stack = ExceptionUtils.getThrowables(failure); for (Throwable t : stack) { if (t instanceof BackgroundException) { return (BackgroundException) t; }/*from w ww.j av a 2s . com*/ } if (failure instanceof SSLException) { return new SSLExceptionMappingService().map((SSLException) failure); } final StringBuilder buffer = new StringBuilder(); this.append(buffer, failure.getMessage()); for (Throwable cause : ExceptionUtils.getThrowableList(failure)) { if (!StringUtils.contains(failure.getMessage(), cause.getMessage())) { this.append(buffer, cause.getMessage()); } } return this.wrap(failure, buffer); }
From source file:com.adobe.acs.commons.replication.AemPublishAgentFilter.java
/** * Checks if the @agent is considered an active AEM Publish Agent (Serialization Type ~> Default and is enabled). * * @param agent the agent to test// w w w . j a v a2 s .c o m * @return true is is considered an enabled AEM Publish agent */ @Override public final boolean isIncluded(final Agent agent) { final AgentConfig agentConfig = agent.getConfiguration(); return agentConfig.isEnabled() && !agentConfig.usedForReverseReplication() && SERIALIZATION_TYPE.equalsIgnoreCase(agentConfig.getSerializationType()) && StringUtils.contains(agentConfig.getTransportURI(), TRANSPORT_PATH); }