List of usage examples for org.springframework.util Assert hasLength
public static void hasLength(@Nullable String text, Supplier<String> messageSupplier)
From source file:org.acegisecurity.ui.AbstractProcessingFilter.java
public void afterPropertiesSet() throws Exception { Assert.hasLength(filterProcessesUrl, "filterProcessesUrl must be specified"); Assert.hasLength(defaultTargetUrl, "defaultTargetUrl must be specified"); Assert.hasLength(authenticationFailureUrl, "authenticationFailureUrl must be specified"); Assert.notNull(authenticationManager, "authenticationManager must be specified"); Assert.notNull(this.rememberMeServices); }
From source file:org.acegisecurity.ui.switchuser.SwitchUserProcessingFilter.java
public void afterPropertiesSet() throws Exception { Assert.hasLength(switchUserUrl, "switchUserUrl must be specified"); Assert.hasLength(exitUserUrl, "exitUserUrl must be specified"); Assert.hasLength(targetUrl, "targetUrl must be specified"); Assert.notNull(userDetailsService, "authenticationDao must be specified"); Assert.notNull(messages, "A message source must be set"); }
From source file:org.acegisecurity.ui.webapp.AuthenticationProcessingFilterEntryPoint.java
public void afterPropertiesSet() throws Exception { Assert.hasLength(loginFormUrl, "loginFormUrl must be specified"); Assert.notNull(portMapper, "portMapper must be specified"); Assert.notNull(portResolver, "portResolver must be specified"); }
From source file:org.acegisecurity.util.EncryptionUtils.java
/** * Converts a String into a byte array using UTF-8, falling back to the * platform's default character set if UTF-8 fails. * * @param input the input (required)// w w w.java2 s. c o m * @return a byte array representation of the input string */ public static byte[] stringToByteArray(String input) { Assert.hasLength(input, "Input required"); try { return input.getBytes("UTF-8"); } catch (UnsupportedEncodingException fallbackToDefault) { return input.getBytes(); } }
From source file:org.codehaus.groovy.grails.validation.AbstractConstraint.java
protected void checkState() { Assert.hasLength(constraintPropertyName, "Property 'propertyName' must be set on the constraint"); Assert.notNull(constraintOwningClass, "Property 'owningClass' must be set on the constraint"); Assert.notNull(constraintParameter, "Property 'constraintParameter' must be set on the constraint"); }
From source file:org.codehaus.groovy.grails.web.mapping.DefaultUrlMappingData.java
public DefaultUrlMappingData(String urlPattern) { Assert.hasLength(urlPattern, "Argument [urlPattern] cannot be null or blank"); Assert.isTrue(urlPattern.startsWith(SLASH), "Argument [urlPattern] is not a valid URL. It must start with '/' !"); String configuredPattern = configureUrlPattern(urlPattern); this.urlPattern = configuredPattern; tokens = tokenizeUrlPattern(configuredPattern); List<String> urls = new ArrayList<String>(); parseUrls(urls, tokens, optionalTokens); logicalUrls = urls.toArray(new String[urls.size()]); }
From source file:org.codehaus.groovy.grails.web.mapping.DefaultUrlMappingData.java
@Override public UrlMappingData createRelative(String path) { Assert.hasLength(path, "Argument [path] cannot be null or blank"); String newPattern = this.urlPattern + configureUrlPattern(path); String[] tokens = tokenizeUrlPattern(newPattern); List<String> urls = new ArrayList<String>(); List<Boolean> optionalTokens = new ArrayList<Boolean>(); parseUrls(urls, tokens, optionalTokens); String[] logicalUrls = urls.toArray(new String[urls.size()]); return new DefaultUrlMappingData(newPattern, logicalUrls, tokens, optionalTokens); }
From source file:org.codehaus.groovy.grails.web.pages.GroovyPageResourceLoader.java
@Override public Resource getResource(String location) { Assert.hasLength(location, "Argument [location] cannot be null or blank"); // deal with plug-in resolving if (location.startsWith(PLUGINS_PATH)) { Assert.state(pluginSettings != null, "'pluginsettings' has not been initialised."); List<String> pluginBaseDirectories = pluginSettings.getPluginBaseDirectories(); DefaultGroovyPageLocator.PluginViewPathInfo pluginViewPathInfo = DefaultGroovyPageLocator .getPluginViewPathInfo(location); String path = pluginViewPathInfo.basePath; String pluginName = pluginViewPathInfo.pluginName; String pathRelativeToPlugin = pluginViewPathInfo.path; for (String pluginBaseDirectory : pluginBaseDirectories) { String pathToResource = pluginBaseDirectory + File.separatorChar + path; Resource r = super.getResource("file:" + pathToResource); if (r.exists()) { return r; }// w w w . ja va 2 s . co m pathToResource = buildPluginViewPath(pluginBaseDirectory, pluginName, pathRelativeToPlugin); r = super.getResource(pathToResource); if (r.exists()) return r; } Resource r = findInInlinePlugin(pluginName, pathRelativeToPlugin); if (r != null && r.exists()) { return r; } } Resource resource = super.getResource(location); if (LOG.isDebugEnabled()) { LOG.debug("Resolved GSP location [" + location + "] to resource [" + resource + "] (exists? [" + resource.exists() + "]) using base resource [" + localBaseResource + "]"); } return resource; }
From source file:org.codehaus.groovy.grails.web.pages.GroovyPagesTemplateEngine.java
/** * Creates a Template using the given text for the Template and the given name. The name * of the template is required//from www.jav a 2s . c om * * @param txt The URI of the page to create the template for * @param pageName The name of the page being parsed * * @return The Template instance * @throws CompilationFailedException * @throws IOException Thrown if an IO exception occurs creating the Template */ public Template createTemplate(String txt, String pageName) throws IOException { Assert.hasLength(txt, "Argument [txt] cannot be null or blank"); Assert.hasLength(pageName, "Argument [pageName] cannot be null or blank"); return createTemplate(new ByteArrayResource(txt.getBytes("UTF-8"), pageName), pageName); }
From source file:org.emonocot.job.io.StaxEventItemReader.java
/** * Ensure that all required dependencies for the ItemReader to run are * provided after all properties have been set. * * @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet() * @throws Exception//from w w w .j a v a2s . co m * if there is a problem */ public final void afterPropertiesSet() throws Exception { Assert.notNull(unmarshaller, "The Unmarshaller must not be null."); Assert.hasLength(fragmentRootElementName, "The FragmentRootElementName must not be null"); if (fragmentRootElementName.contains("{")) { fragmentRootElementNameSpace = fragmentRootElementName.replaceAll("\\{(.*)\\}.*", "$1"); fragmentRootElementName = fragmentRootElementName.replaceAll("\\{.*\\}(.*)", "$1"); } }