List of usage examples for org.apache.commons.lang StringUtils substringAfter
public static String substringAfter(String str, String separator)
Gets the substring after the first occurrence of a separator.
From source file:jetbrick.tools.chm.style.JavadocStyle.java
public String getMethodFullName(String url) { return StringUtils.substringAfter(url, "#"); }
From source file:eu.europeana.corelib.search.utils.SearchUtils.java
/** * Checks if there is no TYPE facet with an invalid type according to EDM * * * @param refinements// ww w . j a v a2 s. c o m * @return Returns true if there is no TYPE facet or each type facet has * valid value */ public static boolean checkTypeFacet(String[] refinements) { if (refinements != null) { for (String refinement : refinements) { if (StringUtils.contains(refinement, "TYPE:") && !StringUtils.contains(refinement, " OR ")) { if (DocType.safeValueOf(StringUtils.substringAfter(refinement, "TYPE:")) == null) { return false; } } } } return true; }
From source file:com.streamsets.pipeline.lib.parser.log.LEEFParser.java
@Override public Field getExtFormatVersion(String val) { double leefVersion = Double.parseDouble(StringUtils.substringAfter(val, ":")); return Field.create(leefVersion); }
From source file:info.magnolia.cms.util.RequestDispatchUtil.java
/** * Returns true if processing took place, even if it fails. */// w ww .j a va2 s . co m public static boolean dispatch(String targetUri, HttpServletRequest request, HttpServletResponse response) { if (targetUri == null) { return false; } if (targetUri.startsWith(REDIRECT_PREFIX)) { String redirectUrl = StringUtils.substringAfter(targetUri, REDIRECT_PREFIX); try { if (isInternal(redirectUrl)) { redirectUrl = request.getContextPath() + redirectUrl; } response.sendRedirect(response.encodeRedirectURL(redirectUrl)); } catch (IOException e) { log.error("Failed to redirect to {}:{}", targetUri, e.getMessage()); } return true; } if (targetUri.startsWith(PERMANENT_PREFIX)) { String permanentUrl = StringUtils.substringAfter(targetUri, PERMANENT_PREFIX); try { if (isInternal(permanentUrl)) { if (isUsingStandardPort(request)) { permanentUrl = new URL(request.getScheme(), request.getServerName(), request.getContextPath() + permanentUrl).toExternalForm(); } else { permanentUrl = new URL(request.getScheme(), request.getServerName(), request.getServerPort(), request.getContextPath() + permanentUrl).toExternalForm(); } } response.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY); response.setHeader("Location", permanentUrl); } catch (MalformedURLException e) { log.error("Failed to create permanent url to redirect to {}:{}", targetUri, e.getMessage()); } return true; } if (targetUri.startsWith(FORWARD_PREFIX)) { String forwardUrl = StringUtils.substringAfter(targetUri, FORWARD_PREFIX); try { request.getRequestDispatcher(forwardUrl).forward(request, response); } catch (Exception e) { log.error("Failed to forward to {} - {}:{}", new Object[] { forwardUrl, ClassUtils.getShortClassName(e.getClass()), e.getMessage() }); } return true; } return false; }
From source file:de.hybris.platform.acceleratorservices.fraud.symptom.impl.AcceleratorBlackListSymptom.java
protected String getCustomerUid(final String uid, final AbstractOrderModel order) { return (order.getUser() instanceof CustomerModel && CustomerType.GUEST.equals(((CustomerModel) order.getUser()).getType())) ? StringUtils.substringAfter(uid, "|") : uid;// w w w .ja v a2 s . co m }
From source file:de.hybris.platform.acceleratorservices.fraud.symptom.impl.AcceleratorWhiteListSymptom.java
protected String getCustomerUid(final String uid, final AbstractOrderModel order) { return (order.getUser() instanceof CustomerModel && CustomerType.GUEST.equals(((CustomerModel) order.getUser()).getType()) ? StringUtils.substringAfter(uid, "|") : uid);// ww w .java 2s.co m }
From source file:eu.europeana.corelib.edm.utils.construct.EuropeanaAggregationSolrCreator.java
public void create(SolrInputDocument doc, EuropeanaAggregation aggr) { SolrUtils.addFromString(doc, EdmLabel.EDM_EUROPEANA_AGGREGATION, aggr.getAbout()); SolrUtils.addFromMap(doc, EdmLabel.EUROPEANA_AGGREGATION_DC_CREATOR, aggr.getDcCreator()); SolrUtils.addFromMap(doc, EdmLabel.EUROPEANA_AGGREGATION_EDM_COUNTRY, aggr.getEdmCountry()); SolrUtils.addFromMap(doc, EdmLabel.EUROPEANA_AGGREGATION_EDM_LANGUAGE, aggr.getEdmLanguage()); SolrUtils.addFromStringArray(doc, EdmLabel.EUROPEANA_AGGREGATION_ORE_AGGREGATES, aggr.getAggregates()); SolrUtils.addFromStringArray(doc, EdmLabel.EUROPEANA_AGGREGATION_EDM_HASVIEW, aggr.getEdmHasView()); SolrUtils.addFromString(doc, EdmLabel.EUROPEANA_AGGREGATION_ORE_AGGREGATEDCHO, aggr.getAggregatedCHO()); SolrUtils.addFromString(doc, EdmLabel.EUROPEANA_AGGREGATION_EDM_LANDINGPAGE, PORTAL_PREFIX + StringUtils.substringAfter(aggr.getAggregatedCHO(), "/item/") + PORTAL_SUFFIX); SolrUtils.addFromString(doc, EdmLabel.EUROPEANA_AGGREGATION_EDM_ISSHOWNBY, aggr.getEdmIsShownBy()); SolrUtils.addFromString(doc, EdmLabel.EUROPEANA_AGGREGATION_EDM_PREVIEW, aggr.getEdmPreview()); if (aggr.getWebResources() != null) { for (WebResource wr : aggr.getWebResources()) { new WebResourceSolrCreator().create(doc, wr, new ArrayList<String>()); }//from ww w .j a v a2s. c om } }
From source file:net.hillsdon.reviki.wiki.renderer.creole.CreoleLinkContentsSplitter.java
/** * Splits links of the form target or text|target where target is * //from ww w. j a v a2s .co m * PageName wiki:PageName PageName#fragment wiki:PageName#fragment * A String representing an absolute URI scheme://valid/absolute/uri * Any character not in the `unreserved`, `punct`, `escaped`, or `other` categories (RFC 2396), * and not equal '/' or '@', is %-encoded. * * @param in The String to split * @return The split LinkParts */ LinkParts split(final String in) { String target = StringUtils.trimToEmpty(StringUtils.substringBefore(in, "|")); String text = StringUtils.trimToNull(StringUtils.substringAfter(in, "|")); if (target == null) { target = ""; } if (text == null) { text = target; } // Link target can be PageName, wiki:PageName or a URL. URI uri = null; try { URL url = new URL(target); uri = new URI(url.getProtocol(), url.getUserInfo(), url.getHost(), url.getPort(), url.getPath(), url.getQuery(), url.getRef()); if (uri.getPath() == null || !uri.isAbsolute()) { uri = null; } } catch (URISyntaxException e) { // uri remains null } catch (MalformedURLException e) { // uri remains null } if (uri != null) { return new LinkParts(text, uri); } else { // Split into wiki:pageName String[] parts = target.split(":", 2); String wiki = null; String pageName = target; if (parts.length == 2) { wiki = parts[0]; pageName = parts[1]; } // Split into pageName#fragment parts = pageName.split("#", 2); String fragment = null; if (parts.length == 2) { pageName = parts[0]; fragment = parts[1]; } // Split into pageName/attachment parts = pageName.split("/", 2); String attachment = null; if (parts.length == 2) { pageName = parts[0]; attachment = parts[1]; } return new LinkParts(text, wiki, pageName, fragment, attachment); } }
From source file:it.cineca.pst.huborcid.web.filter.StaticResourcesProductionFilter.java
@Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest httpRequest = (HttpServletRequest) request; String contextPath = ((HttpServletRequest) request).getContextPath(); String requestURI = httpRequest.getRequestURI(); requestURI = StringUtils.substringAfter(requestURI, contextPath); if (StringUtils.equals("/", requestURI)) { requestURI = "/index.html"; }/*from www . ja va2 s . c om*/ String newURI = "/dist" + requestURI; request.getRequestDispatcher(newURI).forward(request, response); }
From source file:com.bstek.dorado.view.resolver.LibraryFileResolver.java
private String getDefaultPlatformSkin(String currentSkin) { int i = currentSkin.indexOf('.'); if (i > 0) { return DEFAULT_SKIN_PREFIX + StringUtils.substringAfter(currentSkin, "."); } else {//from w w w . j a v a2s . c o m return DEFAULT_SKIN; } }