List of usage examples for org.apache.commons.lang StringUtils startsWith
public static boolean startsWith(String str, String prefix)
Check if a String starts with a specified prefix.
From source file:com.intel.cosbench.driver.iterator.RangeIterator.java
public static RangeIterator parse(String pattern) { try {/* w w w . ja v a2s . c om*/ return tryParseOld(pattern); } catch (Exception e1) { if (!StringUtils.startsWith(pattern, "r(")) return null; try { return tryParse(pattern); } catch (Exception e2) { } } String msg = "illegal iteration pattern: " + pattern; throw new ConfigException(msg); }
From source file:com.intel.cosbench.driver.generator.SequentialIntGenerator.java
public static SequentialIntGenerator parse(String pattern) { if (!StringUtils.startsWith(pattern, "s(")) { return null; } else {//from www .j a v a2s . c o m try { return tryParse(pattern); } catch (NullPointerException e) { String msg = "illegal iteration pattern: " + pattern; throw new ConfigException(msg); } } }
From source file:com.adobe.acs.commons.rewriter.impl.SaxElementUtils.java
public static boolean isJavaScript(final String elementName, final Attributes attrs) { final String type = attrs.getValue("", "type"); final String src = attrs.getValue("", "src"); if (StringUtils.equals("script", elementName) && StringUtils.equals(type, JS_TYPE) && StringUtils.startsWith(src, "/") && !StringUtils.startsWith(src, "//") && StringUtils.endsWith(src, LibraryType.JS.extension)) { return true; }/*from w w w. ja v a 2 s . c o m*/ return false; }
From source file:com.intel.cosbench.driver.generator.UniformIntGenerator.java
public static UniformIntGenerator parse(String pattern) { if (!StringUtils.startsWith(pattern, "u(")) return null; try {//from ww w .j a v a2 s.co m return tryParse(pattern); } catch (Exception e) { } String msg = "illegal uniform distribution pattern: " + pattern; throw new ConfigException(msg); }
From source file:com.ning.hfind.primary.OperandModifier.java
public OperandModifier(String argument) { if (StringUtils.startsWith(argument, MORE_THAN_CHARACTER)) { modified = MODIFIED.MORE_THAN;//from ww w . ja v a 2 s .com sanitizedArgument = Integer.valueOf(argument.substring(1, argument.length())); } else if (StringUtils.startsWith(argument, LESS_THAN_CHARACTER)) { modified = MODIFIED.LESS_THAN; sanitizedArgument = Integer.valueOf(argument.substring(1, argument.length())); } else { modified = MODIFIED.EXACTLY; sanitizedArgument = Integer.valueOf(argument); } }
From source file:com.edm.app.interceptor.AuthInterceptor.java
@Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { String link = request.getServletPath(); if (StringUtils.startsWith(link, "/403") || StringUtils.startsWith(link, "/404")) { return true; }/* w ww .j av a2s .c o m*/ if (!Auth.isSetup()) { logger.info("(Auth:handle) error: auth is off"); response.sendRedirect("/403"); return false; } String robot = Auth.ROBOT; // String code = Auth.MAP.get(UrlMap.CODE.getAction()); // String code = Auth.MAP.get("LICENSE_PASSWD"); if (!Auth.size()) { logger.info("(Auth:handle) error: LICENSE is error"); response.sendRedirect("/403"); return false; } if (StringUtils.isBlank(robot)) { logger.info("(Auth:handle) error: ROBOT is error"); response.sendRedirect("/403"); return false; } if (!Auth.key(robot)) { logger.info("Auth is fail "); logger.info("(Auth:handle) error: KEY is error"); response.sendRedirect("/403"); return false; } // if (!Auth.link(link, robot, code)) { // logger.info("(Auth:handle) error: " + link + " is forbid"); // response.sendRedirect("/404"); // return false; // } return true; }
From source file:com.cnd.greencube.web.base.interceptor.ListInterceptor.java
@Override public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception { if (modelAndView != null && modelAndView.isReference()) { String viewName = modelAndView.getViewName(); if (StringUtils.startsWith(viewName, REDIRECT_VIEW_NAME_PREFIX)) { String listQuery = WebUtils.getCookie(request, LIST_QUERY_COOKIE_NAME); if (StringUtils.isNotEmpty(listQuery)) { if (StringUtils.startsWith(listQuery, "?")) { listQuery = listQuery.substring(1); }//from ww w .ja v a 2 s . c om if (StringUtils.contains(viewName, "?")) { modelAndView.setViewName(viewName + "&" + listQuery); } else { modelAndView.setViewName(viewName + "?" + listQuery); } } } } }
From source file:com.hangum.tadpole.engine.manager.TadpoleSQLTransactionManager.java
/** * ? transaction commit. /*from www.j av a 2 s .c o m*/ * * @param userId */ public static void executeRollback(final String userId) { Set<String> keys = dbManager.keySet(); for (String key : keys) { if (StringUtils.startsWith(key, userId + PublicTadpoleDefine.DELIMITER)) { if (logger.isDebugEnabled()) logger.debug("== logout transaction start=="); TransactionDAO transactionDAO = dbManager.get(key); try { transactionDAO.getConn().rollback(); } catch (Exception e) { logger.error("logout transaction commit", e); } } } }
From source file:com.dp2345.interceptor.ListInterceptor.java
@Override public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception { if (modelAndView != null && modelAndView.isReference()) { String viewName = modelAndView.getViewName(); if (StringUtils.startsWith(viewName, REDIRECT_VIEW_NAME_PREFIX)) { String listQuery = WebUtils.getCookie(request, LIST_QUERY_COOKIE_NAME); if (StringUtils.isNotEmpty(listQuery)) { if (StringUtils.startsWith(listQuery, "?")) { listQuery = listQuery.substring(1); }//from www . j a v a 2s. co m if (StringUtils.contains(viewName, "?")) { modelAndView.setViewName(viewName + "&" + listQuery); } else { modelAndView.setViewName(viewName + "?" + listQuery); } WebUtils.removeCookie(request, response, LIST_QUERY_COOKIE_NAME); } } } }
From source file:com.thinkbiganalytics.feedmgr.service.EncryptionService.java
public boolean isEncrypted(String str) { return StringUtils.startsWith(str, encryptedPrefix); }