Written by

Senior Software Engineer
Question Ashok Kumar T · Jun 27

Accessing Response Content in %CSP.REST Before Writing to Output Buffer

Hello Community,

When handling a %CSP.REST API response for a custom endpoint, how can I capture or access the response content before it is written to the output buffer and sent through the Web Gateway to the UI?

In manually created REST services (for example, with a route like:<Route Url="/test" Method="POST" Call="User.Sample:Test" Cors="true"/> ),
the response is typically written from within any class method in the execution flow.

Is there a way to intercept or log the response content before it is sent to the client?

Thanks!

Product version: IRIS 2024.1
$ZV: IRIS for Windows (x86-64) 2024.1.1 (Build 347U) Thu Jul 18 2024 17:40:10 EDT

Comments

Enrico Parisi · Jun 29

It's not possible, the response is "sent to the browser" (via Web Gateway....) immediately, there is no buffer or anything.

If you want to capture YOUR response, put it in a buffer and when you are done, send it from your buffer "to the browser"

0
Ashok Kumar T  Jun 29 to Enrico Parisi

That's my understanding as well. So, Once the response is written and sent, it cannot be tracked afterward—except through the Web Gateway HTTP trace.

0
Ashok Kumar T  Jun 30 to Vitaliy Serdtsev

Hello @Vitaliy Serdtsev 

Thank you for pointing the %CSP.SessionEventsclass to capture the end of request. However, my requirement is to intercept  the written API response by class method before it's sent to UI.

0