Search in sources :

Example 1 with ContentType

use of lucee.commons.io.res.ContentType in project Lucee by lucee.

the class ExecutionThread method isText.

private static boolean isText(HTTPResponse rsp) {
    ContentType ct = rsp.getContentType();
    if (ct == null)
        return true;
    String mimetype = ct.getMimeType();
    return mimetype == null || mimetype.startsWith("text") || mimetype.startsWith("application/octet-stream");
}
Also used : ContentType(lucee.commons.io.res.ContentType)

Example 2 with ContentType

use of lucee.commons.io.res.ContentType in project Lucee by lucee.

the class HTTPResponseSupport method getCharset.

@Override
public final String getCharset() {
    ContentType ct = getContentType();
    String charset = null;
    if (ct != null)
        charset = ct.getCharset();
    if (!StringUtil.isEmpty(charset))
        return charset;
    PageContext pc = ThreadLocalPageContext.get();
    if (pc != null)
        return pc.getWebCharset().name();
    return "ISO-8859-1";
}
Also used : ContentType(lucee.commons.io.res.ContentType) PageContext(lucee.runtime.PageContext) ThreadLocalPageContext(lucee.runtime.engine.ThreadLocalPageContext)

Aggregations

ContentType (lucee.commons.io.res.ContentType)2 PageContext (lucee.runtime.PageContext)1 ThreadLocalPageContext (lucee.runtime.engine.ThreadLocalPageContext)1