Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Can I use GuideSubmitServlet to generate a POST?

joell91868939
Level 3
Level 3

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
Sakshi1
Level 3
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.

joell91868939
Level 3
Level 3

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.

Sakshi1
Level 3
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.

joell91868939
Level 3
Level 3

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

Sakshi1
Level 3
Level 3

Hi Joel,

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