Worked on this and I think I have a fair solution.
This would be the deal:
/** the actual content type for the response header, does not need to match the requested output format */
/** the output format names this producer can be invoked by, and the ones to state in capabilities */
/** shall be called before produceMap with the actual output format the request was made with. Some producers depend on it */
void setOutputFormat(String outputFormat);
/** the output format the request was made with */
void setMapContext(WMSMapContext context);
This way we decouple the mime type to be written as a response header and what we state in getcaps, better separation of concerns than having a mixin of them.
Also, this is so since some producers does completelly different one thing and the other. for example, the openlayers one states the format application/openlayers, but the mime type it sends is text/html.
Others (png, tiff, geotiff) makes a decision based on the requested output format, producing a different result based on it (png vs png8, tiff vs tiff8, etc), but the output mime type shall be the same "image/png"
That is certainly awful, like making a code path fork depending on the output format requested seems to imply those should be different MapProducers... we could fix than later, but for now this is the proposal to avoid regressions