I’ve tried several different things now and I’m stumped.
The simulation I’m running is cobbling together data from quite a few feeders to generate the request body. Some of those items vary in size quite a bit, so I wanted to log the request size in the simulation.log file. Naturally, I found that that there is a method for doing just this: extraInfoExtractor. Looks good to me. I throw together the following method to retrieve the data:
.extraInfoExtractor((status: Status, session: Session, req: Request, resp: Response) => {
List(req.getContentLength())
})
But alas, this just returns -1. I’m a little surprised here, since my request is a POST, so I expected this to be calculated. Hmmm, well this length method is deprecated, but maybe it will work for now:
.extraInfoExtractor((status: Status, session: Session, req: Request, resp: Response) => {
List(req.getLength())
})
Nope, same result. Maybe I can just grab the raw request data and get the length from that:
.extraInfoExtractor((status: Status, session: Session, req: Request, resp: Response) => {
List(req.getByteData().length)
})
Ah, found my good friend NullPointerException.
At this point, I’m a little stumped about the proper way to retrieve this information. I can probably get this working by storing the size in the session as part of my request and then retrieving it from the session in the extractor, but I don’t understand why this information doesn’t seem to be available from the request object. Am I missing something?