How to call an AEM servlet from an adaptive form

Avatar

Avatar
Validate 1
Level 1
dreres
Level 1

Likes

0 likes

Total Posts

5 posts

Correct reply

1 solution
Top badges earned
Validate 1
Affirm 1
View profile

Avatar
Validate 1
Level 1
dreres
Level 1

Likes

0 likes

Total Posts

5 posts

Correct reply

1 solution
Top badges earned
Validate 1
Affirm 1
View profile
dreres
Level 1

25-01-2021

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

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Validate 1
Level 1
dreres
Level 1

Likes

0 likes

Total Posts

5 posts

Correct reply

1 solution
Top badges earned
Validate 1
Affirm 1
View profile

Avatar
Validate 1
Level 1
dreres
Level 1

Likes

0 likes

Total Posts

5 posts

Correct reply

1 solution
Top badges earned
Validate 1
Affirm 1
View profile
dreres
Level 1

05-02-2021

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

Answers (0)