Adapt Request Header followed by Request Satisfaction based on POST Request Body

Asked by Jatin

Hi Alex,

1) When receive a POST request is received then I modify the Request Headers using following steps:
adapted = hostx->virgin().clone()
... Update Headers
hostx->useAdapted(adapted);

2) Now I receive the POST Body (form data):
After receiving the entire body I decide to perform Request Satisfaction on it. And this part I am not sure how it can be done because I have already called hostx->useAdapted(adapted);

If I do not perform Request Headers updates (adaptation in Step 1) then I can perform Step 2 successfully.

Question 1 : Is it possible to do Step 1 and Step 2 for the same request or would you suggest holding off the request until I have received entire POST body and make one decision. i.e Adapt Header or do Request Satisfaction.

Question 2: If I have already called below function:
adapted = hostx->virgin().clone()
Can I delete/free adapted if I want to call
adapted = libecap::MyHost().newResponse();

Question information

Language:
English Edit question
Status:
Solved
For:
eCAP Edit question
Assignee:
No assignee Edit question
Solved by:
Jatin
Solved:
Last query:
Last reply:
Revision history for this message
Alex Rousskov (rousskov) said :
#1

Q1: A transaction should make its decision exactly once, calling either useVirgin(), useAdapted(), or blockVirgin(). By the time of the second useAdapted() call, the host application may have forwarded the adapted request to the server already. I am not aware of any host application that supports abandoning the in-progress adapted request in lieu of a newly given adapted response.

Q2: Yes, I believe calling newResponse() after clone() should work. The old cloned message will be destroyed when the last reference to it disappears.

Revision history for this message
Jatin (jbhasin83) said :
#2

Thanks Alex