private static String[] split(final String s) { if (TextUtils.isBlank(s)) { return null; } return s.split(" *, *"); }
public String getQualifiedName() { String fullClassName; if (!TextUtils.isEmpty(packName)) { fullClassName = packName + "." + className; } else { fullClassName = className; } return fullClassName; }
/** * @since 4.1 */ protected URI createLocationURI(final String location) throws ProtocolException { try { final URIBuilder b = new URIBuilder(new URI(location).normalize()); final String host = b.getHost(); if (host != null) { b.setHost(host.toLowerCase(Locale.ROOT)); } final String path = b.getPath(); if (TextUtils.isEmpty(path)) { b.setPath("/"); } return b.build(); } catch (final URISyntaxException ex) { throw new ProtocolException("Invalid redirect URI: " + location, ex); } }
if (uri.isAbsolute()) { int port = uri.getPort(); // may be overridden later String host = uri.getHost(); if (host == null) { // normal parse failed; let's do it ourselves final String scheme = uri.getScheme(); if (!TextUtils.isBlank(host)) { target = new HttpHost(host, port, scheme);
/** * A convenience method that creates a new {@link URI} whose scheme, host, port, path, * query are taken from the existing URI, dropping any fragment or user-information. * The path is set to "/" if not explicitly specified. The existing URI is returned * unmodified if it has no fragment or user-information and has a path. * * @param uri * original URI. * @throws URISyntaxException * If the resulting URI is invalid. */ public static URI rewriteURI(final URI uri) throws URISyntaxException { Args.notNull(uri, "URI"); if (uri.isOpaque()) { return uri; } final URIBuilder uribuilder = new URIBuilder(uri); if (uribuilder.getUserInfo() != null) { uribuilder.setUserInfo(null); } if (TextUtils.isEmpty(uribuilder.getPath())) { uribuilder.setPath("/"); } if (uribuilder.getHost() != null) { uribuilder.setHost(uribuilder.getHost().toLowerCase(Locale.ROOT)); } uribuilder.setFragment(null); return uribuilder.build(); }
static DeviceLinkInfo parseDeviceLinkUri(URI linkUri) throws IOException, InvalidKeyException { Map<String, String> query = getQueryMap(linkUri.getRawQuery()); String deviceIdentifier = query.get("uuid"); String publicKeyEncoded = query.get("pub_key"); if (TextUtils.isEmpty(deviceIdentifier) || TextUtils.isEmpty(publicKeyEncoded)) { throw new RuntimeException("Invalid device link uri"); } ECPublicKey deviceKey = Curve.decodePoint(Base64.decode(publicKeyEncoded), 0); return new DeviceLinkInfo(deviceIdentifier, deviceKey); }
public CookieOrigin(final String host, final int port, final String path, final boolean secure) { super(); Args.notBlank(host, "Host"); Args.notNegative(port, "Port"); Args.notNull(path, "Path"); this.host = host.toLowerCase(Locale.ROOT); this.port = port; if (!TextUtils.isBlank(path)) { this.path = path; } else { this.path = "/"; } this.secure = secure; }
public static <T extends CharSequence> T containsNoBlanks(final T argument, final String name) { if (argument == null) { throw new IllegalArgumentException(name + " may not be null"); } if (TextUtils.containsBlanks(argument)) { throw new IllegalArgumentException(name + " may not contain blanks"); } return argument; }
/** * @since 4.1 */ protected URI createLocationURI(final String location) throws ProtocolException { try { final URIBuilder b = new URIBuilder(new URI(location).normalize()); final String host = b.getHost(); if (host != null) { b.setHost(host.toLowerCase(Locale.ENGLISH)); } final String path = b.getPath(); if (TextUtils.isEmpty(path)) { b.setPath("/"); } return b.build(); } catch (final URISyntaxException ex) { throw new ProtocolException("Invalid redirect URI: " + location, ex); } }
if (uri.isAbsolute()) { int port = uri.getPort(); // may be overridden later String host = uri.getHost(); if (host == null) { // normal parse failed; let's do it ourselves final String scheme = uri.getScheme(); if (!TextUtils.isBlank(host)) { try { target = new HttpHost(host, port, scheme);
/** * A convenience method that creates a new {@link URI} whose scheme, host, port, path, * query are taken from the existing URI, dropping any fragment or user-information. * The path is set to "/" if not explicitly specified. The existing URI is returned * unmodified if it has no fragment or user-information and has a path. * * @param uri * original URI. * @throws URISyntaxException * If the resulting URI is invalid. */ public static URI rewriteURI(final URI uri) throws URISyntaxException { Args.notNull(uri, "URI"); if (uri.isOpaque()) { return uri; } final URIBuilder uribuilder = new URIBuilder(uri); if (uribuilder.getUserInfo() != null) { uribuilder.setUserInfo(null); } if (TextUtils.isEmpty(uribuilder.getPath())) { uribuilder.setPath("/"); } if (uribuilder.getHost() != null) { uribuilder.setHost(uribuilder.getHost().toLowerCase(Locale.ROOT)); } uribuilder.setFragment(null); return uribuilder.build(); }
public CookieOrigin(final String host, final int port, final String path, final boolean secure) { super(); Args.notBlank(host, "Host"); Args.notNegative(port, "Port"); Args.notNull(path, "Path"); this.host = host.toLowerCase(Locale.ROOT); this.port = port; if (!TextUtils.isBlank(path)) { this.path = path; } else { this.path = "/"; } this.secure = secure; }
public static <T extends CharSequence> T containsNoBlanks(final T argument, final String name) { if (argument == null) { throw new IllegalArgumentException(name + " may not be null"); } if (TextUtils.containsBlanks(argument)) { throw new IllegalArgumentException(name + " may not contain blanks"); } return argument; }
/** * @since 4.1 */ protected URI createLocationURI(final String location) throws ProtocolException { try { final URIBuilder b = new URIBuilder(new URI(location).normalize()); final String host = b.getHost(); if (host != null) { b.setHost(host.toLowerCase(Locale.ROOT)); } final String path = b.getPath(); if (TextUtils.isEmpty(path)) { b.setPath("/"); } return b.build(); } catch (final URISyntaxException ex) { throw new ProtocolException("Invalid redirect URI: " + location, ex); } }
if (uri.isAbsolute()) { int port = uri.getPort(); // may be overridden later String host = uri.getHost(); if (host == null) { // normal parse failed; let's do it ourselves final String scheme = uri.getScheme(); if (!TextUtils.isBlank(host)) { target = new HttpHost(host, port, scheme);
/** * A convenience method that creates a new {@link URI} whose scheme, host, port, path, * query are taken from the existing URI, dropping any fragment or user-information. * The path is set to "/" if not explicitly specified. The existing URI is returned * unmodified if it has no fragment or user-information and has a path. * * @param uri * original URI. * @throws URISyntaxException * If the resulting URI is invalid. */ public static URI rewriteURI(final URI uri) throws URISyntaxException { Args.notNull(uri, "URI"); if (uri.isOpaque()) { return uri; } final URIBuilder uribuilder = new URIBuilder(uri); if (uribuilder.getUserInfo() != null) { uribuilder.setUserInfo(null); } if (TextUtils.isEmpty(uribuilder.getPath())) { uribuilder.setPath("/"); } if (uribuilder.getHost() != null) { uribuilder.setHost(uribuilder.getHost().toLowerCase(Locale.ROOT)); } uribuilder.setFragment(null); return uribuilder.build(); }
public CookieOrigin(final String host, final int port, final String path, final boolean secure) { super(); Args.notBlank(host, "Host"); Args.notNegative(port, "Port"); Args.notNull(path, "Path"); this.host = host.toLowerCase(Locale.ROOT); this.port = port; if (!TextUtils.isBlank(path)) { this.path = path; } else { this.path = "/"; } this.secure = secure; }