use of org.olat.core.gui.media.StringMediaResource in project openolat by klemens.
the class CPPrintMapper method prepareMediaResource.
private StringMediaResource prepareMediaResource(HttpServletRequest httpRequest, String page, String enc, String contentType) {
StringMediaResource smr = new StringMediaResource();
if (XHTML_CONTENT_TYPE.equals(contentType)) {
// check if the application/xhtml+xml is supported (not supported by IEs)
// if not, replace the content type by text/html for compatibility
String accept = httpRequest.getHeader("Accept");
if (accept == null || accept.indexOf(XHTML_CONTENT_TYPE) < 0) {
contentType = DEFAULT_CONTENT_TYPE;
}
}
String mimetype = contentType + ";charset=" + StringHelper.check4xMacRoman(enc);
smr.setContentType(mimetype);
smr.setEncoding(enc);
// inject some javascript code to size iframe to proper height, but only when not a page with framesets
if (page.indexOf(TAG_FRAMESET) != -1 || page.indexOf(TAG_FRAMESET_UPPERC) != -1) {
// is frameset -> deliver unparsed
smr.setData(page);
} else {
smr.setData(page);
}
return smr;
}
Aggregations