Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

How to call an AEM servlet from an adaptive form

Avatar

Level 2

I'm trying to create a test form based on the example template "Basic" from AEM forms and changed the submit action to "Submit to rest endpoint" and typed in my servlet path into the field "URL for post request". But the submit results to an HTTP 500 error (but no error is shown in the log, only in the browser console). If I change the path to a complete URL, my servlet is called. But I don't want to use a complete url because this url depends on the current environment. So how I have to configure it?

 

In this documentation (https://experienceleague.adobe.com/docs/experience-manager-65/forms/adaptive-forms-basic-authoring/c...) they wrote, that I can type in a content path:

"To post data to an internal server, provide path of the resource. The data is posted the path of the resource. For example, /content/restEndPoint. For such post requests, the authentication information of the submit request is used."

 

So actually it should work, right?

 

I'm using AEM with version 6.4.8

1 Accepted Solution

Avatar

Correct answer by
Level 2

Hi Community,

if anyone has the same question, I got this answer from the adobe technical support:

 

If the URL mentioned(“/bin/af-post”) resolves to a resource, relative URL would work. In this case, /bin/af-post does not resolve to a resource, hence the system expects a complete URL including hostname.

 

If your use-case is to use relative URL, can you rather mount a servlet on a resource ?

 

Having servlets on path like /bin could be troublesome on production systems from security and also dispatcher rules where you would need to whitelist these URLs.



Regards,

Andrea

View solution in original post

1 Reply

Avatar

Correct answer by
Level 2

Hi Community,

if anyone has the same question, I got this answer from the adobe technical support:

 

If the URL mentioned(“/bin/af-post”) resolves to a resource, relative URL would work. In this case, /bin/af-post does not resolve to a resource, hence the system expects a complete URL including hostname.

 

If your use-case is to use relative URL, can you rather mount a servlet on a resource ?

 

Having servlets on path like /bin could be troublesome on production systems from security and also dispatcher rules where you would need to whitelist these URLs.



Regards,

Andrea