public AjaxRequestBuilder partialSubmit(boolean value, boolean partialSubmitSet, String partialSubmitFilter) { PrimeConfiguration config = RequestContext.getCurrentInstance(context).getApplicationContext().getConfig(); //component can override global setting boolean partialSubmit = partialSubmitSet ? value : config.isPartialSubmitEnabled(); if (partialSubmit) { buffer.append(",ps:true"); if (partialSubmitFilter != null) { buffer.append(",psf:\"").append(partialSubmitFilter).append("\""); } } return this; }
/** * Get all constants of the given {@link Class}. * * @param facesContext The {@link FacesContext}. * @param type The class which includes the constants. * @return A {@link Map} with the constants. */ protected Map<String, Object> getConstants(FacesContext facesContext, Class<?> type) { boolean cacheEnabled = facesContext.isProjectStage(ProjectStage.Production); Map<Class<?>, Map<String, Object>> cache = RequestContext.getCurrentInstance().getApplicationContext().getConstantsCacheMap(); Map<String, Object> constants; if (cacheEnabled && cache.containsKey(type)) { constants = cache.get(type); } else { constants = Collections.unmodifiableMap(collectConstants(type)); if (cacheEnabled) { cache.put(type, constants); } } return constants; }
@Override public void processEvent(SystemEvent event) throws AbortProcessingException { ApplicationContext applicationContext = ApplicationContext.getCurrentInstance(FacesContext.getCurrentInstance()); if (applicationContext != null) { applicationContext.release(); } } }
@Override public ApplicationContext getApplicationContext() { if (this.applicationContext == null) { this.applicationContext = ApplicationContext.getCurrentInstance(context); if (this.applicationContext == null) { this.applicationContext = new DefaultApplicationContext(context); ApplicationContext.setCurrentInstance(applicationContext, context); } } return applicationContext; }
requestContext.getApplicationContext().getConfig().isInterpolateClientSideValidationMessages(); messageInterpolator = requestContext.getApplicationContext().getValidatorFactory().getMessageInterpolator();
= RequestContext.getCurrentInstance().getApplicationContext().getEnumCacheMap();
public static PropertyDescriptor extractPropertyDescriptor(FacesContext context, RequestContext requestContext, ValueExpression ve) { if (ve != null) { ELContext elContext = context.getELContext(); ValueReference vr = ValueExpressionAnalyzer.getReference(elContext, ve); if (vr != null) { Validator validator = requestContext.getApplicationContext().getValidator(); Object base = vr.getBase(); Object property = vr.getProperty(); if (base != null && property != null) { BeanDescriptor beanDescriptor = validator.getConstraintsForClass(base.getClass()); if (beanDescriptor != null) { return beanDescriptor.getConstraintsForProperty(property.toString()); } } } } return null; } }
CacheProvider cacheProvider = RequestContext.getCurrentInstance(context).getApplicationContext().getCacheProvider(); String key = uiCache.getKey(); String region = uiCache.getRegion();
@Deprecated public AjaxRequestBuilder partialSubmit(boolean value, boolean partialSubmitSet) { PrimeConfiguration config = RequestContext.getCurrentInstance(context).getApplicationContext().getConfig(); //component can override global setting boolean partialSubmit = partialSubmitSet ? value : config.isPartialSubmitEnabled(); if (partialSubmit) { buffer.append(",ps:true"); } return this; }
protected void addAttachedObjectHandlerToMojarra(UIComponent component) { String key = MOJARRA_ATTACHED_OBJECT_HANDLERS_KEY; if (RequestContext.getCurrentInstance().getApplicationContext().getConfig().isAtLeastJSF22()) { key = MOJARRA_22_ATTACHED_OBJECT_HANDLERS_KEY; } Map<String, Object> attrs = component.getAttributes(); List<AttachedObjectHandler> result = (List<AttachedObjectHandler>) attrs.get(key); if (result == null) { result = new ArrayList<AttachedObjectHandler>(); attrs.put(key, result); } result.add(this); }
@Override public WidgetBuilder getWidgetBuilder() { if (this.widgetBuilder == null) { this.widgetBuilder = new WidgetBuilder(context, getApplicationContext().getConfig()); } return widgetBuilder; }
public AjaxRequestBuilder resetValues(boolean value, boolean resetValuesSet) { PrimeConfiguration config = RequestContext.getCurrentInstance(context).getApplicationContext().getConfig(); //component can override global setting boolean resetValues = resetValuesSet ? value : config.isResetValuesEnabled(); if (resetValues) { buffer.append(",rv:true"); } return this; }
protected String resolveTheme(FacesContext context) { String theme = null; String themeConfigValue = RequestContext.getCurrentInstance(context).getApplicationContext().getConfig().getMobileTheme(); if (themeConfigValue != null) { ELContext elContext = context.getELContext(); ExpressionFactory expressionFactory = context.getApplication().getExpressionFactory(); ValueExpression ve = expressionFactory.createValueExpression(elContext, themeConfigValue, String.class); theme = ve.isLiteralText() ? themeConfigValue : (String) ve.getValue(elContext); } return theme; }
public PrimeResource(final Resource resource) { super(); wrapped = resource; version = "&v=" + RequestContext.getCurrentInstance().getApplicationContext().getConfig().getBuildVersion(); }
public static boolean isSkipIteration(VisitContext visitContext, FacesContext context) { if (RequestContext.getCurrentInstance(context).getApplicationContext().getConfig().isAtLeastJSF21()) { return visitContext.getHints().contains(VisitHint.SKIP_ITERATION); } else { Boolean skipIterationHint = (Boolean) visitContext.getFacesContext().getAttributes().get(SKIP_ITERATION_HINT); return skipIterationHint != null && skipIterationHint.booleanValue() == true; } }
@Override public StringEncrypter getEncrypter() { // lazy init, it's not required for all pages if (encrypter == null) { // we can't store it in the ApplicationMap, as Cipher isn't thread safe encrypter = new StringEncrypter(getApplicationContext().getConfig().getSecretKey()); } return encrypter; }
if (RequestContext.getCurrentInstance(context).getApplicationContext().getConfig().isAtLeastJSF22()) { String toFlowDocumentId = navCase.getToFlowDocumentId(); if (toFlowDocumentId != null) {
protected void renderDynamicPassThruAttributes(FacesContext context, UIComponent component) throws IOException { if (RequestContext.getCurrentInstance(context).getApplicationContext().getConfig().isAtLeastJSF22()) { Jsf22Helper.renderPassThroughAttributes(context, component); } }
protected boolean isBeanValidationDefined(UIInput input, FacesContext context) { try { Set<ConstraintDescriptor<?>> constraints = BeanValidationMetadataExtractor.extractDefaultConstraintDescriptors( context, RequestContext.getCurrentInstance(context), ValueExpressionAnalyzer.getExpression(context.getELContext(), input.getValueExpression("value"))); if (constraints == null || constraints.isEmpty()) { return false; } for (ConstraintDescriptor<?> constraintDescriptor : constraints) { Class<? extends Annotation> annotationType = constraintDescriptor.getAnnotation().annotationType(); // GitHub #14 skip @NotNull check if (annotationType.equals(NotNull.class)) { return RequestContext.getCurrentInstance(context).getApplicationContext().getConfig().isInterpretEmptyStringAsNull(); } // GitHub #3052 @NotBlank,@NotEmpty Hibernate and BeanValidator 2.0 String annotationClassName = annotationType.getSimpleName(); if ("NotBlank".equals(annotationClassName) || "NotEmpty".equals(annotationClassName)) { return true; } } } catch (PropertyNotFoundException e) { String message = "Skip evaluating [@NotNull,@NotBlank,@NotEmpty] for outputLabel and referenced component \"" + input.getClientId(context) + "\" because the ValueExpression of the \"value\" attribute" + " isn't resolvable completely (e.g. a sub-expression returns null)"; LOG.log(Level.FINE, message); } return false; }
protected NavigationCase findNavigationCase(FacesContext context, UIOutcomeTarget outcomeTarget) { ConfigurableNavigationHandler navigationHandler = (ConfigurableNavigationHandler) context.getApplication().getNavigationHandler(); String outcome = outcomeTarget.getOutcome(); if (outcome == null) { outcome = context.getViewRoot().getViewId(); } if (RequestContext.getCurrentInstance(context).getApplicationContext().getConfig().isAtLeastJSF22()) { if (outcomeTarget instanceof UIComponent) { String toFlowDocumentId = (String) ((UIComponent) outcomeTarget).getAttributes().get(ActionListener.TO_FLOW_DOCUMENT_ID_ATTR_NAME); if (toFlowDocumentId != null) { return navigationHandler.getNavigationCase(context, null, outcome, toFlowDocumentId); } } } return navigationHandler.getNavigationCase(context, null, outcome); }