Here you can find the source of normalizeMediaPath(String hrefBaseUrl, String localMediaPath, String href)
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 |
public static String normalizeMediaPath(String hrefBaseUrl, String localMediaPath, String href)
//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; } }