Examples of TobagoConfig


Examples of org.apache.myfaces.tobago.config.TobagoConfig

    }

    if (LOG.isDebugEnabled()) {
      LOG.debug("2nd");
    }
    TobagoConfig tobagoConfig = (TobagoConfig)
        getServletContext().getAttribute(TobagoConfig.TOBAGO_CONFIG);

    if (tobagoConfig == null) { // TobagoServletContextListener is not called until now!
      final String className = TobagoServletContextListener.class.getName();
      if (LOG.isDebugEnabled()) {
View Full Code Here

Examples of org.apache.myfaces.tobago.config.TobagoConfig

      LOG.debug("userAgent='" + this.userAgent + "' from header " + "'User-Agent: " + requestUserAgent + "'");
    }

    // theme
    String requestTheme = (String) externalContext.getRequestParameterMap().get("tobago.theme");
    TobagoConfig config = TobagoConfig.getInstance(facesContext);
    // TODO log error if tobago config is not initialized
    this.theme = config.getTheme(requestTheme);
    if (LOG.isDebugEnabled()) {
      LOG.debug("theme='" + theme.getName() + "' from requestParameter " + "tobago.theme='" + requestTheme + "'");
    }

    reset();
View Full Code Here

Examples of org.apache.myfaces.tobago.config.TobagoConfig

    language = application.getDefaultLocale();
    countries.init(language);
    facesContext.getExternalContext().getSession(true);
    initLanguages();

    TobagoConfig tobagoConfig = TobagoConfig.getInstance(facesContext);
    List<Theme> themes = new ArrayList<Theme>(tobagoConfig.getSupportedThemes());
    themes.add(0, tobagoConfig.getDefaultTheme());
    themeItems = new ArrayList<SelectItem>();
    for (Theme theme : themes) {
      themeItems.add(new SelectItem(theme, theme.getDisplayName()));
    }
View Full Code Here

Examples of org.apache.myfaces.tobago.config.TobagoConfig

      LOG.debug("userAgent='" + this.userAgent + "' from header " + "'User-Agent: " + requestUserAgent + "'");
    }

    // theme
    String requestTheme = (String) externalContext.getRequestParameterMap().get("tobago.theme");
    TobagoConfig config = TobagoConfig.getInstance(facesContext);
    // TODO log error if tobago config is not initialized
    this.theme = config.getTheme(requestTheme);
    if (LOG.isDebugEnabled()) {
      LOG.debug("theme='" + theme.getName() + "' from requestParameter " + "tobago.theme='" + requestTheme + "'");
    }

    reset();
View Full Code Here

