Send POST request in ATG with checkFormRedirect method

186 views Asked by At

I have requirement of changing GET to POST redirection to external URL.

Currently, we are using checkFormRedirect(url,req,res) to redirect to external URL which by default uses GET as per my understanding. I want to change this request to POST.

One way is we can use HTTPClient API for re-direction.

Is there any way ATG out of box provide some thing to POST redirection. Please help.

1

There are 1 answers

0
Anshu Kumar On

If you submitted a form in JSP as you are using checkFormRedirect(). It is already a POST request and you can get data in your handlerXXX method.

You can use this method to control redirects. The API call of this method looks somewhat like:-

public boolean checkFormRedirect(pSuccessURL, pFailureURL, pRequest, pResponse);

Now, this method redirects to pSuccessURL if no form errors are found in the form. Otherwise, it redirects to pFailureURL.