private EvaluationContext createEvaluationContext(PageContext pageContext) { StandardEvaluationContext context = new StandardEvaluationContext(); context.addPropertyAccessor(new JspPropertyAccessor(pageContext)); context.addPropertyAccessor(new MapAccessor()); context.addPropertyAccessor(new EnvironmentAccessor()); context.setBeanResolver(new BeanFactoryResolver(getRequestContext().getWebApplicationContext())); ConversionService conversionService = getConversionService(pageContext); if (conversionService != null) { context.setTypeConverter(new StandardTypeConverter(conversionService)); } return context; }
private EvaluationContext createEvaluationContext(PageContext pageContext) { StandardEvaluationContext context = new StandardEvaluationContext(); context.addPropertyAccessor(new JspPropertyAccessor(pageContext)); context.addPropertyAccessor(new MapAccessor()); context.addPropertyAccessor(new EnvironmentAccessor()); context.setBeanResolver(new BeanFactoryResolver(getRequestContext().getWebApplicationContext())); ConversionService conversionService = getConversionService(pageContext); if (conversionService != null) { context.setTypeConverter(new StandardTypeConverter(conversionService)); } return context; }
/** * Use the application context itself for default message resolution. */ protected MessageSource getMessageSource() { return getRequestContext().getWebApplicationContext(); }
private ConnectionRepository getConnectionRepository() { WebApplicationContext applicationContext = getRequestContext().getWebApplicationContext(); return applicationContext.getBean(ConnectionRepository.class); }
/** * Use the application context itself for default message resolution. */ private MessageSource getMessageSource() { try { this.requestContext = new RequestContext((HttpServletRequest) this.pageContext.getRequest()); } catch (RuntimeException ex) { throw ex; } catch (Exception ex) { pageContext.getServletContext().log("Exception in custom tag", ex); } return requestContext.getWebApplicationContext(); }
/** * <p>Retrieves the <code>PresetsManager</code> from the application context the first time the tag is used and at all other * times just returns the <code>EVAL_BODY_INCLUDE</code> constant to process any child tags. This is currently hard-coded * to retrieve the default Spring Surf <code>PresetsManager</code> bean with an id of "webframework.presets.manager".</p> */ @Override protected int doStartTagInternal() throws Exception { if (this.presetManager != null) { // No action required. We already have the PresetManager. } else { WebApplicationContext applicationContext = getRequestContext().getWebApplicationContext(); this.presetManager = (PresetsManager) applicationContext.getBean("webframework.presets.manager"); } return EVAL_BODY_INCLUDE; }
/** * <p>Retrieves the <code>PresetsManager</code> from the application context the first time the tag is used and at all other * times just returns the <code>EVAL_BODY_INCLUDE</code> constant to process any child tags. This is currently hard-coded * to retrieve the default Spring Surf <code>PresetsManager</code> bean with an id of "webframework.presets.manager".</p> */ @Override protected int doStartTagInternal() throws Exception { if (this.presetManager != null) { // No action required. We already have the PresetManager. } else { WebApplicationContext applicationContext = getRequestContext().getWebApplicationContext(); this.presetManager = (PresetsManager) applicationContext.getBean("webframework.presets.manager"); } return EVAL_BODY_INCLUDE; }
/** 判断是不是静态资源文件的后缀 **/ private boolean isAssetSuffix(String href) { ApplicationContext ac = getRequestContext().getWebApplicationContext(); Properties setting = ac.getBean(Properties.class); if (SUFFIXES == null) { String suffix = PropertyTools.getString(setting, "assets.suffix"); if (suffix == null) { return false; } SUFFIXES = StringTools.split(suffix); } if (VERSION == null) { VERSION = PropertyTools.getString(setting, "assets.version"); if (VERSION == null) { return false; } } for (String suffix : SUFFIXES) { if (href.endsWith(suffix)) { return true; } } return false; }
public int doEndTag() throws JspException { try { Collection rules = new ArrayList(); if (commandName != null) { rules.addAll(getRulesForCommand()); } if (bodyContent != null) { rules.addAll(parseRulesFromBodyContent()); } if (rules.size() == 0) { throw new JspException("no valang validation rules were found"); } JspWriter out = pageContext.getOut(); out.write("<script type=\"text/javascript\" id=\""); out.write(commandName + "ValangValidator"); out.write("\">"); translator.writeJavaScriptValangValidator(out, commandName, true, rules, new MessageSourceAccessor( getRequestContext().getWebApplicationContext(), getRequestContext().getLocale())); out.write("</script>"); return EVAL_PAGE; } catch (IOException e) { throw new JspException("Could not write validation rules", e); } }
WebApplicationContext applicationContext = getRequestContext().getWebApplicationContext(); String[] renderServices = applicationContext.getBeanNamesForType(RenderService.class); if (renderServices.length == 0)
WebApplicationContext applicationContext = getRequestContext().getWebApplicationContext(); String[] renderServices = applicationContext.getBeanNamesForType(RenderService.class); if (renderServices.length == 0)
private EvaluationContext createEvaluationContext(PageContext pageContext) { StandardEvaluationContext context = new StandardEvaluationContext(); context.addPropertyAccessor(new JspPropertyAccessor(pageContext)); context.addPropertyAccessor(new MapAccessor()); context.addPropertyAccessor(new EnvironmentAccessor()); context.setBeanResolver(new BeanFactoryResolver(getRequestContext().getWebApplicationContext())); ConversionService conversionService = getConversionService(pageContext); if (conversionService != null) { context.setTypeConverter(new StandardTypeConverter(conversionService)); } return context; }