Example usage for org.apache.commons.lang3 StringUtils substringAfter

List of usage examples for org.apache.commons.lang3 StringUtils substringAfter

Introduction

In this page you can find the example usage for org.apache.commons.lang3 StringUtils substringAfter.

Prototype

public static String substringAfter(final String str, final String separator) 

Source Link

Document

Gets the substring after the first occurrence of a separator.

Usage

From source file:nl.armatiek.xslweb.configuration.WebApp.java

public String getRelativePath(String path) {
    return (name.equals("ROOT")) ? path : StringUtils.substringAfter(path, "/" + name);
}

From source file:nl.armatiek.xslweb.serializer.RequestSerializer.java

private void serializeProperties() throws Exception {
    dataElement(xsw, URI, "auth-type", req.getAuthType());
    dataElement(xsw, URI, "character-encoding", req.getCharacterEncoding());
    dataElement(xsw, URI, "content-length", Integer.toString(req.getContentLength()));
    dataElement(xsw, URI, "context-path", req.getContextPath());
    dataElement(xsw, URI, "content-type", req.getContentType());
    dataElement(xsw, URI, "local-addr", req.getLocalAddr());
    // locale/*from   w w w. j  av a2  s . c o m*/
    dataElement(xsw, URI, "local-name", req.getLocalName());
    dataElement(xsw, URI, "local-port", Integer.toString(req.getLocalPort()));
    dataElement(xsw, URI, "method", req.getMethod());
    String path = StringUtils.substringAfter(safeString(req.getServletPath()) + safeString(req.getPathInfo()),
            webApp.getPath());
    if (StringUtils.isBlank(path)) {
        path = "/";
    }
    dataElement(xsw, URI, "path", path);
    dataElement(xsw, URI, "path-info", req.getPathInfo());
    dataElement(xsw, URI, "path-translated", req.getPathTranslated());
    dataElement(xsw, URI, "protocol", req.getProtocol());
    dataElement(xsw, URI, "query-string", req.getQueryString());
    dataElement(xsw, URI, "remote-addr", req.getRemoteAddr());
    dataElement(xsw, URI, "remote-host", req.getRemoteHost());
    dataElement(xsw, URI, "remote-port", Integer.toString(req.getRemotePort()));
    dataElement(xsw, URI, "remote-user", req.getRemoteUser());
    dataElement(xsw, URI, "requested-session-id", req.getRequestedSessionId());
    dataElement(xsw, URI, "request-URI", req.getRequestURI());
    dataElement(xsw, URI, "request-url", req.getRequestURL().toString());
    dataElement(xsw, URI, "scheme", req.getScheme());
    dataElement(xsw, URI, "server-name", req.getServerName());
    dataElement(xsw, URI, "server-port", Integer.toString(req.getServerPort()));
    dataElement(xsw, URI, "servlet-path", req.getServletPath());
    dataElement(xsw, URI, "webapp-path", webApp.getPath());
    // userPrincipal
    dataElement(xsw, URI, "is-secure", Boolean.toString(req.isSecure()));
    dataElement(xsw, URI, "is-requested-session-id-from-cookie",
            Boolean.toString(req.isRequestedSessionIdFromCookie()));
    dataElement(xsw, URI, "is-requested-session-id-from-url",
            Boolean.toString(req.isRequestedSessionIdFromURL()));
    dataElement(xsw, URI, "is-requested-session-id-valid", Boolean.toString(req.isRequestedSessionIdValid()));
    // isUserInRole
    // login
    // logout
}

From source file:nl.imvertor.ReadmeCompiler.ReadmeCompiler.java

/**
 * Return all files paths as ;-separated string.
 * //  w  ww  . j a  va 2 s .c  o  m
 * @param folderPath The folder to search, recursively
 * @param prefix A path to prefix before the subpath of the file found.
 * @return String holding all (sub)paths.
 * @throws Exception
 */

