Expand my Community achievements bar.

Can I use GuideSubmitServlet to generate a POST?

Avatar

Former Community Member

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?

5 Replies

Avatar

Level 3

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.

Avatar

Former Community Member

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.

Avatar

Level 3

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.

Avatar

Former Community Member

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

Avatar

Level 3

Hi Joel,

Currently there is no configuration to change the redirect 'GET' into 'POST'.