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

AEM SlingHttpServletResponse redirect external server

Avatar

Level 4

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?

 

@component(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;


@Override
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=C...
log.info("Redirect url : " + url);
resp.setStatus(301);
resp.setHeader("Location", url);

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

1 Accepted Solution

Avatar

Correct answer by
Level 4

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.

View solution in original post

1 Reply

Avatar

Correct answer by
Level 4

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.