@SuppressWarnings("unchecked") public void setInputClassName( String inputClassName ) { try { inputComponentClass = Util.loadClass( inputClassName, null ); } catch ( ClassNotFoundException e ) { e.printStackTrace(); } }
@Override protected Object getValue(UIComponent component) { if (Util.componentIsDisabled(component)) { return null; } else { return ((UIOutput) component).getValue(); } }
protected boolean shouldDecode(UIComponent component) { if (Util.componentIsDisabledOrReadonly(component)) { if (logger.isLoggable(Level.FINE)) { logger.log(Level.FINE, "No decoding necessary since the component {0} is disabled or read-only", component.getId()); } return false; } return true; }
String mapping = Util.getFacesMapping(context); UIViewRoot viewRoot = null; if (!Util.isPrefixMapped(mapping)) { viewId = convertViewId(context, viewId); } else { if (extContext.getRequestPathInfo() == null && mapping != null && Util.isPrefixMapped(mapping)) { viewRoot = Util.getStateManager(context).restoreView(context, viewId, renderKitId);
public Iterator<FeatureDescriptor> getFeatureDescriptors(ELContext context, Object base) { if (base != null) { return null; } ArrayList<FeatureDescriptor> list = new ArrayList<FeatureDescriptor>(); FacesContext facesContext = (FacesContext) context.getContext(FacesContext.class); ApplicationAssociate associate = ApplicationAssociate.getCurrentInstance(); Map<String, ApplicationResourceBundle> rbMap = associate.getResourceBundles(); if (rbMap == null) { return list.iterator(); } // iterate over the list of managed beans for (Iterator<Map.Entry<String,ApplicationResourceBundle>> i = rbMap.entrySet().iterator(); i.hasNext(); ) { Map.Entry<String,ApplicationResourceBundle> entry = i.next(); String var = entry.getKey(); ApplicationResourceBundle bundle = entry.getValue(); if ( bundle != null) { Locale curLocale = Util.getLocaleFromContextOrSystem(facesContext); String description = bundle.getDescription(curLocale); String displayName = bundle.getDisplayName(curLocale); list.add(Util.getFeatureDescriptor(var, displayName, description, false, false, true, ResourceBundle.class, Boolean.TRUE)); } } return list.iterator(); }
/** * Normalize the request path to exclude JSF invocation information. * If the FacesServlet servicing this request was prefix mapped, then * the path to the FacesServlet will be removed. * If the FacesServlet servicing this request was extension mapped, then * the extension will be trimmed off. * @param context the <code>FacesContext</code> for the current request * @return the request path without JSF invocation information */ private String normalizeResourceRequest(FacesContext context) { String path; String facesServletMapping = Util.getFacesMapping(context); // If it is extension mapped if (!Util.isPrefixMapped(facesServletMapping)) { path = context.getExternalContext().getRequestServletPath(); // strip off the extension int i = path.lastIndexOf("."); if (0 < i) { path = path.substring(0, i); } } else { path = context.getExternalContext().getRequestPathInfo(); } return path; }
protected String derivePhysicalViewId(FacesContext ctx, String requestViewId, boolean checkPhysical) { String mapping = getFacesMapping(ctx); if (mapping != null) { String physicalViewId; if (isExactMapped(mapping)) { } else if (!isPrefixMapped(mapping)) {
public static Class loadClass(String name, Object fallbackClass) throws ClassNotFoundException { ClassLoader loader = Util.getCurrentLoader(fallbackClass); String[] primitiveNames = { "byte", "short", "int", "long", "float", "double", "boolean", "char" }; Class<?>[] primitiveClasses = { byte.class, short.class, int.class, long.class, float.class, double.class, boolean.class, char.class }; for (int i = 0; i < primitiveNames.length; i++) { if (primitiveNames[i].equals(name)) { return primitiveClasses[i]; } } return Class.forName(name, true, loader); }
private void setDefaultLocale(Application application, Node defaultLocale) { if (defaultLocale != null) { String defLocale = getNodeText(defaultLocale); if (defLocale != null) { Locale def = getLocaleFromString(defLocale); if (def != null) { if (LOGGER.isLoggable(FINE)) { LOGGER.log(FINE, format("Setting default Locale to ''{0}''", defLocale)); } application.setDefaultLocale(def); } } } }
/** * <p>Invoked when the value change described by the specified * {@link javax.faces.event.ValueChangeEvent} occurs.</p> * * @return a <code>PhaseListener</code> instance * @throws javax.faces.event.AbortProcessingException * Signal the JavaServer Faces * implementation that no further processing on the current event * should be performed */ public PhaseListener getPhaseListener() throws AbortProcessingException { PhaseListener instance = (PhaseListener) Util.getListenerInstance(type, binding); if (instance != null) { return instance; } else { if (LOGGER.isLoggable(Level.WARNING)) { // PENDING i18n LOGGER.warning("PhaseListener will not be processed - " + "both 'binding' and 'type' are null"); } return null; } } }
converter = Util.getConverterForClass(converterType, context);
@Override public Iterator<FeatureDescriptor> getFeatureDescriptors(ELContext context, Object base) { if (base != null) { return null; } ArrayList<FeatureDescriptor> list = new ArrayList<>(2); list.add(Util.getFeatureDescriptor("facesContext", "facesContext", "facesContext",false, false, true, FacesContext.class, Boolean.TRUE)); list.add(Util.getFeatureDescriptor("view", "view", "root",false, false, true, UIViewRoot.class, Boolean.TRUE)); return list.iterator(); }
String mapping = getFacesMapping(ctx); UIViewRoot viewRoot = null; if (extContext.getRequestPathInfo() == null && mapping != null && isPrefixMapped(mapping)) { String renderKitId = outerViewHandler.calculateRenderKitId(ctx); viewRoot = getStateManager(ctx).restoreView(ctx, viewId, renderKitId);
ApplicationResourceBundle bundle = entry.getValue(); if ( bundle != null) { Locale curLocale = Util.getLocaleFromContextOrSystem(facesContext); list.add(Util.getFeatureDescriptor(var, displayName, description, false, false, true, ResourceBundle.class, Boolean.TRUE));
/** * Normalize the request path to exclude JSF invocation information. * If the FacesServlet servicing this request was prefix mapped, then * the path to the FacesServlet will be removed. * If the FacesServlet servicing this request was extension mapped, then * the extension will be trimmed off. * * @param context the <code>FacesContext</code> for the current request * @return the request path without JSF invocation information */ private String normalizeResourceRequest(FacesContext context) { String path; String facesServletMapping = getFacesMapping(context); // If it is extension mapped if (!isPrefixMapped(facesServletMapping)) { path = context.getExternalContext().getRequestServletPath(); // strip off the extension int i = path.lastIndexOf("."); if (0 < i) { path = path.substring(0, i); } } else { path = context.getExternalContext().getRequestPathInfo(); } return path; }
protected String derivePhysicalViewId(FacesContext ctx, String requestViewId, boolean checkPhysical) { String mapping = getFacesMapping(ctx); if (mapping != null) { String physicalViewId; if (isExactMapped(mapping)) { } else if (!isPrefixMapped(mapping)) {
public static Class loadClass(String name, Object fallbackClass) throws ClassNotFoundException { ClassLoader loader = Util.getCurrentLoader(fallbackClass); String[] primitiveNames = { "byte", "short", "int", "long", "float", "double", "boolean", "char" }; Class<?>[] primitiveClasses = { byte.class, short.class, int.class, long.class, float.class, double.class, boolean.class, char.class }; for (int i = 0; i < primitiveNames.length; i++) { if (primitiveNames[i].equals(name)) { return primitiveClasses[i]; } } return Class.forName(name, true, loader); }
private void setDefaultLocale(Application application, Node defaultLocale) { if (defaultLocale != null) { String defLocale = getNodeText(defaultLocale); if (defLocale != null) { Locale def = getLocaleFromString(defLocale); if (def != null) { if (LOGGER.isLoggable(FINE)) { LOGGER.log(FINE, format("Setting default Locale to ''{0}''", defLocale)); } application.setDefaultLocale(def); } } } }
/** * <p>Invoked when the value change described by the specified * {@link javax.faces.event.ValueChangeEvent} occurs.</p> * * @return a <code>PhaseListener</code> instance * @throws javax.faces.event.AbortProcessingException * Signal the JavaServer Faces * implementation that no further processing on the current event * should be performed */ public PhaseListener getPhaseListener() throws AbortProcessingException { PhaseListener instance = (PhaseListener) Util.getListenerInstance(type, binding); if (instance != null) { return instance; } else { if (LOGGER.isLoggable(Level.WARNING)) { // PENDING i18n LOGGER.warning("PhaseListener will not be processed - " + "both 'binding' and 'type' are null"); } return null; } } }
converter = Util.getConverterForClass(converterType, context);