@Override public void setUseDecoupledLogic(final boolean useDecoupledLogic) { if (useDecoupledLogic) { throw new ConfigurationException("The 'useDecoupledLogic' flag is not allowed for String template resolution"); } super.setUseDecoupledLogic(useDecoupledLogic); }
JacksonStandardJavaScriptSerializer(final String jacksonPrefix) { super(); this.mapper = new ObjectMapper(); this.mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); this.mapper.disable(JsonGenerator.Feature.AUTO_CLOSE_TARGET); this.mapper.enable(JsonGenerator.Feature.ESCAPE_NON_ASCII); this.mapper.getFactory().setCharacterEscapes(new JacksonThymeleafCharacterEscapes()); this.mapper.setDateFormat(new JacksonThymeleafISO8601DateFormat()); /* * Now try to (conditionally) initialize support for Jackson serialization of JSR310 (java.time) objects, * by making use of the 'jackson-datatype-jsr310' optional dependency. */ final Class<?> javaTimeModuleClass = ClassLoaderUtils.findClass(jacksonPrefix + ".datatype.jsr310.JavaTimeModule"); if (javaTimeModuleClass != null) { // JSR310 support for Jackson is present in classpath try { this.mapper.registerModule((Module)javaTimeModuleClass.newInstance()); this.mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false); } catch (final InstantiationException e) { throw new ConfigurationException("Exception while trying to initialize JSR310 support for Jackson", e); } catch (final IllegalAccessException e) { throw new ConfigurationException("Exception while trying to initialize JSR310 support for Jackson", e); } } }
throw new ConfigurationException("Dialect should not return null processor set: " + dialect.getClass().getName()); throw new ConfigurationException("Dialect should not return null processor in processor set: " + dialect.getClass().getName()); throw new ConfigurationException("Template mode cannot be null (processor: " + dialectProcessor.getClass().getName() + ")"); final String executionAttributeName = entry.getKey(); if (executionAttributes.containsKey(executionAttributeName)) { throw new ConfigurationException( "Conflicting execution attribute. Two or more dialects specify an execution " + "attribute with the same name \"" + executionAttributeName + "\"."); throw new ConfigurationException( "Pre-Processor list for dialect " + dialect.getClass().getName() + " includes a " + "null entry, which is forbidden."); throw new ConfigurationException( "Template mode cannot be null (pre-processor: " + preProcessor.getClass().getName() + ", dialect" + dialect.getClass().getName() + ")"); throw new ConfigurationException( "Pre-Processor " + preProcessor.getClass().getName() + " for dialect " + preProcessor.getClass().getName() + " returns a null handler class, which is forbidden."); throw new ConfigurationException( "Handler class " + handlerClass.getName() + " specified for " + "pre-processor " + preProcessor.getClass().getName() + " in dialect " + throw new ConfigurationException(
private static TextAttributeDefinition buildTextAttributeDefinition( final TemplateMode templateMode, final TextAttributeName name, final Set<IElementProcessor> elementProcessors) { // No need to use a list for sorting - the elementProcessors set has already been ordered final Set<IElementProcessor> associatedProcessors = new LinkedHashSet<IElementProcessor>(2); if (elementProcessors != null) { for (final IElementProcessor processor : elementProcessors) { if (processor.getTemplateMode() != templateMode) { // We are creating a text element definition, therefore we are only interested on XML processors continue; } final MatchingElementName matchingElementName = processor.getMatchingElementName(); final MatchingAttributeName matchingAttributeName = processor.getMatchingAttributeName(); if ((matchingElementName != null && matchingElementName.getTemplateMode() != templateMode) || (matchingAttributeName != null && matchingAttributeName.getTemplateMode() != templateMode)) { throw new ConfigurationException(templateMode + " processors must return " + templateMode + "element names and " + templateMode + " attribute names (processor: " + processor.getClass().getName() + ")"); } if (matchingAttributeName == null || matchingAttributeName.isMatchingAllAttributes()) { // This processor does not relate to a specific attribute - surely an element processor continue; } if (!matchingAttributeName.matches(name)) { // Doesn't match. This processor is not associated with this attribute continue; } associatedProcessors.add(processor); } } // Build the final instance return new TextAttributeDefinition(name, associatedProcessors); }
throw new ConfigurationException(templateMode + " processors must return " + templateMode + "element names and " + templateMode + " attribute names (processor: " + processor.getClass().getName() + ")");
throw new ConfigurationException("HTML processors must return HTML element names and HTML attribute names (processor: " + processor.getClass().getName() + ")");
throw new ConfigurationException("XML processors must return XML element names and XML attribute names (processor: " + processor.getClass().getName() + ")");
throw new ConfigurationException("XML processors must return XML element names and XML attribute names (processor: " + processor.getClass().getName() + ")");
throw new ConfigurationException("HTML processors must return HTML element names and HTML attribute names (processor: " + processor.getClass().getName() + ")");
private void checkMessageSourceInitialized() { if (this.messageSource == null) { throw new ConfigurationException( "Cannot initialize " + SpringMessageResolver.class.getSimpleName() + ": MessageSource has not been set. Either define this object as " + "a Spring bean (which will automatically set the MessageSource) or, " + "if you instance it directly, set the MessageSource manually using its "+ "corresponding setter method."); } }
private void checkMessageSourceInitialized() { if (this.messageSource == null) { throw new ConfigurationException( "Cannot initialize " + SpringMessageResolver.class.getSimpleName() + ": MessageSource has not been set. Either define this object as " + "a Spring bean (which will automatically set the MessageSource) or, " + "if you instance it directly, set the MessageSource manually using its "+ "corresponding setter method."); } }
private void checkMessageSourceInitialized() { if (this.messageSource == null) { throw new ConfigurationException( "Cannot initialize " + SpringMessageResolver.class.getSimpleName() + ": MessageSource has not been set. Either define this object as " + "a Spring bean (which will automatically set the MessageSource) or, " + "if you instance it directly, set the MessageSource manually using its "+ "corresponding setter method."); } }
private void checkMessageSourceInitialized() { if (this.messageSource == null) { throw new ConfigurationException( "Cannot initialize " + SpringMessageResolver.class.getSimpleName() + ": MessageSource has not been set. Either define this object as " + "a Spring bean (which will automatically set the MessageSource) or, " + "if you instance it directly, set the MessageSource manually using its "+ "corresponding setter method."); } }
private void checkMessageSourceInitialized() { if (this.messageSource == null) { throw new ConfigurationException( "Cannot initialize " + SpringMessageResolver.class.getSimpleName() + ": MessageSource has not been set. Either define this object as " + "a Spring bean (which will automatically set the MessageSource) or, " + "if you instance it directly, set the MessageSource manually using its "+ "corresponding setter method."); } }
@Override public void setResourceResolver(final IResourceResolver resourceResolver) { throw new ConfigurationException( "Cannot set a resource resolver on " + this.getClass().getName() + ". If " + "you want to set your own resource resolver, use " + TemplateResolver.class.getName() + "instead"); } }
public static ServerWebExchange getServerWebExchange(final IContext context) { if (spring5Delegate != null) { return spring5Delegate.getServerWebExchange(context); } throw new ConfigurationException( "The authorization infrastructure could not create initializer for the specific version of Spring being" + "used. Currently only Spring 5.x or newer is supported."); }
public static boolean isWebFluxContext(final IContext context) { if (spring5Delegate != null) { return spring5Delegate.isWebFluxContext(context); } throw new ConfigurationException( "The authorization infrastructure could not create initializer for the specific version of Spring being" + "used. Currently only Spring 5.x or newer is supported."); }
public static HttpServletRequest getHttpServletRequest(final IContext context) { if (spring5Delegate != null) { return spring5Delegate.getHttpServletRequest(context); } throw new ConfigurationException( "The authorization infrastructure could not create initializer for the specific version of Spring being" + "used. Currently only Spring 5.x or newer is supported."); }
public static boolean isWebMvcContext(final IContext context) { if (spring5Delegate != null) { return spring5Delegate.isWebMvcContext(context); } throw new ConfigurationException( "The authorization infrastructure could not create initializer for the specific version of Spring being" + "used. Currently only Spring 5.x or newer is supported."); }
public static HttpServletRequest getHttpServletRequest(final IContext context) { if (spring5Delegate != null) { return spring5Delegate.getHttpServletRequest(context); } throw new ConfigurationException( "The authorization infrastructure could not create initializer for the specific version of Spring being" + "used. Currently only Spring 5.x or newer is supported."); }