List of usage examples for io.netty.util DomainNameMapping map
Map map
To view the source code for io.netty.util DomainNameMapping map.
Click Source Link
From source file:com.linecorp.armeria.server.VirtualHost.java
License:Apache License
/** * Ensure that 'hostnamePattern' matches 'defaultHostname'. *//*from ww w . j av a2s . c o m*/ static void ensureHostnamePatternMatchesDefaultHostname(String hostnamePattern, String defaultHostname) { if ("*".equals(hostnamePattern)) { return; } // Pretty convoluted way to validate but it's done only once and // we don't need to duplicate the pattern matching logic. final DomainNameMapping<Boolean> mapping = new DomainNameMappingBuilder<>(Boolean.FALSE) .add(hostnamePattern, Boolean.TRUE).build(); if (!mapping.map(defaultHostname)) { throw new IllegalArgumentException("defaultHostname: " + defaultHostname + " (must be matched by hostnamePattern: " + hostnamePattern + ')'); } }