AEM 将 html 信息评论插入 json
AEM inserts html info comment into json
我有以下jsp
<%
JSONObject jsonResult = new JSONObject();
response.setContentType("application/json");
String parentNodePath = slingRequest.getRequestPathInfo().getResourcePath();
String url = getServerBaseUrl(sling) + parentNodePath.split("/jcr:content")[0] + ".html?cid=twitter";
UrlShortener urlShortener = sling.getService(UrlShortener.class);
String shortUrl = urlShortener.shorten(url);
String encShortUrl = URLEncoder.encode(shortUrl);
jsonResult.put("url", url);
jsonResult.put("shortUrl", shortUrl);
jsonResult.put("encShortUrl", encShortUrl);
%>
<%=jsonResult.toString()%>
当我在浏览器中输入以下地址时执行http://servername:port/path/to/page.urlshortener.html.jsp
如您所见,我有 "application/json" contentType。结果必须只包含 json 条信息,但有 html 条评论:
{
"url":"http://servername/content/app/test/test1/naps1.html?cid=twitter",
"shortUrl":"http://servername/1E4sZYJ",
"encShortUrl":"http%3A%2F%2Fservername%2F1E4sZYJ"
}
<!--
cq{
"decorated":false,
"type":"app/components/page/newsarticlepage",
"path":"/content/app/test/test1/naps1/jcr:content",
"selectors":"urlshortener",
"servlet": "Script/apps/app/components/page/contentpage/urlshortener.html.jsp","totalTime":276,"selfTime":276
}
-->
我还看到,这个注释插入在每个组件之后,或者在任何页面执行jsp。
如何关闭此评论的插入?
为创作界面添加了评论<!-- cq{ ... } -->
。它们不包含在禁用 wcmmode 的发布实例中。您可以通过将 wcmmode=disabled
作为查询参数添加到 url 的末尾来查看。此外,您还必须从 url.
中删除 cf#
或 editor.html
我有以下jsp
<%
JSONObject jsonResult = new JSONObject();
response.setContentType("application/json");
String parentNodePath = slingRequest.getRequestPathInfo().getResourcePath();
String url = getServerBaseUrl(sling) + parentNodePath.split("/jcr:content")[0] + ".html?cid=twitter";
UrlShortener urlShortener = sling.getService(UrlShortener.class);
String shortUrl = urlShortener.shorten(url);
String encShortUrl = URLEncoder.encode(shortUrl);
jsonResult.put("url", url);
jsonResult.put("shortUrl", shortUrl);
jsonResult.put("encShortUrl", encShortUrl);
%>
<%=jsonResult.toString()%>
当我在浏览器中输入以下地址时执行http://servername:port/path/to/page.urlshortener.html.jsp
如您所见,我有 "application/json" contentType。结果必须只包含 json 条信息,但有 html 条评论:
{
"url":"http://servername/content/app/test/test1/naps1.html?cid=twitter",
"shortUrl":"http://servername/1E4sZYJ",
"encShortUrl":"http%3A%2F%2Fservername%2F1E4sZYJ"
}
<!--
cq{
"decorated":false,
"type":"app/components/page/newsarticlepage",
"path":"/content/app/test/test1/naps1/jcr:content",
"selectors":"urlshortener",
"servlet": "Script/apps/app/components/page/contentpage/urlshortener.html.jsp","totalTime":276,"selfTime":276
}
-->
我还看到,这个注释插入在每个组件之后,或者在任何页面执行jsp。 如何关闭此评论的插入?
为创作界面添加了评论<!-- cq{ ... } -->
。它们不包含在禁用 wcmmode 的发布实例中。您可以通过将 wcmmode=disabled
作为查询参数添加到 url 的末尾来查看。此外,您还必须从 url.
cf#
或 editor.html