コード例 #1
0
  public ApplicationAssociate(ApplicationImpl appImpl) {
    app = appImpl;

    propertyEditorHelper = new PropertyEditorHelper(appImpl);

    FacesContext ctx = FacesContext.getCurrentInstance();
    if (ctx == null) {
      throw new IllegalStateException(
          MessageUtils.getExceptionMessageString(
              MessageUtils.APPLICATION_ASSOCIATE_CTOR_WRONG_CALLSTACK_ID));
    }
    ExternalContext externalContext = ctx.getExternalContext();
    if (null != externalContext.getApplicationMap().get(ASSOCIATE_KEY)) {
      throw new IllegalStateException(
          MessageUtils.getExceptionMessageString(MessageUtils.APPLICATION_ASSOCIATE_EXISTS_ID));
    }
    externalContext.getApplicationMap().put(ASSOCIATE_KEY, this);
    //noinspection CollectionWithoutInitialCapacity
    caseListMap = new HashMap<String, List<ConfigNavigationCase>>();
    wildcardMatchList = new TreeSet<String>(new SortIt());
    injectionProvider = InjectionProviderFactory.createInstance(externalContext);
    WebConfiguration webConfig = WebConfiguration.getInstance(externalContext);
    beanManager =
        new BeanManager(
            injectionProvider,
            webConfig.isOptionEnabled(BooleanWebContextInitParameter.EnableLazyBeanValidation));
    annotationManager = new AnnotationManager();

    groovyHelper = GroovyHelper.getCurrentInstance();

    // initialize Facelets
    if (!webConfig.isOptionEnabled(BooleanWebContextInitParameter.DisableFaceletJSFViewHandler)) {
      compiler = createCompiler(webConfig);
      faceletFactory = createFaceletFactory(compiler, webConfig);
      devModeEnabled = (appImpl.getProjectStage() == ProjectStage.Development);
    }

    if (devModeEnabled) {
      resourceCache = new ResourceCache();
    }
    resourceManager = new ResourceManager(resourceCache);
  }
コード例 #2
0
  /** Initialize the core Facelets runtime. */
  protected void initialize() {

    if (LOGGER.isLoggable(Level.FINE)) {
      LOGGER.fine("Initializing FaceletViewHandlingStrategy");
    }

    this.initializeMappings();
    WebConfiguration config = WebConfiguration.getInstance();
    partialStateSaving = config.isOptionEnabled(PartialStateSaving);

    if (partialStateSaving) {
      String[] viewIds = config.getOptionValue(FullStateSavingViewIds, ",");
      fullStateViewIds = new HashSet<String>(viewIds.length, 1.0f);
      fullStateViewIds.addAll(Arrays.asList(viewIds));
      this.stateManagementStrategy = new StateManagementStrategyImpl(this);
    }

    groovyAvailable = GroovyHelper.isGroovyAvailable(FacesContext.getCurrentInstance());

    if (LOGGER.isLoggable(Level.FINE)) {
      LOGGER.fine("Initialization Successful");
    }
  }