Highlighted

Can I use GuideSubmitServlet to generate a POST?

joell91868939

08-02-2017

Hi,

Using AEM 6.2 SP1. Have a successful GET working with post.POST.jsp and:

GuideSubmitServlet.setRedirectParameters(slingRequest, redirectParams); GuideSubmitServlet.setRedirectUrl(slingRequest, request.getHeader("Referer")); 

Is there a way I can change that to a POST?

Replies

Highlighted

Sakshi1

08-02-2017

Hi Joel,

Can you elaborate on your usecase, what is that you are trying to achieve?

If you want a post to be made to a URL, have you tried "REST" submit action, which allows you to post data to the specified URL.

Highlighted

joell91868939

09-02-2017

Sure. I have a post.POST.jsp which takes the XML submitted from the client, makes decisions, and checks for errors.

If there are no errors, it generates a PDF using the pdf generator service.

If there are errors, it uses the  GuideSubmitServlet to redirect back to the URL the client came from, with the submitted document included with the errors in the redirectParams, so the user can see the data they submitted to give context to the errors.

We want to use a POST rather than a GET, because there are limits to a GET.

Highlighted

Sakshi1

09-02-2017

This seems a typical case of 'Revalidate on server' and REST submit action POST capability.

In case you don't wish to write validation rules for client as you stated on other thread, that, you have a dedicated server for validations, then in your custom POST action you can create a POST request as we are doing in out of the box REST submit action.

Highlighted

joell91868939

13-02-2017

Hi Sakshi,

I should have clarified. GuideSubmitServlet.setRedirectUrl(slingRequest, request.getHeader("Referer")); eventually uses a GET (to redirect back to the referrer). I would like to change this to a POST. 

Joel