public static H.Format contentTypeForErrorResult(H.Request<?> req) { H.Format fmt = req.accept(); if (req.isAjax()) { if (H.Format.UNKNOWN == fmt) { fmt = req.contentType(); } if (H.Format.JSON == fmt || H.Format.XML == fmt) { return fmt; } } return fmt.isText() ? fmt : H.Format.HTML; }
@Override public H.Format resolve(String value) { return H.Format.resolve(value); } }
protected void setContentType(H.Request req, H.Response resp) { String s = req.accept().contentType(); String encoding = resp.characterEncoding(); if(S.notBlank(encoding)) { s = S.concat(s, "; charset=", encoding); } resp.initContentType(s); }
@Override public Cookie setDiscard(boolean discard) { if (discard) { hc.maxAge(-1); } return this; }
@Override public Cookie setValue(String value) { hc.value(value); return this; }
@Override public Cookie setSecure(boolean secure) { hc.secure(secure); return this; }
@Override public CliSession removeAttribute(String key) { session.evict(key); return this; } }
@Override public Cookie setHttpOnly(boolean httpOnly) { hc.httpOnly(httpOnly); return this; }
@Override public Cookie setPath(String path) { hc.path(path); return this; }
@Override public Cookie setVersion(int version) { hc.version(version); return this; }
@Override public String readFlash(H.Request request) { return request.header(flashHeader); } }
protected void setContentType(H.Request req, H.Response resp) { String s = req.accept().contentType(); String encoding = resp.characterEncoding(); if(S.notBlank(encoding)) { s = S.concat(s, "; charset=", encoding); } resp.initContentType(s); }
public static H.Format contentTypeForErrorResult(H.Request<?> req) { H.Format fmt = req.accept(); if (req.isAjax()) { if (H.Format.UNKNOWN == fmt) { fmt = req.contentType(); } if (H.Format.JSON == fmt || H.Format.XML == fmt) { return fmt; } } return fmt.isText() ? fmt : H.Format.HTML; }
@Override public Cookie setMaxAge(Integer maxAge) { hc.maxAge(maxAge); return this; }
@Override public String getValue() { return hc.value(); }
@Override public Cookie setSecure(boolean secure) { hc.secure(secure); return this; }
@Override public boolean isDiscard() { return hc.maxAge() < 0; }