public void processEvent(ComponentSystemEvent event) throws AbortProcessingException {
    // http://javaserverfaces.java.net/nonav/docs/2.0/pdldocs/facelets/index.html
    // Finally make sure the component is only rendered in the header of the
    // HTML document.
    UIComponent component = event.getComponent();
    FacesContext context = FacesContext.getCurrentInstance();
    if (log.isLoggable(Level.FINER)) {
      log.finer("processEvent for component = " + component.getClass().getName());
    }
    context.getViewRoot().addComponentResource(context, component, HTML.HEAD_ELEM);

    ClientDescriptor client =
        ClientDescriptor.getInstance(
            (HttpServletRequest) context.getExternalContext().getRequest());
    String themeParam = context.getExternalContext().getRequestParameterMap().get("theme");
    Theme theme = null;
    if (client.isIE9orLessBrowser()) {
      theme = Theme.ARCHAIC;
    } else {
      theme =
          Theme.getEnum(
              themeParam != null
                  ? themeParam
                  : (String) event.getComponent().getAttributes().get("theme"));
      if (theme == null) {
        String targetView = (String) event.getComponent().getAttributes().get("view");
        theme = CSSUtils.deriveTheme(targetView, JSFUtils.getRequest());
      }
    }

    // android and honeycomb themes deprecated
    if (theme == Theme.ANDROID || theme == Theme.HONEYCOMB) {
      theme = Theme.ANDROID_DARK;
    }
    context.getExternalContext().getSessionMap().put(MOBI_THEME_KEY, theme);
  }