in src/main/java/org/apache/sling/engine/impl/request/SlingRequestPathInfo.java [127:183]
public SlingRequestPathInfo merge(RequestDispatcherOptions options) {
if (options != null) {
// set to true if any option is set
boolean needCreate = false;
// replacement selectors
String selectors = options.getReplaceSelectors();
if (selectors != null) {
// if we get the empty string, all original selectors will be removed
if (selectors.length() == 0) {
selectors = null;
}
needCreate = true;
} else {
selectors = getSelectorString();
}
// additional selectors
String selectorsAdd = options.getAddSelectors();
if (selectorsAdd != null) {
if (selectors != null) {
selectors += "." + selectorsAdd;
} else {
selectors = selectorsAdd;
}
needCreate = true;
}
// suffix replacement
String suffix = options.getReplaceSuffix();
if (suffix != null) {
needCreate = true;
} else {
suffix = getSuffix();
}
// extension replacement
String extension = options.getReplaceExtension();
if (extension != null) {
// if we get an empty string, set extension to null
if (extension.isEmpty()) {
extension = null;
}
needCreate = true;
} else {
extension = getExtension();
}
if (needCreate) {
return new SlingRequestPathInfo(getResource(), getResourcePath(), selectors, extension, suffix);
}
}
return this;
}