Package lt.velykis.maven.skins.reflow
Class URITool
- java.lang.Object
-
- lt.velykis.maven.skins.reflow.URITool
-
@DefaultKey("uriTool") public class URITool extends Object
An Apache Velocity tool that provides utility methods to work with URIs/URLs and links.- Since:
- 1.0
- Author:
- Andrius Velykis
-
-
Constructor Summary
Constructors Constructor Description URITool()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
relativizeLink(String baseDirUri, String link)
Resolves the link as relative to the base dir URI.static URI
toURI(String uri)
-
-
-
Method Detail
-
relativizeLink
public static String relativizeLink(String baseDirUri, String link)
Resolves the link as relative to the base dir URI.Relativizes only absolute links, if the link has the same scheme, host and port as the base, it is made into a relative link as viewed from the base.
This is the same method that's used to relativize project links in Maven site.
- Parameters:
baseDirUri
- URI that will serve as the base to calculate the relative onelink
- The link to relativize (make it relative to the base URI if possible)- Returns:
- the relative link, if calculated, or the original link if not.
- Since:
- 1.0
-
-