Hi,
We have a requirement to render PDF from Adaptive form on AEM 6.5.
The rendered PDF should have the data from the Adaptive form as well.
Currently I am using the below code
window.guideBridge.getDataXML(
{
success: function(result) {
var formData = new FormData();
formData.append("dataXml",result.data);
var url = "servletpath?data=" + result.data + "&path="+path;to fetch the formdata from the adaptive form. This script is trigged on clicking a button in Adaptive form.
A custom servlet is called from this script, which uses
formservice.outputservice to render static PDFs along with data.
The issue that we are facing is that the application is placed behind SI proxy and the request is then redirected from SI proxy server to AEM load balancer. In this case, the SI prxy server is appending url /abc/def/ to access all the pages on AEM.
As a result, the AF are available on <SIProxydomain>:/abc/def/content/..path of adpative form.
This is causing problem when window.guideBridge.getDataXML in the script is trying to access
<SIProxydomain>:/content/..path of adpative form/jcr:content/guideContainer.af.internalsubmit.jsp
as this is internally generated url, I am not able to add /abc/def to this url.
Is there any other way to get form data from form fields in an adaptive form and pass it to custom servlet.
Thank you.
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
Any suggestions will be helpful. Thank you
Views
Replies
Total Likes
Hi @SmrithiGo,
You’re running into a issue with proxy and rewriting in front of AEM Forms: internal Adaptive Forms (AF) AJAX calls (such as guideContainer.af.internalsubmit.jsp or similar endpoints) do not automatically include your SI proxy path prefix (/abc/def). This causes problems when the client-side JS tries to interact with endpoints whose URLs no longer directly match the served page URL structure, particularly when a reverse proxy adds such a prefix.
Here’s a summary of the problem and the main ways to solve it for Adaptive Forms on AEM 6.5:
/abc/def/content/...) but internal JS tries to POST/GET to /content/..., missing the /abc/def prefix required by the proxy topology./abc/def), the browser “sees” a different base path than the actual internal server-side context, and client JS can’t automatically detect this or prepend the prefix.You can configure your proxy/load balancer to rewrite requests by stripping the /abc/def path before forwarding to AEM, and to correctly handle the reverse for response URLs. This is the most robust solution and aligns with how AEM/AF expects to operate:
Example (Apache):
# Forward /abc/def to AEM, but strip the prefix ProxyPass /abc/def/ http://aem-int-host:4503/ ProxyPassReverse /abc/def/ http://aem-int-host:4503/ # In dispatcher, add rewrite rule RewriteRule ^/abc/def/(.*)$ /$1 [PT]
More info:
You could attempt to programmatically detect the path prefix in JavaScript and add /abc/def before making manual XHR/fetch calls, but this approach is brittle:
.af.internalsubmit.jsp) are generated deep in the GuideBridge or submit logic—hard to override.Another robust approach is to customize your AEM Adaptive Forms’ form container Sling Model or use a custom Link Transformer so URLs generated for client-side consumption include the correct path prefix:
getCustomFunctionUrl, getAction, getDataUrl to return URLs with the /abc/def prefix.Set up a proxy servlet in AEM that forwards requests to the correct internal endpoints, using the servlet as a fixed entry point that handles path mapping. You direct all AJAX calls to /abc/def/bin/customProxy?target=/content/..., and the servlet resolves it and proxies the call to the real path on AEM.
Thanks
Pranay
thanks @Pranay_M for the response.
As we dont have access to the proxy server, I believe, we will not be able to go with
a. Use a Reverse Proxy Rewrite Rule, hence I can try out both of these c. Use a Link Transformer or Custom Form Container Adaptation in AEM (Advanced) and d. Server-side Proxy Servlet (if you cannot reconfigure the reverse proxy).
Will try and let you know. Once again thank you.
Views
Replies
Total Likes
@SmrithiGo , did you try the solution? did it resolve the issue?
Views
Replies
Total Likes
Hi @Khushwant_Singh No, I am still trying, will keep you posted on the same
Views
Replies
Total Likes
Hi @Pranay_M ,
I tried to customize your AEM Adaptive Forms’ form container Sling Model, but I am stuck as it is not able to resolve this bundle
com.adobe.cq.forms.core.components.models.form,version=[5.4,6) -- Cannot be resolved
I have added these dependencies in pom.xml
<!-- https://mvnrepository.com/artifact/com.adobe.aem/core-forms-components-af-core -->
<dependency>
<groupId>com.adobe.aem</groupId>
<artifactId>core-forms-components-af-core</artifactId>
<version>3.0.40</version>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/com.adobe.aem/core-forms-components-core -->
<dependency>
<groupId>com.adobe.aem</groupId>
<artifactId>core-forms-components-core</artifactId>
<version>3.0.40</version>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/com.adobe.aemfd/aem-forms-sdk-api -->
<dependency>
<groupId>com.adobe.aem</groupId>
<artifactId>aem-forms-sdk-api</artifactId>
<version>2023.06.19.00-230400</version>
</dependency>
but i can see in archetype.properties of the project like this:
includeForms=n
includeFormsenrollment=n
includeFormscommunications=n
Views
Replies
Total Likes
Views
Replies
Total Likes