Call a servlet (GET request) from Sling model
All,
I have a deployed servlet in AEM that returns JSON result from external endpoint.
My use case is to call this servlet deployed in AEM with a GET request from a sling model (same AEM instance) to get this json result.
The issue is that its working in localhost but in Azure environements AEM instances i am getting a timeout on calling the servlet.
I tried changing the lib for requesting the servlet (HttpConnection, HttpClient, Jsoup, ...) but still i am getting a timeout.
When calling directly the path of the servlet without passing in the different environmnt i am getting correctly the JSON response.
My thoughts that AEM instance in (dev, stage) environments is blocking the internal call to the servlet (/bin/tests/test).
PS:
- i have tried using directly publish ip adress to avoid the dispatcher but i get the same issue.
- an OSGI Service istead of the servlet is working but i still need the use of servlet for caching the query and result easily.
Any idea of the cause and a possible solution ?
Best regards,

