Examples of UserAgent


Examples of org.apache.myfaces.tobago.context.UserAgent

  }

  public static void ensureContentSecurityPolicyHeader(FacesContext facesContext, List<String> contentSecurityPolicy) {
    // TODO PortletRequest
    if (facesContext.getExternalContext().getResponse() instanceof HttpServletResponse) {
      final UserAgent userAgent = ClientProperties.getInstance(facesContext).getUserAgent();
      final String cspHeader = userAgent.getCspHeader();
      if (cspHeader != null) {
        final StringBuilder value = new StringBuilder();
        for (String directive : contentSecurityPolicy) {
          value.append(directive);
          value.append(";");
View Full Code Here

Examples of org.apache.myfaces.tobago.context.UserAgent

      boolean reverseOrder, boolean single, boolean returnKey, String key, boolean returnStrings,
      boolean ignoreMissing) {
    List matches = new ArrayList();
    String contentType = clientkey.getContentType();
    Theme theme = clientkey.getTheme();
    UserAgent browser = clientkey.getUserAgent();
    List<String> locales = LocaleUtils.getLocaleSuffixList(clientkey.getLocale());

    String path;

    // check first the local web application directory
    for (String localeSuffix : locales) {
      if (production) {
        path = makePath(name, MINIMIZE_SUFFIX, localeSuffix, suffix, key);
        boolean found = checkPath(prefix, reverseOrder, returnKey, returnStrings, matches, path);
        if (found && (single || !returnStrings)) {
          return matches;
        }
        if (!found) {
          path = makePath(name, null, localeSuffix, suffix, key);
          found = checkPath(prefix, reverseOrder, returnKey, returnStrings, matches, path);
          if (found && (single || !returnStrings)) {
            return matches;
          }
        }
      } else {
        path = makePath(name, null, localeSuffix, suffix, key);
        boolean found = checkPath(prefix, reverseOrder, returnKey, returnStrings, matches, path);
        if (found && (single || !returnStrings)) {
          return matches;
        }
      }
    }

    // after that check the whole resources tree
    // e.g. 1. application, 2. library or renderkit
    for (Theme themeName : theme.getFallbackList()) { // theme loop
      for (String resourceDirectory : tobagoConfig.getResourceDirs()) {
        for (String browserType : browser.getFallbackList()) { // browser loop
          for (String localeSuffix : locales) { // locale loop
            if (production) {
              path = makePath(resourceDirectory, contentType, themeName, browserType, subDir, name, MINIMIZE_SUFFIX,
                  localeSuffix, suffix, key);
              boolean found = checkPath(prefix, reverseOrder, returnKey, returnStrings, matches, path);
View Full Code Here

Examples of org.apache.myfaces.tobago.context.UserAgent

      boolean reverseOrder, boolean single, boolean returnKey, String key, boolean returnStrings,
      boolean ignoreMissing) {
    List matches = new ArrayList();
    String contentType = clientkey.getContentType();
    Theme theme = clientkey.getTheme();
    UserAgent browser = clientkey.getUserAgent();
    List<String> locales = LocaleUtils.getLocaleSuffixList(clientkey.getLocale());

    // check first the local web application directory
    for (String localeSuffix : locales) {
      if (production) {
        boolean found = checkPath(prefix, reverseOrder, returnKey, returnStrings, matches,
            name, MINIMIZE_SUFFIX, localeSuffix, suffix, key);
        if (found && (single || !returnStrings)) {
          return matches;
        }
        if (!found) {
          found = checkPath(prefix, reverseOrder, returnKey, returnStrings, matches,
              name, null, localeSuffix, suffix, key);
          if (found && (single || !returnStrings)) {
            return matches;
          }
        }
      } else {
        boolean found = checkPath(prefix, reverseOrder, returnKey, returnStrings, matches,
            name, null, localeSuffix, suffix, key);
        if (found && (single || !returnStrings)) {
          return matches;
        }
      }
    }

    // after that check the whole resources tree
    // e.g. 1. application, 2. library or renderkit
    for (Theme currentTheme : theme.getFallbackList()) {// theme loop
      for (String resourceDirectory : tobagoConfig.getResourceDirs()) {
        for (String browserType : browser.getFallbackList()) { // browser loop
          for (String localeSuffix : locales) { // locale loop
            if (production) {
              boolean found = checkPath(prefix, reverseOrder, returnKey, returnStrings, matches,
                  resourceDirectory, contentType, currentTheme, browserType, subDir, name, MINIMIZE_SUFFIX,
                  localeSuffix, suffix, key);
View Full Code Here

Examples of org.apache.myfaces.tobago.context.UserAgent

      boolean reverseOrder, boolean single, boolean returnKey, String key, boolean returnStrings,
      boolean ignoreMissing) {
    List matches = new ArrayList();
    String contentType = clientkey.getContentType();
    Theme theme = clientkey.getTheme();
    UserAgent browser = clientkey.getUserAgent();
    List<String> locales = LocaleUtils.getLocaleSuffixList(clientkey.getLocale());

    String path;

    // check first the local web application directory
    for (String localeSuffix : locales) {
      if (production) {
        path = makePath(name, MINIMIZE_SUFFIX, localeSuffix, suffix, key);
        boolean found = checkPath(prefix, reverseOrder, returnKey, returnStrings, matches, path);
        if (found && (single || !returnStrings)) {
          return matches;
        }
        if (!found) {
          path = makePath(name, null, localeSuffix, suffix, key);
          found = checkPath(prefix, reverseOrder, returnKey, returnStrings, matches, path);
          if (found && (single || !returnStrings)) {
            return matches;
          }
        }
      } else {
        path = makePath(name, null, localeSuffix, suffix, key);
        boolean found = checkPath(prefix, reverseOrder, returnKey, returnStrings, matches, path);
        if (found && (single || !returnStrings)) {
          return matches;
        }
      }
    }

    // after that check the whole resources tree
    // e.g. 1. application, 2. library or renderkit
    for (Theme themeName : theme.getFallbackList()) { // theme loop
      for (String resourceDirectory : tobagoConfig.getResourceDirs()) {
        for (String browserType : browser.getFallbackList()) { // browser loop
          for (String localeSuffix : locales) { // locale loop
            if (production) {
              path = makePath(resourceDirectory, contentType, themeName, browserType, subDir, name, MINIMIZE_SUFFIX,
                  localeSuffix, suffix, key);
              boolean found = checkPath(prefix, reverseOrder, returnKey, returnStrings, matches, path);
View Full Code Here

Examples of org.apache.myfaces.tobago.context.UserAgent

  public static void ensureContentSecurityPolicyHeader(
      final FacesContext facesContext, final ContentSecurityPolicy contentSecurityPolicy) {
    final Object response = facesContext.getExternalContext().getResponse();
    if (response instanceof HttpServletResponse) {
      final HttpServletResponse servletResponse = (HttpServletResponse) response;
      final UserAgent userAgent = ClientProperties.getInstance(facesContext).getUserAgent();
      final String[] cspHeaders;
      switch (contentSecurityPolicy.getMode()) {
        case OFF:
          cspHeaders = new String[0];
          break;
        case ON:
          cspHeaders = userAgent.getCspHeaders();
          break;
        case REPORT_ONLY:
          cspHeaders = userAgent.getCspReportOnlyHeaders();
          break;
        default:
          throw new IllegalArgumentException("Undefined mode: " + contentSecurityPolicy.getMode());
      }
      final StringBuilder builder = new StringBuilder();
View Full Code Here

Examples of org.apache.myfaces.tobago.context.UserAgent

      final String suffix, final boolean reverseOrder, final boolean single, final boolean returnKey, final String key,
      final boolean returnStrings, final boolean ignoreMissing) {
    final List matches = new ArrayList();
    final String contentType = clientkey.getContentType();
    final Theme theme = clientkey.getTheme();
    final UserAgent browser = clientkey.getUserAgent();
    final List<String> locales = LocaleUtils.getLocaleSuffixList(clientkey.getLocale());

    // check first the local web application directory
    for (final String localeSuffix : locales) {
      if (production) {
        boolean found = checkPath(prefix, reverseOrder, returnKey, returnStrings, matches,
            name, MINIMIZE_SUFFIX, localeSuffix, suffix, key);
        if (found && (single || !returnStrings)) {
          return matches;
        }
        if (!found) {
          found = checkPath(prefix, reverseOrder, returnKey, returnStrings, matches,
              name, null, localeSuffix, suffix, key);
          if (found && (single || !returnStrings)) {
            return matches;
          }
        }
      } else {
        final boolean found = checkPath(prefix, reverseOrder, returnKey, returnStrings, matches,
            name, null, localeSuffix, suffix, key);
        if (found && (single || !returnStrings)) {
          return matches;
        }
      }
    }

    // after that check the whole resources tree
    // e.g. 1. application, 2. library or renderkit
    for (final Theme currentTheme : theme.getFallbackList()) {// theme loop
      for (final String resourceDirectory : tobagoConfig.getResourceDirs()) {
        for (final String browserType : browser.getFallbackList()) { // browser loop
          for (final String localeSuffix : locales) { // locale loop
            if (production) {
              boolean found = checkPath(prefix, reverseOrder, returnKey, returnStrings, matches,
                  resourceDirectory, contentType, currentTheme, browserType, subDir, name, MINIMIZE_SUFFIX,
                  localeSuffix, suffix, key);
View Full Code Here

Examples of org.apache.shindig.common.servlet.UserAgent

  private boolean browserMatches() {
    if (browserMatch.isEmpty()) {
      // Not browser-sensitive.
      return true;
    }
    UserAgent ua = uaProvider.get();
    List<VersionMatcher> versionMatchers = browserMatch.get(ua.getBrowser());
    for (VersionMatcher matcher : versionMatchers) {
      if (matcher.matches(ua.getVersion())) return true;
    }
    return false;
  }
View Full Code Here

Examples of org.apache.shindig.common.servlet.UserAgent

  private boolean browserMatches() {
    if (browserMatch.isEmpty()) {
      // Not browser-sensitive.
      return true;
    }
    UserAgent ua = uaProvider.get();
    List<VersionMatcher> versionMatchers = browserMatch.get(ua.getBrowser());
    if (versionMatchers != null) {
      for (VersionMatcher matcher : versionMatchers) {
        if (matcher.matches(ua.getVersion())) return true;
      }
    }
    return false;
  }
View Full Code Here

Examples of org.beangle.http.agent.Useragent

   * @param request
   * @return
   */
  public static Useragent getUserAgent(HttpServletRequest request) {
    String head = request.getHeader("USER-AGENT");
    return new Useragent(getIpAddr(request), Browser.parse(head), Os.parse(head));
  }
View Full Code Here

Examples of org.beangle.web.Useragent

    //String remark=head.substring(start, end);
    String[] headers=StrUtils.split(head.toString());
    String browser=headers[headers.length-1];
    String os=headers[headers.length-2];
    //Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.12) Gecko/20101027 Fedora/3.6.12-1.fc14 Firefox/3.6.12
    Useragent agent = new Useragent();
    agent.setIp(getIpAddr(request));
    agent.setOs(StringUtils.substringBefore(os, "/"));
    agent.setOsVersion(StringUtils.substringAfterLast(os, "."));
    agent.setAgent(StringUtils.substringBefore(browser, "/"));
    agent.setAgentVersion(StringUtils.substringAfter(browser, "/"));
    return agent;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.