적응형 양식을 AEM Sites 페이지 또는 AEM 외부에 호스트된 웹 페이지에 포함할 수 있습니다. 포함된 적응형 양식은 완전히 기능하며 사용자는 페이지를 종료하지 않고 양식을 작성하고 제출할 수 있습니다. 따라서 사용자는 웹 페이지에서 다른 요소의 컨텍스트에 남아 있고 양식과 동시에 상호 작용할 수 있습니다.
적응형 양식을 외부 웹 사이트에 포함하기 전에 다음 단계를 수행하십시오
웹 페이지에 JavaScript 몇 줄을 삽입하여 적응형 양식을 포함할 수 있습니다. 코드의 API는 적응형 양식 리소스를 위해 AEM 서버에 HTTP 요청을 보내고 지정된 양식 컨테이너에 적응형 양식을 삽입합니다.
적응형 양식을 포함하려면 다음을 수행합니다.
다음 코드를 사용하여 웹 사이트에서 웹 페이지를 만듭니다.
<!doctype html>
<html>
<head>
<title>This is the title of the webpage!</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
</head>
<body>
<div class="customafsection"/>
<p>This section is replaced with the adaptive form.</p>
<script>
var options = {path:"/content/forms/af/locbasic.html", dataRef:"", themepath:"", CSS_Selector:".customafsection"};
alert(options.path);
var loadAdaptiveForm = function(options){
//alert(options.path);
if(options.path) {
// options.path refers to the publish URL of the adaptive form
// For Example: https:myserver:4503/content/forms/af/ABC, where ABC is the adaptive form
// Note: If AEM server is running on a context path, the adaptive form URL must contain the context path
var path = options.path;
path += "/jcr:content/guideContainer.html";
$.ajax({
url : path ,
type : "GET",
data : {
// Set the wcmmode to be disabled
wcmmode : "disabled"
// Set the data reference, if any
// "dataRef": options.dataRef
// Specify a different theme for the form object
// "themeOverride" : options.themepath
},
async: false,
success: function (data) {
// If jquery is loaded, set the inner html of the container
// If jquery is not loaded, use APIs provided by document to set the inner HTML but these APIs would not evaluate the script tag in HTML as per the HTML5 spec
// For example: document.getElementById().innerHTML
if(window.$ && options.CSS_Selector){
// HTML API of jquery extracts the tags, updates the DOM, and evaluates the code embedded in the script tag.
$(options.CSS_Selector).html(data);
}
},
error: function (data) {
// any error handler
}
});
} else {
if (typeof(console) !== "undefined") {
console.log("Path of Adaptive Form not specified to loadAdaptiveForm");
}
}
}(options);
</script>
</body>
</html>
포함된 코드에서:
적응형 양식은 웹 페이지에 포함됩니다. 포함된 적응형 양식에서 다음을 관찰합니다.
적응형 양식을 포함하는 외부 웹 페이지는 일반적으로 개인 네트워크의 방화벽 뒤에 있는 AEM 서버에 요청을 보냅니다. 요청이 AEM 서버로 안전하게 전달되도록 하려면 역방향 프록시 서버를 설정하는 것이 좋습니다.
디스패처 없이 Apache 2.4 역방향 프록시 서버를 설정하는 방법을 예제를 살펴보겠습니다. 이 예에서는 /forms
컨텍스트 경로를 사용하여 AEM 서버를 호스팅하고 역방향 프록시에 대해 /forms
을 매핑합니다. Apache 서버의 /forms
요청에 대한 모든 요청이 AEM 인스턴스로 전달되도록 합니다. 이 토폴로지는 AEM 서버로 /forms
라우팅이 접두사로 추가된 모든 요청과 같이 디스패처 레이어의 규칙 수를 줄이는 데 도움이 됩니다.
httpd.conf
구성 파일을 열고 다음 코드 줄의 주석을 해제합니다. 또는 파일에 이러한 코드 행을 추가할 수 있습니다.
LoadModule proxy_html_module modules/mod_proxy_html.so
LoadModule proxy_http_module modules/mod_proxy_http.so
httpd-proxy.conf
구성 파일에 다음 코드 행을 추가하여 프록시 규칙을 설정합니다.
ProxyPass /forms https://[AEM_Instance]/forms
ProxyPassReverse /forms https://[AEM_Instance]/forms
[AEM_Instance]
을 규칙의 AEM 서버 게시 URL로 바꿉니다.
컨텍스트 경로에 AEM 서버를 마운트하지 않으면 Apache 레이어의 프록시 규칙은 다음과 같습니다.
ProxyPass /content https://<AEM_Instance>/content
ProxyPass /etc https://<AEM_Instance>/etc
ProxyPass /etc.clientlibs https://<AEM_Instance>/etc.clientlibs
# CSRF Filter
ProxyPass /libs/granite/csrf/token.json https://<AEM_Instance>/libs/granite/csrf/token.json
ProxyPassReverse /etc https://<AEM_Instance>/etc
ProxyPassReverse /etc.clientlibs https://<AEM_Instance>/etc.clientlibs
# written for thank you page and other URL present in AF during redirect
ProxyPassReverse /content https://<AEM_Instance>/content
다른 토폴로지를 설정하는 경우 Dispatcher 레이어의에 제출, 미리 채우기 및 기타 URL을 추가해야 허용 목록에 추가하다 합니다.
웹 페이지에 적응형 양식을 포함할 때에는 다음 우수 사례를 고려하십시오.
[getData](https://helpx.adobe.com/kr/experience-manager/6-3/forms/javascript-api/GuideBridge.html)
API를 사용하십시오.[unloadAdaptiveForm](https://helpx.adobe.com/kr/experience-manager/6-3/forms/javascript-api/GuideBridge.html)
API를 사용하십시오.https://'[server]:[port]'/system/console/configMgr
의 AEM Web Console 구성 관리자로 이동합니다.