Need some input on media type detection.
I want to identify instances where the client User-Agent matches "java" and the request results in the download of a certain type of file.
I have a rule set with criteria Cycle.TopName equals "Response" which applies to Responses and Embedded Objects. I'm pretty sure that for the final rule I can eliminate Responses, but I think that having that criteria included may have given me some insight into how things work/are working. On the other hand, it may be completely skewing my testing.
My first rule ignores java downloads for specific destinations. This works.
Under the first rule I have a rule set for Java downloads w/user-agent criteria.
My second rule looks for MediaType.EnsuredTypes at least one in list Java Downloads.
Java Downloads contains:
If I match on the second rule, I write a log line.
One of the current problems is that .jar files are getting logged as matching the critera.
What am I missing?
.jar files are going to have multiple ensured types.
I have a routine where I send a file thru ICAP and get back all the data from the response and the embedded cycles, including ensured media types. When I send a jar file, i receive:
X-Media-Type: application/java-archive, application/zip
X-File-Name and X-Media-Type are the jar file itself and the other entries are the filename|size|ensured type inside the jar.
So you are probably matcihing on at least one in list for application/zip because the ensured type includes that.
And you will probably need some exclusion for EnsureTypes contains application/jar to skip over the jar+zip combination.
Message was edited by: eelsasser typos and additional thoughts. on 4/26/13 12:48:28 PM EDT
Media type detector can return several mime types for one file - this is by design. Jar file is a subtype of zip archive, so we return mime types for jar & zip.
You need to add subcondition like "MediaType.EnsuredTypes" doesn't contain "application/java-archive"