public static String[] split(String line, char delimiter) { return split(line, delimiter, DEFAULT_QUOTE_CHAR); }
public static String[] split(String line, char delimiter, char quoteChar) { return split(line, delimiter, quoteChar, quoteChar); }
public static String[] split(String line, char delimiter, char beginQuoteChar, char endQuoteChar) { return split(line, delimiter, beginQuoteChar, endQuoteChar, false, true); }
public static String[] split(String line) { return split(line, DEFAULT_DELIMITER_CHAR); }
/** * Convenience method to convert a CSV string list to a set. * Note that this will suppress duplicates. * @param str the input String * @return a Set of String entries in the list */ public static Set<String> commaDelimitedListToSet(String str) { if (str == null) { return java.util.Collections.emptySet(); } Set<String> set = new LinkedHashSet<String>(); String[] tokens = split(str); java.util.Collections.addAll(set, tokens); return set; }
/** * Fix for https://github.com/stormpath/stormpath-sdk-java/issues/699 * * @since 1.2.0 */ public List<String> stormpathCorsAllowedHeaders() { if (Strings.hasText(corsAllowedOrigins)) { return Arrays.asList(Strings.split(corsAllowedHeaders)); } return java.util.Collections.emptyList(); } }
/** * Fix for https://github.com/stormpath/stormpath-sdk-java/issues/699 * * @since 1.2.0 */ public List<String> stormpathCorsAllowedHeaders() { if (Strings.hasText(corsAllowedOrigins)) { return Arrays.asList(Strings.split(corsAllowedHeaders)); } return java.util.Collections.emptyList(); } }
/** * Fix for https://github.com/stormpath/stormpath-sdk-java/issues/699 * * @since 1.2.0 */ public List<String> stormpathCorsAllowedOrigins() { if (Strings.hasText(corsAllowedOrigins)) { return Arrays.asList(Strings.split(corsAllowedOrigins)); } return java.util.Collections.emptyList(); }
/** * Fix for https://github.com/stormpath/stormpath-sdk-java/issues/699 * * @since 1.2.0 */ public List<String> stormpathCorsAllowedMethods() { if (Strings.hasText(corsAllowedOrigins)) { return Arrays.asList(Strings.split(corsAllowedMethods)); } return java.util.Collections.emptyList(); }
/** * Fix for https://github.com/stormpath/stormpath-sdk-java/issues/699 * * @since 1.2.0 */ public List<String> stormpathCorsAllowedOrigins() { if (Strings.hasText(corsAllowedOrigins)) { return Arrays.asList(Strings.split(corsAllowedOrigins)); } return java.util.Collections.emptyList(); }
/** * Fix for https://github.com/stormpath/stormpath-sdk-java/issues/699 * * @since 1.2.0 */ public List<String> stormpathCorsAllowedMethods() { if (Strings.hasText(corsAllowedOrigins)) { return Arrays.asList(Strings.split(corsAllowedMethods)); } return java.util.Collections.emptyList(); }
/** * To be used by Spring Security's built-in CORS support. * * @since 1.3.0 */ public CorsConfigurationSource corsConfigurationSource() { CorsConfiguration configuration = new CorsConfiguration(); configuration.setAllowedOrigins(Strings.split(corsAllowedOrigins) != null ? Arrays.asList(Strings.split(corsAllowedOrigins)) : Collections.<String>emptyList()); configuration.setAllowedHeaders(Strings.split(corsAllowedHeaders) != null ? Arrays.asList(Strings.split(corsAllowedHeaders)) : Collections.<String>emptyList()); configuration.setAllowedMethods(Strings.split(corsAllowedMethods) != null ? Arrays.asList(Strings.split(corsAllowedMethods)) : Collections.<String>emptyList()); configuration.setAllowCredentials(corsAllowCredentials); // fix for https://github.com/stormpath/stormpath-sdk-java/issues/1241 UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); source.registerCorsConfiguration("/**", configuration); return source; }
/** * @since 1.2.0 */ @Override public List<String> getAllowedCorsOrigins() { String allowedOrigins = get(STORMPATH_WEB_CORS_ALLOWED_ORIGINS); if(Strings.hasText(allowedOrigins)) { return Arrays.asList(Strings.split(allowedOrigins)); } return Collections.emptyList(); }
/** * @since 1.2.0 */ @Override public List<String> getAllowedCorsHaders() { String allowedHeaders = get(STORMPATH_WEB_CORS_ALLOWED_HEADERS); if(Strings.hasText(allowedHeaders)) { return Arrays.asList(Strings.split(allowedHeaders)); } return Collections.emptyList(); }
/** * @since 1.2.0 */ @Override public List<String> getAllowedCorsMethods() { String allowedMethods = get(STORMPATH_WEB_CORS_ALLOWED_METHODS); if(Strings.hasText(allowedMethods)) { return Arrays.asList(Strings.split(allowedMethods)); } return Collections.emptyList(); }
/** * @since 1.2.0 */ @Override public List<String> getAllowedCorsMethods() { String allowedMethods = get(STORMPATH_WEB_CORS_ALLOWED_METHODS); if(Strings.hasText(allowedMethods)) { return Arrays.asList(Strings.split(allowedMethods)); } return Collections.emptyList(); }
/** * @since 1.2.0 */ @Override public List<String> getAllowedCorsOrigins() { String allowedOrigins = get(STORMPATH_WEB_CORS_ALLOWED_ORIGINS); if(Strings.hasText(allowedOrigins)) { return Arrays.asList(Strings.split(allowedOrigins)); } return Collections.emptyList(); }
/** * @since 1.2.0 */ @Override public List<String> getAllowedCorsHaders() { String allowedHeaders = get(STORMPATH_WEB_CORS_ALLOWED_HEADERS); if(Strings.hasText(allowedHeaders)) { return Arrays.asList(Strings.split(allowedHeaders)); } return Collections.emptyList(); }
@Override protected RequestAuthorizer createInstance(ServletContext servletContext) throws Exception { ServerUriResolver resolver = getConfig().getInstance(SERVER_URI_RESOLVER); Resolver<Boolean> localhost = getConfig().getInstance(LOCALHOST_RESOLVER); String uris = getConfig().get(ORIGIN_URIS); String produces = getConfig().get(PRODUCES_MIME_TYPES); Collection<String> additionalOriginUris = Collections.emptyList(); if (Strings.hasText(uris)) { String[] values = Strings.split(uris); additionalOriginUris = Arrays.asList(values); } List<MediaType> producesMimeTypes = MediaType.parseMediaTypes(produces); return new OriginAccessTokenRequestAuthorizer(resolver, localhost, additionalOriginUris, producesMimeTypes); } }
@Override protected RequestAuthorizer createInstance(ServletContext servletContext) throws Exception { ServerUriResolver resolver = getConfig().getInstance(SERVER_URI_RESOLVER); Resolver<Boolean> localhost = getConfig().getInstance(LOCALHOST_RESOLVER); String uris = getConfig().get(ORIGIN_URIS); String produces = getConfig().get(PRODUCES_MIME_TYPES); Collection<String> additionalOriginUris = Collections.emptyList(); if (Strings.hasText(uris)) { String[] values = Strings.split(uris); additionalOriginUris = Arrays.asList(values); } List<MediaType> producesMimeTypes = MediaType.parseMediaTypes(produces); return new OriginAccessTokenRequestAuthorizer(resolver, localhost, additionalOriginUris, producesMimeTypes); } }