Can I use GuideSubmitServlet to generate a POST?

Avatar

Avatar
Validate 10
Level 3
joell91868939
Level 3

Likes

6 likes

Total Posts

55 posts

Correct reply

4 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 1
View profile

Avatar
Validate 10
Level 3
joell91868939
Level 3

Likes

6 likes

Total Posts

55 posts

Correct reply

4 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 1
View profile
joell91868939
Level 3

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

Avatar

Avatar
Boost 1
Level 2
Sakshi1
Level 2

Likes

2 likes

Total Posts

32 posts

Correct reply

9 solutions
Top badges earned
Boost 1
Affirm 5
Affirm 3
Affirm 1
View profile

Avatar
Boost 1
Level 2
Sakshi1
Level 2

Likes

2 likes

Total Posts

32 posts

Correct reply

9 solutions
Top badges earned
Boost 1
Affirm 5
Affirm 3
Affirm 1
View profile
Sakshi1
Level 2

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.

Avatar

Avatar
Validate 10
Level 3
joell91868939
Level 3

Likes

6 likes

Total Posts

55 posts

Correct reply

4 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 1
View profile

Avatar
Validate 10
Level 3
joell91868939
Level 3

Likes

6 likes

Total Posts

55 posts

Correct reply

4 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 1
View profile
joell91868939
Level 3

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.

Avatar

Avatar
Boost 1
Level 2
Sakshi1
Level 2

Likes

2 likes

Total Posts

32 posts

Correct reply

9 solutions
Top badges earned
Boost 1
Affirm 5
Affirm 3
Affirm 1
View profile

Avatar
Boost 1
Level 2
Sakshi1
Level 2

Likes

2 likes

Total Posts

32 posts

Correct reply

9 solutions
Top badges earned
Boost 1
Affirm 5
Affirm 3
Affirm 1
View profile
Sakshi1
Level 2

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.

Avatar

Avatar
Validate 10
Level 3
joell91868939
Level 3

Likes

6 likes

Total Posts

55 posts

Correct reply

4 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 1
View profile

Avatar
Validate 10
Level 3
joell91868939
Level 3

Likes

6 likes

Total Posts

55 posts

Correct reply

4 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 1
View profile
joell91868939
Level 3

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

Avatar

Avatar
Boost 1
Level 2
Sakshi1
Level 2

Likes

2 likes

Total Posts

32 posts

Correct reply

9 solutions
Top badges earned
Boost 1
Affirm 5
Affirm 3
Affirm 1
View profile

Avatar
Boost 1
Level 2
Sakshi1
Level 2

Likes

2 likes

Total Posts

32 posts

Correct reply

9 solutions
Top badges earned
Boost 1
Affirm 5
Affirm 3
Affirm 1
View profile
Sakshi1
Level 2

13-02-2017

Hi Joel,

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