uriBuilder.append(this.uri.getScheme()).append(':'); if (this.uri.getRawUserInfo() != null || this.uri.getHost() != null) { uriBuilder.append("//"); if (this.uri.getRawUserInfo() != null) { uriBuilder.append(this.uri.getRawUserInfo()).append('@');
if (uri.getRawUserInfo() != null) { this.userInfo = uri.getRawUserInfo();
uriBuilder.append(this.uri.getScheme()).append(':'); if (this.uri.getRawUserInfo() != null || this.uri.getHost() != null) { uriBuilder.append("//"); if (this.uri.getRawUserInfo() != null) { uriBuilder.append(this.uri.getRawUserInfo()).append('@');
if (uri.getRawUserInfo() == null && uri.getHost() == null && uri.getPort() == -1) { authority = uri.getRawAuthority(); userInfo = null; } else { authority = null; if (uri.getRawUserInfo() != null) userInfo = uri.getRawUserInfo(); if (uri.getHost() != null) host = uri.getHost(); if (uri.getPort() != -1) port = uri.getPort();
if (uri.getRawUserInfo() == null && uri.getHost() == null && uri.getPort() == -1) { authority = uri.getRawAuthority(); userInfo = null; } else { authority = null; if (uri.getRawUserInfo() != null) { userInfo = uri.getRawUserInfo();
if (uri.getRawUserInfo() == null && uri.getHost() == null && uri.getPort() == -1) { authority = uri.getRawAuthority(); userInfo = null; } else { authority = null; if (uri.getRawUserInfo() != null) { userInfo = uri.getRawUserInfo();
if (uri.getRawUserInfo() == null && uri.getHost() == null && uri.getPort() == -1) { authority = uri.getRawAuthority(); userInfo = null; } else { authority = null; userInfo = uri.getRawUserInfo(); host = uri.getHost(); port = uri.getPort();
if (uri.getRawUserInfo() != null) { this.userInfo = uri.getRawUserInfo();
/** * Constructor to create from a URI. * @param uri The URI */ @SuppressWarnings("unchecked") DefaultUriBuilder(URI uri) { this.scheme = uri.getScheme(); this.userInfo = uri.getRawUserInfo(); this.authority = uri.getRawAuthority(); this.host = uri.getHost(); this.port = uri.getPort(); this.path = new StringBuilder(); final String rawPath = uri.getRawPath(); if (rawPath != null) { this.path.append(rawPath); } this.fragment = uri.getRawFragment(); final String query = uri.getQuery(); if (query != null) { final Map parameters = new QueryStringDecoder(uri).parameters(); this.queryParams = new MutableConvertibleMultiValuesMap<String>(parameters); } else { this.queryParams = new MutableConvertibleMultiValuesMap<>(); } }
private static boolean isMalformedRequest(Http2Headers headers) { if (headers.method() == null) { return true; } String method = headers.method().toString(); if (method.equals("CONNECT")) { if (headers.scheme() != null || headers.path() != null || headers.authority() == null) { return true; } } else { if (headers.method() == null || headers.scheme() == null || headers.path() == null) { return true; } } if (headers.authority() != null) { URI uri; try { uri = new URI(null, headers.authority().toString(), null, null, null); } catch (URISyntaxException e) { return true; } if (uri.getRawUserInfo() != null) { return true; } } return false; }
@Override public UriBuilder schemeSpecificPart(String ssp) throws IllegalArgumentException { if (ssp == null) throw new IllegalArgumentException(Messages.MESSAGES.schemeSpecificPartNull()); StringBuilder sb = new StringBuilder(); if (scheme != null) sb.append(scheme).append(':'); if (ssp != null) sb.append(ssp); if (fragment != null && fragment.length() > 0) sb.append('#').append(fragment); URI uri = URI.create(sb.toString()); if (uri.getRawSchemeSpecificPart() != null && uri.getRawPath() == null) { this.ssp = uri.getRawSchemeSpecificPart(); } else { this.ssp = null; userInfo = uri.getRawUserInfo(); host = uri.getHost(); port = uri.getPort(); path = uri.getRawPath(); query = uri.getRawQuery(); } return this; }
if (uri.getRawUserInfo() == null && uri.getHost() == null && uri.getPort() == -1) { authority = uri.getRawAuthority(); userInfo = null; } else { authority = null; if (uri.getRawUserInfo() != null) { userInfo = uri.getRawUserInfo();
private static boolean isMalformedRequest(Http2Headers headers) { if (headers.method() == null) { return true; } String method = headers.method().toString(); if (method.equals("CONNECT")) { if (headers.scheme() != null || headers.path() != null || headers.authority() == null) { return true; } } else { if (headers.method() == null || headers.scheme() == null || headers.path() == null) { return true; } } if (headers.authority() != null) { URI uri; try { uri = new URI(null, headers.authority().toString(), null, null, null); } catch (URISyntaxException e) { return true; } if (uri.getRawUserInfo() != null) { return true; } } return false; }
if(requestURI.getRawUserInfo() != null || requestURI.getRawFragment() != null) {
public static String extractUserNameFromUri(URI uri) { if (uri.getRawUserInfo() == null) { return null; } List<String> userInfoParts = splitUserInfo(uri); if (userInfoParts.isEmpty()) { return null; } return userInfoParts.get(0); }
/** * Determines the canonical root URI of a URI. * @param uri The URI to examine. * @return A URI representing the URI with no path and no query or fragment. */ public static URI getRootURI(final URI uri) { return createURI(uri.getScheme(), uri.getRawUserInfo(), uri.getHost(), uri.getPort(), (URIPath)null, null, null); }
/** * Creates a new URI identical to the supplied URI with no query or fragment. * @param uri The URI from which to remove the query and fragment, if any. * @return A new URI with no query or fragment. */ public static URI getPlainURI(final URI uri) { return createURI(uri.getScheme(), uri.getRawUserInfo(), uri.getHost(), uri.getPort(), uri.getRawPath(), null, null); //construct an identical URI except with no query or fragment }
public final URI appendQuery(final URI base) throws URISyntaxException { return new URI(base.getScheme(), base.getRawUserInfo(), base.getHost(), base.getPort(), base.getRawPath(), appendQuery(base.getRawQuery()), base.getRawFragment()); }
/** * Creates a new URI identical to the supplied URI with a different scheme. * @param uri The URI to change. * @param newScheme The new scheme information. * @return A new URI with the new scheme information. * @throws NullPointerException if the given URI and/or new scheme is <code>null</code>. * @throws IllegalArgumentException if the given URI has no scheme or if the given scheme results in an invalid URI. */ public static URI changeScheme(final URI uri, final String newScheme) { return createURI(requireNonNull(newScheme, "Scheme cannot be null."), uri.getRawUserInfo(), uri.getHost(), uri.getPort(), uri.getRawPath(), uri.getRawQuery(), uri.getRawFragment()); //construct an identical URI except with a different scheme }
private void assertConnectorPropertiesMatchUri(ConnectionFactory connector, String uriString) throws Exception { assertNotNull(connector); URI uri = new URI(uriString); assertEquals(uri.getHost(), connector.getHost()); assertEquals(uri.getPort(), connector.getPort()); com.rabbitmq.client.ConnectionFactory rabbitConnectionFactory = (com.rabbitmq.client.ConnectionFactory) ReflectionTestUtils.getField(connector, "rabbitConnectionFactory"); String[] userInfo = uri.getRawUserInfo().split(":"); assertEquals(userInfo[0], rabbitConnectionFactory.getUsername()); assertEquals(userInfo[1], rabbitConnectionFactory.getPassword()); assertTrue(uri.getPath().endsWith(connector.getVirtualHost())); }