List of usage examples for org.apache.commons.lang StringUtils equalsIgnoreCase
public static boolean equalsIgnoreCase(String str1, String str2)
Compares two Strings, returning true
if they are equal ignoring the case.
From source file:net.shopxx.filter.AuthenticationFilter.java
@Override protected boolean onAccessDenied(ServletRequest servletRequest, ServletResponse servletResponse) throws Exception { HttpServletRequest request = (HttpServletRequest) servletRequest; HttpServletResponse response = (HttpServletResponse) servletResponse; if (StringUtils.equalsIgnoreCase(request.getHeader("X-Requested-With"), "XMLHttpRequest")) { response.addHeader("loginStatus", "accessDenied"); response.sendError(HttpServletResponse.SC_FORBIDDEN); return false; }//from ww w . ja v a 2s. co m String loginToken = net.shopxx.util.WebUtils.getCookie(request, Admin.LOGIN_TOKEN_COOKIE_NAME); if (!StringUtils.equalsIgnoreCase(loginToken, adminService.getLoginToken())) { WebUtils.issueRedirect(request, response, "/"); return false; } return super.onAccessDenied(request, response); }
From source file:edu.monash.merc.common.name.ChromType.java
public static ChromType fromType(String type) { if (StringUtils.isBlank(type)) { return UNKNOWN; }/*w w w . j a va 2 s . co m*/ if (StringUtils.equalsIgnoreCase(type, CHM1.chm())) { return CHM1; } if (StringUtils.equalsIgnoreCase(type, CHM2.chm())) { return CHM2; } if (StringUtils.equalsIgnoreCase(type, CHM3.chm())) { return CHM3; } if (StringUtils.equalsIgnoreCase(type, CHM4.chm())) { return CHM4; } if (StringUtils.equalsIgnoreCase(type, CHM5.chm())) { return CHM5; } if (StringUtils.equalsIgnoreCase(type, CHM6.chm())) { return CHM6; } if (StringUtils.equalsIgnoreCase(type, CHM7.chm())) { return CHM7; } if (StringUtils.equalsIgnoreCase(type, CHM8.chm())) { return CHM8; } if (StringUtils.equalsIgnoreCase(type, CHM9.chm())) { return CHM9; } if (StringUtils.equalsIgnoreCase(type, CHM10.chm())) { return CHM10; } if (StringUtils.equalsIgnoreCase(type, CHM11.chm())) { return CHM11; } if (StringUtils.equalsIgnoreCase(type, CHM12.chm())) { return CHM12; } if (StringUtils.equalsIgnoreCase(type, CHM13.chm())) { return CHM13; } if (StringUtils.equalsIgnoreCase(type, CHM14.chm())) { return CHM14; } if (StringUtils.equalsIgnoreCase(type, CHM15.chm())) { return CHM15; } if (StringUtils.equalsIgnoreCase(type, CHM16.chm())) { return CHM16; } if (StringUtils.equalsIgnoreCase(type, CHM17.chm())) { return CHM17; } if (StringUtils.equalsIgnoreCase(type, CHM18.chm())) { return CHM18; } if (StringUtils.equalsIgnoreCase(type, CHM19.chm())) { return CHM19; } if (StringUtils.equalsIgnoreCase(type, CHM20.chm())) { return CHM20; } if (StringUtils.equalsIgnoreCase(type, CHM21.chm())) { return CHM21; } if (StringUtils.equalsIgnoreCase(type, CHM22.chm())) { return CHM22; } if (StringUtils.equalsIgnoreCase(type, CHMX.chm())) { return CHMX; } if (StringUtils.equalsIgnoreCase(type, CHMY.chm())) { return CHMY; } if (StringUtils.equalsIgnoreCase(type, CHMMT.chm())) { return CHMMT; } if (StringUtils.equalsIgnoreCase(type, CHMOTHER.chm())) { return CHMOTHER; } return UNKNOWN; }
From source file:hydrograph.ui.propertywindow.widgets.gridwidgets.container.ELTHydroSubGroup.java
private Image getImage(String subgroupName) { Bundle bundle = Platform.getBundle("hydrograph.ui.propertywindow"); URL fullPathString = null;// ww w .ja v a 2s .c o m if (StringUtils.equalsIgnoreCase(subgroupName, "CONFIGURATION")) { fullPathString = BundleUtility.find(bundle, "icons/config.png"); } else if (StringUtils.equalsIgnoreCase(subgroupName, "DISPLAY")) { fullPathString = BundleUtility.find(bundle, "icons/display.png"); } else if (StringUtils.equalsIgnoreCase(subgroupName, "RECORD STRUCTURE DETAILS")) { fullPathString = BundleUtility.find(bundle, "icons/schema.png"); } if (fullPathString != null) { Image image = ImageDescriptor.createFromURL(fullPathString).createImage(); return image; } else { return null; } }
From source file:hr.fer.zemris.vhdllab.service.ci.CircuitInterface.java
public boolean isName(String circuitName) { return StringUtils.equalsIgnoreCase(this.name, circuitName); }
From source file:grails.plugin.springsecurity.web.authentication.AjaxAwareAuthenticationEntryPoint.java
@Override public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException) throws IOException, ServletException { if (StringUtils.equalsIgnoreCase(request.getHeader("nopage"), "true")) { response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "Unauthorized: The requested URL is protected"); return;// w w w . j a va 2s . co m } super.commence(request, response, authException); }
From source file:au.org.ala.bhl.command.ExtractNamesCommand.java
public void execute(final ItemsService service, final IndexerOptions options) throws Exception { final DocumentCacheService cache = new DocumentCacheService(options.getDocCachePath()); final TaxonGrab nameGrabber = new TaxonGrab(); final File outputFile = new File(options.getOutputFile()); if (outputFile.exists()) { outputFile.delete();//from w w w . j a v a2 s . c o m } final Writer writer = new FileWriter(outputFile); cache.forEachItemPage(new CachedItemPageHandler() { private String _language = ""; public void onPage(String internetArchiveId, String pageId, String text) { try { LanguageScore score = WordLists.detectLanguage(text, _language); String lang = _language; if (score != null && !StringUtils.equalsIgnoreCase(score.getName(), _language) && score.getScore() > .75) { log("Page %s - %s language detected as %s (scored %g) - This conflicts with meta data language of %s", internetArchiveId, pageId, score.getName(), score.getScore(), _language); lang = score.getName(); if (score.getScore() == 1.0) { System.err.println("Here"); } } List<String> names = nameGrabber.findNames(text, lang); for (String name : names) { String line = String.format("%s,%s,\"%s\"\n", internetArchiveId, pageId, name); writer.write(line); } } catch (IOException ioex) { throw new RuntimeException(ioex); } } public void startItem(String internetArchiveId) { CacheControlBlock ccb = cache.getCacheControl(internetArchiveId); if (ccb != null) { _language = ccb.Language; } log("Starting item %s (%s)", internetArchiveId, _language); } public void endItem(String itemId) { try { writer.flush(); } catch (Exception ex) { ex.printStackTrace(); } _language = ""; } }); }
From source file:io.wcm.tooling.netbeans.sightly.completion.classLookup.RequestAttributeResolver.java
public Set<String> resolve(String filter) { Set<String> ret = new LinkedHashSet<>(); // only display results if filter contains @ if (!StringUtils.contains(text, "@") || !StringUtils.contains(text, "data-sly-use")) { return ret; }/*from w w w .j a va 2s.c o m*/ ElementUtilities.ElementAcceptor acceptor = new ElementUtilities.ElementAcceptor() { @Override public boolean accept(Element e, TypeMirror type) { // we are looking for the annotations for (AnnotationMirror mirror : e.getAnnotationMirrors()) { if (mirror.getAnnotationType() != null && mirror.getAnnotationType().asElement() != null && StringUtils.equalsIgnoreCase(REQUEST_ATTRIBUTE_CLASSNAME, mirror.getAnnotationType().asElement().toString())) { return true; } } return false; } }; String clazz = StringUtils.substringBetween(text, "'"); Set<Element> elems = getMembersFromJavaSource(clazz, acceptor); for (Element elem : elems) { if (StringUtils.startsWithIgnoreCase(elem.getSimpleName().toString(), filter) && !StringUtils.contains(text, elem.getSimpleName().toString() + " ") && !StringUtils.contains(text, elem.getSimpleName().toString() + "=")) { ret.add(elem.getSimpleName().toString()); } } if (ret.isEmpty()) { for (String att : getAttributesFromClassLoader(clazz)) { if (StringUtils.startsWithIgnoreCase(att, filter) && !StringUtils.contains(text, att + " ") && !StringUtils.contains(text, att + "=")) { ret.add(att); } } } return ret; }
From source file:com.jnj.b2b.storefront.filters.UrlEncoderFilter.java
@Override protected void doFilterInternal(final HttpServletRequest request, final HttpServletResponse response, final FilterChain filterChain) throws ServletException, IOException { if (LOG.isDebugEnabled()) { LOG.debug(" The incoming URL : [" + request.getRequestURL().toString() + "]"); }/*w w w. j a v a2 s .c o m*/ final List<UrlEncoderData> currentUrlEncoderDatas = getUrlEncoderFacade().getCurrentUrlEncodingData(); if (currentUrlEncoderDatas != null && !currentUrlEncoderDatas.isEmpty()) { final String currentPattern = getSessionService().getAttribute(WebConstants.URL_ENCODING_ATTRIBUTES); final String newPattern = getUrlEncoderFacade().calculateAndUpdateUrlEncodingData( request.getRequestURI().toString(), request.getContextPath()); final String newPatternWithSlash = "/" + newPattern; if (!StringUtils.equalsIgnoreCase(currentPattern, newPatternWithSlash)) { getUrlEncoderFacade().updateSiteFromUrlEncodingData(); getSessionService().setAttribute(WebConstants.URL_ENCODING_ATTRIBUTES, newPatternWithSlash); } final UrlEncodeHttpRequestWrapper wrappedRequest = new UrlEncodeHttpRequestWrapper(request, newPattern); wrappedRequest.setAttribute(WebConstants.URL_ENCODING_ATTRIBUTES, newPatternWithSlash); wrappedRequest.setAttribute("originalContextPath", StringUtils.isBlank(request.getContextPath()) ? "/" : request.getContextPath()); if (LOG.isDebugEnabled()) { LOG.debug("ContextPath=[" + wrappedRequest.getContextPath() + "]" + " Servlet Path= [" + wrappedRequest.getServletPath() + "]" + " Request Url= [" + wrappedRequest.getRequestURL() + "]"); } filterChain.doFilter(wrappedRequest, response); } else { if (LOG.isDebugEnabled()) { LOG.debug(" No URL attributes defined"); } request.setAttribute(WebConstants.URL_ENCODING_ATTRIBUTES, ""); filterChain.doFilter(request, response); } }
From source file:hydrograph.ui.graph.debugconverter.DebugHelper.java
/** * This function used to return subgraph component_Id and socket_Id * *//*from ww w . ja va 2s . co m*/ public List<String> getSubgraphComponent(Component component) throws CoreException { Container container = null; subjobWatcherList = new ArrayList<>(); if (StringUtils.equalsIgnoreCase(component.getComponentName(), Constants.SUBJOB_COMPONENT)) { String subgraphFilePath = (String) component.getProperties().get(Constants.JOB_PATH); if (StringUtils.isNotBlank(subgraphFilePath)) { IPath jobPath = new Path(subgraphFilePath); if (jobPath.toFile().exists()) { XStream xs = new XStream(); container = (Container) xs.fromXML(jobPath.toFile()); List<Link> links = null; for (Component component_temp : container.getUIComponentList()) { if (StringUtils.equalsIgnoreCase(component_temp.getComponentLabel().getLabelContents(), Constants.OUTPUT_SUBJOB)) { links = component_temp.getTargetConnections(); } } if (links != null) { for (Link str : links) { String sub_comp = str.getSource().getComponentLabel().getLabelContents(); String sub_comp_port = str.getSourceTerminal(); subjobWatcherList.add(sub_comp + "." + sub_comp_port); } } return subjobWatcherList; } else { if (ResourcesPlugin.getWorkspace().getRoot().getFile(jobPath).exists()) { XStream xs = new XStream(); container = (Container) xs.fromXML( ResourcesPlugin.getWorkspace().getRoot().getFile(jobPath).getContents(true)); List<Link> links = null; for (Component component_temp : container.getUIComponentList()) { if (StringUtils.equalsIgnoreCase(component_temp.getComponentLabel().getLabelContents(), Constants.OUTPUT_SUBJOB)) { links = component_temp.getTargetConnections(); break; } } if (links != null) { for (Link link : links) { Map<String, Port> map = link.getSource().getPorts(); for (Entry<String, Port> entry : map.entrySet()) { Port port = entry.getValue(); String type = port.getPortType(); if ((type.equalsIgnoreCase("out") || type.equalsIgnoreCase("unused")) && port.isWatched()) { Component component2 = port.getParent(); String subjob_componenetId = component2.getComponentLabel() .getLabelContents(); String subjob__socketId = port.getTerminal(); subjobWatcherList.add(subjob_componenetId + "." + subjob__socketId); } } } } return subjobWatcherList; } } } } return null; }
From source file:cec.easyshop.storefront.filters.UrlEncoderFilter.java
@Override protected void doFilterInternal(final HttpServletRequest request, final HttpServletResponse response, final FilterChain filterChain) throws ServletException, IOException { if (LOG.isDebugEnabled()) { LOG.debug(" The incoming URL : [" + request.getRequestURL().toString() + "]"); }/* w ww.j ava 2 s. c o m*/ final List<UrlEncoderData> currentUrlEncoderDatas = getUrlEncoderFacade().getCurrentUrlEncodingData(); if (currentUrlEncoderDatas != null && !currentUrlEncoderDatas.isEmpty()) { final String currentPattern = getSessionService().getAttribute(WebConstants.URL_ENCODING_ATTRIBUTES); final String newPattern = getUrlEncoderFacade().calculateAndUpdateUrlEncodingData( request.getRequestURI().toString(), request.getContextPath()); final String newPatternWithSlash = "/" + newPattern; if (!StringUtils.equalsIgnoreCase(currentPattern, newPatternWithSlash)) { getUrlEncoderFacade().updateSiteFromUrlEncodingData(); getSessionService().setAttribute(WebConstants.URL_ENCODING_ATTRIBUTES, newPatternWithSlash); } final UrlEncodeHttpRequestWrapper wrappedRequest = new UrlEncodeHttpRequestWrapper(request, newPattern); wrappedRequest.setAttribute(WebConstants.URL_ENCODING_ATTRIBUTES, newPatternWithSlash); wrappedRequest.setAttribute("originalContextPath", StringUtils.isBlank(request.getContextPath()) ? "/" : request.getContextPath()); if (LOG.isDebugEnabled()) { LOG.debug("ContextPath=[" + wrappedRequest.getContextPath() + "]" + " Servlet Path= [" + wrappedRequest.getServletPath() + "]" + " Request Url= [" + wrappedRequest.getRequestURL() + "]"); } filterChain.doFilter(wrappedRequest, response); } else { if (LOG.isDebugEnabled()) { LOG.debug(" No URL attributes defined"); } request.setAttribute(WebConstants.URL_ENCODING_ATTRIBUTES, ""); filterChain.doFilter(request, response); } }