Java Path Normalize normalizeMediaPath(String hrefBaseUrl, String localMediaPath, String href)

Here you can find the source of normalizeMediaPath(String hrefBaseUrl, String localMediaPath, String href)

Description

Normalizes a HREF so it points to the local media Eclipse project

License

Open Source License

Parameter

Parameter Description
hrefBaseUrl - part of URL to strip from href. Needs to end with forward slash
localMediaPath - path to prefix to the stripped href. Needs to end with forward slash
href - href to normalize

Return

normalized href

Declaration

public static String normalizeMediaPath(String hrefBaseUrl, String localMediaPath, String href) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /**//from  w w  w. j a va 2s.c o m
     * Normalizes a HREF so it points to the local media Eclipse project
     * @param hrefBaseUrl - part of URL to strip from href.  Needs to end with forward slash
     * @param localMediaPath - path to prefix to the stripped href.  Needs to end with forward slash
     * @param href - href to normalize
     * @return normalized href
     */
    public static String normalizeMediaPath(String hrefBaseUrl, String localMediaPath, String href) {
        String result = "";
        try {
            result = localMediaPath + href.split(hrefBaseUrl)[1];
        } catch (Exception e) {
            //         e.printStackTrace();
            result = localMediaPath + href;
        }
        return result;
    }
}

Related

  1. normalizeDotSegment(String path)
  2. normalizedPath(String original)
  3. normalizeFileSystemPath(String path)
  4. normalizeFullPath(String path)
  5. normalizeLocalPath(final String localPath)
  6. normalizeName(final String path, final boolean isDirectory)
  7. NormalizeName(String absolutePath)
  8. normalizePath(final String in)
  9. normalizePath(final String path)