0
votes

This is the thing i want it to be done by my javassist agent.

System.out.println(response.getStatus());

But i am not able to get the HttpServletResponse object by javassist. Or can it be done using reflection

Could you add more context on what you try to do? Where do you want to add the code? What have you tried? - Rafael Winterhalter
@RafaelWinterhalter I want to Capture the response Object at runtime using javassist. So that i can fetch the response parameters at runtime. But i am not aware of how to fetch the existing Object of a Class from my javassist agent. - s s
You cannof fetch properties of a class, rather from an instance. You would need to change the method of the class you want to monitor and fetch the instance on any method call. Have a look at any Javassist tutorial for learning how to do this! - Rafael Winterhalter
@RafaelWinterhalter I went through the javassist doc.But could not found what i wanted. The main issue is are you telling me to fetch the instance which calls the method? Can you plz share the link or show a sample code for that.. - s s
@RafaelWinterhalter And i tried using Reflection too but its now working as expected.. I can get new Instances but not able to fetch the existing instance. - s s