/** * Looks for the presence of a declared method (by name) in the specified * class and returns a <code>boolean</code> outcome (true, if the method * exists). * * @param instance The instance of the class that will be used as * the search domain. * * @return <code>true</code> if the method exists, otherwise * <code>false</code> */ private boolean hasGetStateMethod(ResponseStateManager instance) { return (ReflectionUtils.lookupMethod( instance.getClass(), "getState", FacesContext.class, String.class) != null); }
static void addChildToParentTagAndParentComponent(UIComponent child, UIComponentClassicTagBase parentTag) { Method addChildToComponentAndTag; if (null != (addChildToComponentAndTag = ReflectionUtils.lookupMethod(UIComponentClassicTagBase.class, "addChildToComponentAndTag", UIComponent.class))) { try { addChildToComponentAndTag.setAccessible(true); addChildToComponentAndTag.invoke(parentTag, child); } catch (IllegalAccessException | IllegalArgumentException accessException) { if (LOGGER.isLoggable(Level.WARNING)) { LOGGER.log(Level.WARNING, "Unable to add " + child + " to tree:", accessException); } } catch (InvocationTargetException targetException) { Throwable cause = targetException.getCause(); if (cause instanceof RuntimeException) { throw ((RuntimeException) cause); } } } }
static void addChildToParentTagAndParentComponent(UIComponent child, UIComponentClassicTagBase parentTag) { Method addChildToComponentAndTag; if (null != (addChildToComponentAndTag = ReflectionUtils.lookupMethod(UIComponentClassicTagBase.class, "addChildToComponentAndTag", UIComponent.class))) { try { addChildToComponentAndTag.setAccessible(true); addChildToComponentAndTag.invoke(parentTag, child); } catch (IllegalAccessException | IllegalArgumentException accessException) { if (LOGGER.isLoggable(Level.WARNING)) { LOGGER.log(Level.WARNING, "Unable to add " + child + " to tree:", accessException); } } catch (InvocationTargetException targetException) { Throwable cause = targetException.getCause(); if (cause instanceof RuntimeException) { throw ((RuntimeException) cause); } } } }
ReflectionUtils.lookupMethod(UIComponentClassicTagBase.class, "addChildToComponentAndTag", UIComponent.class))) {
ReflectionUtils.lookupMethod(UIComponentClassicTagBase.class, "addChildToComponentAndTag", UIComponent.class))) {
Method method = ReflectionUtils.lookupMethod( response.getClass(), "getContentType",
Method cloneMethod = lookupMethod(value, "clone"); if (cloneMethod != null) { try {
Method method = ReflectionUtils.lookupMethod( response.getClass(), "getContentType",
ReflectionUtils.lookupMethod(value.getClass(), "clone"); if (clone != null) { try {
Method cloneMethod = lookupMethod(value, "clone"); if (cloneMethod != null) { try {
Method method = ReflectionUtils.lookupMethod( response.getClass(), "getContentType",
Method method = ReflectionUtils.lookupMethod( response.getClass(), "getContentType",
Method cloneMethod = lookupMethod(value, "clone"); if (cloneMethod != null) { try {
Method method = ReflectionUtils.lookupMethod( response.getClass(), "getContentType",
private static void addEL3_0_Resolvers(FacesCompositeELResolver composite, ApplicationAssociate associate) { ExpressionFactory expressionFactory = associate.getExpressionFactory(); Method getStreamELResolverMethod = lookupMethod(ExpressionFactory.class, "getStreamELResolver", EMPTY_CLASS_ARGS); if (getStreamELResolverMethod != null) { try { ELResolver streamELResolver = (ELResolver) getStreamELResolverMethod.invoke(expressionFactory, (Object[]) null); composite.addRootELResolver(streamELResolver); // Assume that if we have getStreamELResolver, then we must have // javax.el.staticFieldELResolver composite.addRootELResolver((ELResolver) newInstance("javax.el.StaticFieldELResolver")); } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException | InstantiationException t) { // This is normal on containers that do not have these ELResolvers } } }
Method customFlush = ReflectionUtils.lookupMethod(response.getClass(), "flushContentToWrappedResponse", RIConstants.EMPTY_CLASS_ARGS);
private static void addEL3_0_Resolvers(FacesCompositeELResolver composite, ApplicationAssociate associate) { ExpressionFactory expressionFactory = associate.getExpressionFactory(); Method getStreamELResolverMethod = lookupMethod( ExpressionFactory.class, "getStreamELResolver", EMPTY_CLASS_ARGS); if (getStreamELResolverMethod != null) { try { ELResolver streamELResolver = (ELResolver) getStreamELResolverMethod.invoke( expressionFactory, (Object[]) null); composite.addRootELResolver(streamELResolver); // Assume that if we have getStreamELResolver, then we must have // javax.el.staticFieldELResolver composite.addRootELResolver((ELResolver) newInstance("javax.el.StaticFieldELResolver")); } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException | InstantiationException t) { // This is normal on containers that do not have these ELResolvers } } }
private static void addEL3_0_Resolvers(FacesCompositeELResolver composite, ApplicationAssociate associate) { ExpressionFactory expressionFactory = associate.getExpressionFactory(); Method getStreamELResolverMethod = lookupMethod( ExpressionFactory.class, "getStreamELResolver", EMPTY_CLASS_ARGS); if (getStreamELResolverMethod != null) { try { ELResolver streamELResolver = (ELResolver) getStreamELResolverMethod.invoke( expressionFactory, (Object[]) null); composite.addRootELResolver(streamELResolver); // Assume that if we have getStreamELResolver, then we must have // javax.el.staticFieldELResolver composite.addRootELResolver((ELResolver) newInstance("javax.el.StaticFieldELResolver")); } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException | InstantiationException t) { // This is normal on containers that do not have these ELResolvers } } }
private static void addEL3_0_Resolvers(FacesCompositeELResolver composite, ApplicationAssociate associate) { ExpressionFactory ef = associate.getExpressionFactory(); Method getStreamELResolverMethod = ReflectionUtils.lookupMethod(ExpressionFactory.class, "getStreamELResolver", RIConstants.EMPTY_CLASS_ARGS); if (null != getStreamELResolverMethod) { try { ELResolver streamELResolver = (ELResolver) getStreamELResolverMethod.invoke(ef, (Object[]) null); composite.addRootELResolver(streamELResolver); // Assume that if we have getStreamELResolver, then we must have // javax.el.staticFieldELResolver composite.addRootELResolver((ELResolver) ReflectionUtils.newInstance("javax.el.StaticFieldELResolver")); } catch (Throwable t) { // This is normal on containers that do not have these ELResolvers } } }
@SuppressWarnings("deprecation") private void restoreState(FacesContext context, UIViewRoot root, String renderKitId) { ResponseStateManager rsm = RenderKitUtils.getResponseStateManager(context, renderKitId); Object state; if (ReflectionUtils.lookupMethod(rsm.getClass(), "getState", FacesContext.class, String.class) != null) { Object[] stateArray = (Object[]) rsm.getState(context, root.getViewId()); state = stateArray[1]; } else { state = rsm.getComponentStateToRestore(context); } root.processRestoreState(context, state); }