public class PathAdjuster extends Object
path ajustment utility for image, style sheet, etc.
target tag and attribute.tag | attribute |
---|---|
a | href |
applet | code |
codebase | |
area | href |
audio | src |
base | href |
blockquote | cite |
del | cite |
embed | src |
form | action |
iframe | src |
img | src |
usemap | |
input | src |
usemap | |
ins | cite |
link | href |
object | codebase |
data | |
usemap | |
q | cite |
script | src |
track | src |
video | src |
Constructor and Description |
---|
PathAdjuster() |
Modifier and Type | Method and Description |
---|---|
static <T extends AbstractJaxb> |
replacePath(T target,
Pattern pattern,
String replacement)
replace all the path.
|
static <T extends AbstractJaxb> |
replacePathExclude(T target,
Pattern pattern,
String replacement,
List<String> excludeClazz,
List<Class<?>> excludeTagType) |
static <T extends AbstractJaxb> |
replacePathExcludeClass(T target,
Pattern pattern,
String replacement,
List<String> excludeClazz) |
static <T extends AbstractJaxb> |
replacePathExcludeTag(T target,
Pattern pattern,
String replacement,
List<Class<?>> excludeTagType) |
static <T extends AbstractJaxb> |
replacePathInclude(T target,
Pattern pattern,
String replacement,
List<String> includeClazz,
List<Class<?>> includeTagType) |
static <T extends AbstractJaxb> |
replacePathIncludeClass(T target,
Pattern pattern,
String replacement,
List<String> includeClazz) |
static <T extends AbstractJaxb> |
replacePathIncludeTag(T target,
Pattern pattern,
String replacement,
List<Class<?>> includeTagType) |
public static <T extends AbstractJaxb> void replacePath(T target, Pattern pattern, String replacement)
replace all the path.
template html
<html>
<head>
<script src="foo/bar.js"> </script>
</head>
<body>
<a href="foo/bar.html">bar.html</a>
<img src="foo/bar.png" />
</body>
</html>
code
Html html = mixer2Engine.loadHtmlTemplate(templateString);
PathAjuster.replacePath(html, Pattern.compile("^foo/"), "xyz/");
System.out.println(mixer2Engine.saveToString(html));
result:
<html>
<head>
<script src="xyz/bar.js"> </script>
</head>
<body>
<a href="xyz/bar.html">bar.html</a>
<img src="xyz/bar.png" />
</body>
</html>
target
- tagpattern
- regex patternreplacement
- replacemnet string.public static <T extends AbstractJaxb> void replacePathIncludeClass(T target, Pattern pattern, String replacement, List<String> includeClazz)
public static <T extends AbstractJaxb> void replacePathIncludeTag(T target, Pattern pattern, String replacement, List<Class<?>> includeTagType)
public static <T extends AbstractJaxb> void replacePathInclude(T target, Pattern pattern, String replacement, List<String> includeClazz, List<Class<?>> includeTagType)
public static <T extends AbstractJaxb> void replacePathExcludeClass(T target, Pattern pattern, String replacement, List<String> excludeClazz)
public static <T extends AbstractJaxb> void replacePathExcludeTag(T target, Pattern pattern, String replacement, List<Class<?>> excludeTagType)
Copyright © 2021 Project Mixer2. All rights reserved.