AEM SlingHttpServletResponse redirect external server | Community
Skip to main content
Level 4
June 2, 2020
Solved

AEM SlingHttpServletResponse redirect external server

  • June 2, 2020
  • 1 reply
  • 2344 views

I have a simple servlet that upload a PDF to adobe esign and I manage to get a URL back. 

 

I now want to redirect the client to this URL. The actual URL is valid if I copy-paste it into a browser, but the AEM override the below URL from 

https://secure.na1.echosign.com/.....

to 

https://my.aem.server.url/.... ==> Error "Resource at '/public/apiesign' not found

 

How do i prevent this change in URL?

 

@8220494(service=Servlet.class,
property={
"sling.servlet.methods=" + HttpConstants.METHOD_GET,
"sling.servlet.paths="+ "/bin/test
})

@ServiceDescription("test")
public class test extends SlingAllMethodsServlet {

private static final Logger log = LoggerFactory.getLogger(test.class);

private static final long serialVersionUID = 1L;


@9944223
protected void doGet(final SlingHttpServletRequest req,
final SlingHttpServletResponse resp) throws ServletException, IOException {
try {
.
.
.
.
.
String url = "https://secure.na1.echosign.com/public/apiesign?pid=CBFCI...U3in9aXcBSzz4pjulXWk14_14%2A&client_id=CBJ.....l8iKQcD_hjaNK
log.info("Redirect url : " + url);
resp.setStatus(301);
resp.setHeader("Location", url);

} catch (Exception e) {
log.error("",e);
}
}
}

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Eric_Stricker

Answer my own question.

 

We use an IIS URL rewrite between the internet and Author. We found that IIS is the one updating the URL. Not AEM.

 

Tested this by calling the server directly instead of using IIS URL Rewrite.

1 reply

Eric_StrickerAuthorAccepted solution
Level 4
June 3, 2020

Answer my own question.

 

We use an IIS URL rewrite between the internet and Author. We found that IIS is the one updating the URL. Not AEM.

 

Tested this by calling the server directly instead of using IIS URL Rewrite.