if (isRelevant(request, wrappedResponse)) {
String html = new String(bytes);
Set<Asset> assetsHead = new AssetQuery(request, context).withPosition(AssetDomPosition.head).perform();
if (!assetsHead.isEmpty()) {
StringBuilder htmlHead = new StringBuilder();
for (Asset asset : assetsHead) {
HtmlTag tag = HtmlUtils.transformAsset(asset);
htmlHead.append(tag.toHtml());
htmlHead.append('\n');
}
html = html.replace("</head>", htmlHead + "\n</head>");
}
Set<Asset> assetsBody = new AssetQuery(request, context).withPosition(AssetDomPosition.body).perform();
if (!assetsBody.isEmpty()) {
StringBuilder htmlBody = new StringBuilder();
for (Asset asset : assetsBody) {
HtmlTag tag = HtmlUtils.transformAsset(asset);