public RedirectException(final Host target) { super(String.format("Redirect to %s", new HostUrlProvider().withUsername(false).get(target))); this.target = target; }
@Override public void change(final Host bookmark) { urlField.setAttributedStringValue(HyperlinkAttributedStringFactory.create(new HostUrlProvider().withUsername(false).withPath(true).get(bookmark))); } });
@Override public DescriptiveUrlBag toUrl(final Path file) { try { final DescriptiveUrlBag set = delegate.toUrl(file); final Path encrypt = vault.encrypt(session, file); set.add(new DescriptiveUrl(URI.create(String.format("%s%s", new HostUrlProvider().withUsername(false).get(session.getHost()), URIEncoder.encode(encrypt.getAbsolute()))), DescriptiveUrl.Type.encrypted, MessageFormat.format(LocaleFactory.localizedString("{0} URL"), LocaleFactory.localizedString("Encrypted", "Cryptomator"))) ); return set; } catch(BackgroundException e) { log.warn(String.format("Failure encrypting filename. %s", e.getMessage())); return DescriptiveUrlBag.empty(); } }
@Override public DAVClient connect(final Proxy proxy, final HostKeyCallback key, final LoginCallback prompt) { // Always inject new pool to builder on connect because the pool is shutdown on disconnect final HttpClientBuilder pool = builder.build(proxy, this, prompt); pool.setRedirectStrategy(new DAVRedirectStrategy(redirect)); return new DAVClient(new HostUrlProvider().withUsername(false).get(host), pool); }
@Override public DescriptiveUrlBag toUrl(final Path file) { final String nodeid = file.isDirectory() ? file.attributes().getVersionId() : file.getParent().attributes().getVersionId(); if(StringUtils.isBlank(nodeid)) { return DescriptiveUrlBag.empty(); } return new DescriptiveUrlBag(Collections.singletonList( new DescriptiveUrl(URI.create(String.format("%s/#/node/%s", new HostUrlProvider().withUsername(false).get(session.getHost()), URIEncoder.encode( nodeid ))), DescriptiveUrl.Type.http, MessageFormat.format(LocaleFactory.localizedString("{0} URL"), session.getHost().getProtocol().getScheme().toString().toUpperCase(Locale.ROOT))) )); } }
@Override public DescriptiveUrlBag toUrl(final Path file) { final DescriptiveUrlBag list = new DescriptiveUrlBag(); if(file.attributes().getLink() != null) { list.add(file.attributes().getLink()); } list.add(new DescriptiveUrl(URI.create(String.format("%s%s", new HostUrlProvider().withUsername(false).get(host), URIEncoder.encode(file.getAbsolute()))), DescriptiveUrl.Type.provider, MessageFormat.format(LocaleFactory.localizedString("{0} URL"), host.getProtocol().getScheme().toString().toUpperCase(Locale.ROOT)))); list.addAll(new WebUrlProvider(host).toUrl(file)); return list; } }
if(options.quarantine) { quarantine.setQuarantine(local, new HostUrlProvider().withUsername(false).get(session.getHost()), provider.getUrl());
dict.setObjectForKey(BookmarkNameProvider.toString(host), "Nickname"); dict.setObjectForKey(host.getHostname(), "Hostname"); dict.setObjectForKey(new HostUrlProvider().withUsername(true).withPath(true).get(host), "URL"); final String comment = this.getSource().getComment(host); if(StringUtils.isNotBlank(comment)) {
public OAuth2RequestInterceptor(final HttpClient client, final Host host) { this(client, Scheme.isURL(host.getProtocol().getOAuthTokenUrl()) ? host.getProtocol().getOAuthTokenUrl() : new HostUrlProvider().withUsername(false).withPath(true).get( host.getProtocol().getScheme(), host.getPort(), null, host.getHostname(), host.getProtocol().getOAuthTokenUrl()), Scheme.isURL(host.getProtocol().getOAuthAuthorizationUrl()) ? host.getProtocol().getOAuthAuthorizationUrl() : new HostUrlProvider().withUsername(false).withPath(true).get( host.getProtocol().getScheme(), host.getPort(), null, host.getHostname(), host.getProtocol().getOAuthAuthorizationUrl()), host.getProtocol().getOAuthClientId(), host.getProtocol().getOAuthClientSecret(), host.getProtocol().getOAuthScopes()); }
host).withRedirectUri(Scheme.isURL(host.getProtocol().getOAuthRedirectUrl()) ? host.getProtocol().getOAuthRedirectUrl() : new HostUrlProvider().withUsername(false).withPath(true).get( host.getProtocol().getScheme(), host.getPort(), null, host.getHostname(), host.getProtocol().getOAuthRedirectUrl()) ); client.setBasePath(new HostUrlProvider().withUsername(false).withPath(true).get(host.getProtocol().getScheme(), host.getPort(), null, host.getHostname(), host.getProtocol().getContext())); client.setHttpClient(ClientBuilder.newClient(new ClientConfig()