private URI getBaseUri(final Request request) { try { final String hostHeader = request.getValue("Host"); if (hostHeader != null) { final String scheme = request.isSecure() ? "https" : "http"; return new URI(scheme + "://" + hostHeader + "/"); } else { final Address address = request.getAddress(); return new URI(address.getScheme(), null, address.getDomain(), address.getPort(), "/", null, null); } } catch (final URISyntaxException ex) { throw new IllegalArgumentException(ex); } }
private URI getBaseUri(Request request) { try { final Address address = request.getAddress(); return new URI( address.getScheme(), null, address.getDomain(), address.getPort(), "/", null, null); } catch (URISyntaxException ex) { throw new IllegalArgumentException(ex); } }
private URI getBaseUri(final Request request) { try { final String hostHeader = request.getValue("Host"); if (hostHeader != null) { final String scheme = request.isSecure() ? "https" : "http"; return new URI(scheme + "://" + hostHeader + "/"); } else { final Address address = request.getAddress(); return new URI(address.getScheme(), null, address.getDomain(), address.getPort(), "/", null, null); } } catch (final URISyntaxException ex) { throw new IllegalArgumentException(ex); } }