Examples of org.apache.myfaces.tobago.config.TobagoConfig

  private Set<String> resourceDirs = new HashSet<String>();

  @Override
  public void init(ServletConfig servletConfig) throws ServletException {
    super.init(servletConfig);
    TobagoConfig tobagoConfig = TobagoConfig.getInstance(servletConfig.getServletContext());
    if (tobagoConfig != null && tobagoConfig.getProjectStage() == ProjectStage.Production) {
       expires = 24 * 60 * 60 * 1000L;
    }
    Theme defaultTheme = tobagoConfig.getDefaultTheme();
    addResourceDir(defaultTheme.getFallbackList());
    addResourceDir(tobagoConfig.getSupportedThemes());

    String expiresString = servletConfig.getInitParameter("expires");
    if (expiresString != null) {
      try {
        expires = new Long(expiresString) * 1000;
 
View Full Code Here

Examples of org.apache.myfaces.tobago.config.TobagoConfig

  @Override
  public void encodeBegin(FacesContext facesContext, UIComponent component) throws IOException {

    final UIPage page = (UIPage) component;
    final TobagoConfig tobagoConfig = TobagoConfig.getInstance(facesContext);

    // invoke prepareRender
    RenderUtils.prepareRendererAll(facesContext, page);

    LayoutContext layoutContext = new LayoutContext(page);
    layoutContext.layout();
    if (FacesContextUtils.getFocusId(facesContext) == null && !StringUtils.isBlank(page.getFocusId())) {
      FacesContextUtils.setFocusId(facesContext, page.getFocusId());
    }
    TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);

    // reset responseWriter and render page
    facesContext.setResponseWriter(writer);

    ResponseUtils.ensureNoCacheHeader(facesContext);

    ResponseUtils.ensureContentSecurityPolicyHeader(facesContext, tobagoConfig.getContentSecurityPolicy());

    if (LOG.isDebugEnabled()) {
      for (Object o : page.getAttributes().entrySet()) {
        Map.Entry entry = (Map.Entry) o;
        LOG.debug("*** '" + entry.getKey() + "' -> '" + entry.getValue() + "'");
      }
    }

    Application application = facesContext.getApplication();
    ViewHandler viewHandler = application.getViewHandler();
    String viewId = facesContext.getViewRoot().getViewId();
    String formAction = viewHandler.getActionURL(facesContext, viewId);
    formAction = facesContext.getExternalContext().encodeActionURL(formAction);
    String contentType = writer.getContentTypeWithCharSet();
    ResponseUtils.ensureContentTypeHeader(facesContext, contentType);
    String clientId = page.getClientId(facesContext);
    final ClientProperties client = VariableResolverUtils.resolveClientProperties(facesContext);
    final ProjectStage projectStage = tobagoConfig.getProjectStage();
    final boolean developmentMode =  projectStage == ProjectStage.Development;
    final boolean debugMode = client.isDebugMode() || developmentMode;
    final boolean productionMode = !debugMode && projectStage == ProjectStage.Production;
    int clientLogSeverity = 2;
    if (debugMode) {
      String severity = (String) facesContext.getExternalContext().getRequestMap().get(CLIENT_DEBUG_SEVERITY);
      if (LOG.isDebugEnabled()) {
        LOG.debug("get " + CLIENT_DEBUG_SEVERITY + " = " + severity);
      }
      if (severity != null) {
        try {
          int index = severity.indexOf(';');
          if (index == -1) {
            index = severity.length();
          }
          clientLogSeverity = Integer.parseInt(severity.substring(0, index));
        } catch (NumberFormatException e) {
          // ignore; use default
        }
      }
    }
    boolean preventFrameAttacks = tobagoConfig.isPreventFrameAttacks();

    if (!FacesContextUtils.isAjax(facesContext)) {
      HtmlRendererUtils.renderDojoDndSource(facesContext, component);

      String title = (String) page.getAttributes().get(Attributes.LABEL);
View Full Code Here

Examples of org.apache.myfaces.tobago.config.TobagoConfig

    language = application.getDefaultLocale();
    countries.init(language);
    facesContext.getExternalContext().getSession(true);
    initLanguages();

    TobagoConfig tobagoConfig = TobagoConfig.getInstance(facesContext);
    List<Theme> themes = new ArrayList<Theme>(tobagoConfig.getSupportedThemes());
    themes.add(0, tobagoConfig.getDefaultTheme());
    themeItems = new ArrayList<SelectItem>();
    for (Theme theme : themes) {
      themeItems.add(new SelectItem(theme, theme.getDisplayName()));
    }
View Full Code Here

Examples of org.apache.myfaces.tobago.config.TobagoConfig

    }

    if (LOG.isDebugEnabled()) {
      LOG.debug("2nd");
    }
    TobagoConfig tobagoConfig = (TobagoConfig)
        getServletContext().getAttribute(TobagoConfig.TOBAGO_CONFIG);

    if (tobagoConfig == null) { // TobagoServletContextListener is not called until now!
      final String className = TobagoServletContextListener.class.getName();
      if (LOG.isDebugEnabled()) {
View Full Code Here

Examples of org.apache.myfaces.tobago.config.TobagoConfig

  public ClientConfigController() {

    // theme

    FacesContext facesContext = FacesContext.getCurrentInstance();
    TobagoConfig tobagoConfig = TobagoConfig.getInstance(facesContext);

    List<Theme> themes = new ArrayList<Theme>(tobagoConfig.getSupportedThemes());
    themes.add(0, tobagoConfig.getDefaultTheme());
    themeItems = new SelectItem[themes.size()];
    for (int i = 0; i < themeItems.length; i++) {
      Theme themeItem = themes.get(i);
      themeItems[i] = new SelectItem(themeItem, themeItem.getDisplayName());
    }
View Full Code Here

Examples of org.apache.myfaces.tobago.config.TobagoConfig

  public ClientConfigController() {

    // theme

    FacesContext facesContext = FacesContext.getCurrentInstance();
    TobagoConfig tobagoConfig = TobagoConfig.getInstance(facesContext);

    List<Theme> themes = new ArrayList<Theme>(tobagoConfig.getSupportedThemes());
    themes.add(0, tobagoConfig.getDefaultTheme());
    themeItems = new SelectItem[themes.size()];
    for (int i = 0; i < themeItems.length; i++) {
      Theme themeItem = themes.get(i);
      themeItems[i] = new SelectItem(themeItem, themeItem.getDisplayName());
    }
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.