private String listFiles(String folderPath, String prefix) throws Exception {
    AnyFolder folder = new AnyFolder(folderPath);
    if (folder != null && folder.isDirectory()) {
        String base = folder.toURI().toString();
        Vector<String> list1 = folder.listFilesToVector(true);
        Iterator<String> it = list1.iterator();
        String list2 = "";
        while (it.hasNext()) {
            File f = new File(it.next());
            list2 += prefix + StringUtils.substringAfter(f.toURI().toString(), base);
            list2 += (it.hasNext()) ? ";" : "";
        }
        return list2;
    } else
        return "";
}

From source file:org.ahp.commons.util.AhpResourceUtil.java

/**
 * //from ww w .j  av  a 2s.  c o  m
 * @param pResourceUri
 * @return
 */
public static String getClassPathResourcePath(String pResourceUri) {
    if (isClassPathResource(pResourceUri)) {
        return StringUtils.substringAfter(pResourceUri, CLASSPATH_RESOURCE_PREFIX);
    }
    return null;
}

From source file:org.ahp.commons.util.AhpResourceUtil.java

/**
 * //from  ww  w  .  ja v  a  2  s.c o  m
 * @param pResourceUri
 * @return
 */
public static String getFileResourcePath(String pResourceUri) {
    if (isFileResource(pResourceUri)) {
        return StringUtils.substringAfter(pResourceUri.trim(), FILE_RESOURCE_PREFIX);
    }
    return null;
}

From source file:org.ahp.commons.util.AhpResourceUtil.java

/**
 * // w  w  w  .j  a va2 s .co m
 * @param pClasspathResourceUri
 * @return
 */
public static URL getClassPathResourceAsFileUrl(String pClasspathResourceUri) {
    if (isClassPathResource(pClasspathResourceUri)) {
        pClasspathResourceUri = StringUtils.substringAfter(pClasspathResourceUri,
                CLASSPATH_RESOURCE_PREFIX + "/");
        System.out.println(pClasspathResourceUri);
        return Thread.currentThread().getContextClassLoader().getResource(pClasspathResourceUri);
    }
    throw new AhpRuntimeException("AHP.110.0001");
}

From source file:org.alfresco.po.share.search.FacetedSearchPage.java

/**
 * Gets the current url hash./*from w  w  w .  ja va  2  s. c  o m*/
 *
 * @return the url hash
 */
public String getUrlHash() {
    String url = this.driver.getCurrentUrl();

    // Empty url or no #
    if (StringUtils.isEmpty(url) || !StringUtils.contains(url, "#")) {
        return null;
    }

    return StringUtils.substringAfter(url, "#");
}

From source file:org.aliuge.crawler.extractor.selector.action.string.StringAfterAction.java

License:asdf

@Override
public String doAction(String content) {
    if (StringUtils.isNotBlank(content)) {
        return StringUtils.substringAfter(content, separator);
    }//from  w  w w  . ja  va2s . c  o m
    return "";
}

From source file:org.apache.cassandra.index.SecondaryIndexManager.java

/**
 * Returns the index name//from   www  .j a va  2 s.  com
 *
 * @param cfName the <code>ColumnFamilyStore</code> name
 * @return the index name
 */
public static String getIndexName(String cfName) {
    assert isIndexColumnFamily(cfName);
    return StringUtils.substringAfter(cfName, Directories.SECONDARY_INDEX_NAME_SEPARATOR);
}

From source file:org.apache.hadoop.gateway.config.impl.GatewayConfigImpl.java

/**
 * Map of Topology names and their ports.
 *
 * @return//from   w  w w .  j  a v a  2s. c  o m
 */
@Override
public Map<String, Integer> getGatewayPortMappings() {

    final Map<String, Integer> result = new ConcurrentHashMap<String, Integer>();
    final Map<String, String> properties = getValByRegex(GATEWAY_PORT_MAPPING_REGEX);

    // Convert port no. from string to int
    for (final Map.Entry<String, String> e : properties.entrySet()) {
        // ignore the GATEWAY_PORT_MAPPING_ENABLED property
        if (!e.getKey().equalsIgnoreCase(GATEWAY_PORT_MAPPING_ENABLED)) {
            // extract the topology name and use it as a key
            result.put(StringUtils.substringAfter(e.getKey(), GATEWAY_PORT_MAPPING_PREFIX),
                    Integer.parseInt(e.getValue()));
        }

    }

    return Collections.unmodifiableMap(result);
}