public static boolean isMSIE6or7(String UA) { return org.nuxeo.common.utils.UserAgentMatcher.isMSIE6or7(UA); }
public static boolean html5DndIsSupported(String UA) { return isFirefox3(UA) || isFirefox4OrMore(UA) || isSafari5(UA) || isChrome(UA) || isMSIE10OrMore(UA) || isMSEdge(UA); }
public static boolean html5DndIsSupported(String UA) { return org.nuxeo.common.utils.UserAgentMatcher.html5DndIsSupported(UA); }
public static boolean isHistoryPushStateSupported(String UA) { return isFirefox4OrMore(UA) || isSafari5(UA) || isChrome(UA) || isMSIE10OrMore(UA); } }
@Factory(value = "isMSIEorEdge", scope = ScopeType.SESSION) public boolean isMSIEorEdge() { FacesContext context = FacesContext.getCurrentInstance(); if (context != null) { HttpServletRequest request = (HttpServletRequest) context.getExternalContext().getRequest(); String ua = request.getHeader("User-Agent"); return UserAgentMatcher.isMSIE6or7(ua) || UserAgentMatcher.isMSIE10OrMore(ua) || UserAgentMatcher.isMSEdge(ua); } else { return false; } }
/** * @since 5.9.5 */ public static boolean isMSIE10OrMore(String UA) { return org.nuxeo.common.utils.UserAgentMatcher.isMSIE10OrMore(UA); }
public static boolean isHistoryPushStateSupported(String UA) { return org.nuxeo.common.utils.UserAgentMatcher.isHistoryPushStateSupported(UA); } }
public static boolean isFirefox4OrMore(String UA) { return org.nuxeo.common.utils.UserAgentMatcher.isFirefox4OrMore(UA); }
public static boolean isSafari5(String UA) { return org.nuxeo.common.utils.UserAgentMatcher.isSafari5(UA); }
public static boolean isChrome(String UA) { return org.nuxeo.common.utils.UserAgentMatcher.isChrome(UA); }
public static boolean isFirefox3(String UA) { return org.nuxeo.common.utils.UserAgentMatcher.isFirefox3(UA); }
@Override @Factory(value = "canUseAjaxTabs", scope = ScopeType.SESSION) public boolean canUseAjaxTabs() { FacesContext context = FacesContext.getCurrentInstance(); ExternalContext econtext = context.getExternalContext(); HttpServletRequest request = (HttpServletRequest) econtext.getRequest(); String ua = request.getHeader("User-Agent"); return UserAgentMatcher.isHistoryPushStateSupported(ua); }
@Factory(value = "isMSIE6or7", scope = ScopeType.SESSION) public boolean isMSIE6or7() { FacesContext context = FacesContext.getCurrentInstance(); if (context != null) { HttpServletRequest request = (HttpServletRequest) context.getExternalContext().getRequest(); String ua = request.getHeader("User-Agent"); return UserAgentMatcher.isMSIE6or7(ua); } else { return false; } }
/** * Factory method used to push into the Session context a flag indicating if HTML5 Drag&Drop can be used * * @return */ @Factory(value = "useHtml5DragAndDrop", scope = ScopeType.SESSION) public boolean useHtml5DragAndDrop() { FacesContext context = FacesContext.getCurrentInstance(); ExternalContext econtext = context.getExternalContext(); HttpServletRequest request = (HttpServletRequest) econtext.getRequest(); String ua = request.getHeader("User-Agent"); return UserAgentMatcher.html5DndIsSupported(ua); }
/** * Encodes a {@code Content-Disposition} header. For some user agents the full RFC-2231 encoding won't be performed * as they don't understand it. * * @param filename the filename * @param inline {@code true} for an inline disposition, {@code false} for an attachment * @param userAgent the userAgent * @return a full string to set as value of a {@code Content-Disposition} header */ public static String encodeContentDisposition(String filename, boolean inline, String userAgent) { StringBuilder buf = new StringBuilder(inline ? "inline; " : "attachment; "); if (userAgent == null) { userAgent = ""; } if (isMSIE6or7(userAgent)) { // MSIE understands straight %-encoding buf.append("filename="); percentEscape(buf, filename); } else { // proper RFC2231 buf.append("filename*=UTF-8''"); percentEscape(buf, filename); } return buf.toString(); }