We have one sling filter performing some business logic and this is chain filter. But in the logic, we are processing Iterator Object from request attributes. And the same iterator is getting used in next level of chain.
When we try to parse the Iterator in next level we are getting error"Parameter not available" as we have already pasrsed the Iterator Object.
If there any way to pass the original request object in the chain from first filter?
What iterator from the request are you processing?
(I know that there is an issue when dealing with multi-part POST requiests. If you have functionality which first casts the SlingHttpServletRequest to a HttpServletRequest and reads it using this API, all subsequent calls to read the body will fail, because the input stream has already been consumed. The Sling implementation consumes it already and provides dedicated methods to access it. We came across this a year or two ago, so I don't know the details anymore.)
In filter I am parsing one of the request attribute ('request-parts-iterator') to fetch uploaded file from OOTB DAM upload buttton. I am reading the inputstream stream from it and enabling antivirus scan for the uploaded file. Once scan done, I am doing chain filter(chainfiltter.doFilter(request,response)) but as I already read the Inputstream Once , CreateAssetFilter unable to read the stream again to process upload action.
I even tried to wrapping of the request. That dint worked too.
I noticed the actual problem is reading the attribute twice. When I read the request attribute in filter and again in next level when actual logic is using the same parameter then it is not available and the actual functionality is breaking.