@Override public HttpHost getTarget() { return URIUtils.extractHost(requestUri); }
@Override public HttpHost getTarget() { return URIUtils.extractHost(post.getURI()); }
HttpHost httpHost = URIUtils.extractHost(URI.create(resolvedRedirect)); String sessionState = openIdSessionStateCalculator.calculate("", clientId, httpHost.toURI()); boolean implicit = stream(responseTypes).noneMatch("code"::equalsIgnoreCase);
HttpHost httpHost = URIUtils.extractHost(URI.create(requestedRedirect)); String sessionState = openIdSessionStateCalculator.calculate(((UaaPrincipal) authUser.getPrincipal()).getId(), authorizationRequest.getClientId(), httpHost.toURI());
protected void initTarget() throws ServletException { targetUri = getConfigParam(P_TARGET_URI); if (targetUri == null) throw new ServletException(P_TARGET_URI+" is required."); //test it's valid try { targetUriObj = new URI(targetUri); } catch (Exception e) { throw new ServletException("Trying to process targetUri init parameter: "+e,e); } targetHost = URIUtils.extractHost(targetUriObj); }
throw new ServletException("Rewritten targetUri is invalid: " + newTargetUri,e); servletRequest.setAttribute(ATTR_TARGET_HOST, URIUtils.extractHost(targetUriObj));
/** * Extracts the {@link HttpHost} from a URI. * * @param uri * the {@link URI} * @return the {@link HttpHost} */ public static HttpHost extractHost(final URI uri) { return URIUtils.extractHost(uri); }
HttpHost getHttpHost(final HttpUriRequest request) { final URI uri = request.getURI(); return URIUtils.extractHost(uri); }
HttpHost getHttpHost(final HttpUriRequest request) { final URI uri = request.getURI(); return URIUtils.extractHost(uri); }
private HttpHost determineTarget(HttpUriRequest request) throws IllegalStateException { HttpHost target = null; URI requestURI = request.getURI(); if (requestURI.isAbsolute()) { target = URIUtils.extractHost(requestURI); if (target == null) { throw new IllegalStateException("URI does not specify a valid host name: " + requestURI); } } return target; } public void makeInvoke(Server server, HttpUriRequest request, HTTPHandler handler){
public static ILoadBalancer getLoadBalancer(URI uri) throws Exception { HttpHost target = null; target = URIUtils.extractHost(uri); if (target == null) { throw new IllegalStateException("URI does not specify a valid host name: " + uri); } ILoadBalancer lb = getLoadBalancer(target); return lb; }
protected void initTarget() throws ServletException { targetUri = getConfigParam(P_TARGET_URI); if (targetUri == null) throw new ServletException(P_TARGET_URI+" is required."); //test it's valid try { targetUriObj = new URI(targetUri); } catch (Exception e) { throw new ServletException("Trying to process targetUri init parameter: "+e,e); } targetHost = URIUtils.extractHost(targetUriObj); }
private static HttpHost determineTarget(final HttpUriRequest request) throws ClientProtocolException { HttpHost target = null; final URI requestURI = request.getURI(); if (requestURI.isAbsolute()) { target = URIUtils.extractHost(requestURI); if (target == null) { throw new ClientProtocolException("URI does not specify a valid host name: " + requestURI); } } return target; }
/** * Extracts the {@link HttpHost} from a URI. * * @param uri * the URI * @return the {@link HttpHost} */ public static HttpHost extractHost(final String uri) { return URIUtils.extractHost(createURI(uri)); }
private static HttpHost determineTarget(final HttpUriRequest request) throws ClientProtocolException { // A null target may be acceptable if there is a default target. // Otherwise, the null target is detected in the director. HttpHost target = null; final URI requestURI = request.getURI(); if (requestURI.isAbsolute()) { target = URIUtils.extractHost(requestURI); if (target == null) { throw new ClientProtocolException("URI does not specify a valid host name: " + requestURI); } } return target; }
protected static HttpHost determineTarget(HttpUriRequest request) throws ClientProtocolException { HttpHost target = null; URI requestURI = request.getURI(); if (requestURI.isAbsolute()) { target = URIUtils.extractHost(requestURI); if (target == null) { throw new ClientProtocolException("URI does not specify a valid host name: " + requestURI); } } return target; }
public ClientAuthorizationRequest(final HttpRequest httpRequest) { this.httpRequest = httpRequest; if (httpRequest instanceof HttpUriRequest) { URI uri = ((HttpUriRequest) httpRequest).getURI(); HttpHost httpHost = URIUtils.extractHost(uri); this.host = httpHost == null ? null : httpHost.toHostString(); this.uri = uri.getPath() + (uri.getRawQuery() == null ? "" : "?".concat(uri.getRawQuery())); } else { this.uri = null; this.host = null; } }
public AbstractHtmlClientImpl(String baseUrl, String user, String password) throws URISyntaxException { this.baseUrl = new URI(baseUrl); HttpHost targetHost = URIUtils.extractHost(this.baseUrl); BasicCredentialsProvider credsProvider = new BasicCredentialsProvider(); credsProvider.setCredentials( new AuthScope(targetHost.getHostName(), targetHost.getPort()), new UsernamePasswordCredentials(user, password)); this.client = HttpClientBuilder.create() .setDefaultCredentialsProvider(credsProvider) .setRedirectStrategy(new LaxRedirectStrategy()) .build(); }
/** * Sets base path. Also set the host, based on if the path was Absolute * @param path Calendar Collection Root */ public void setCalendarCollectionRoot(String path) { URI temp = URI.create(path); if(temp.isAbsolute()) setHttpHost(URIUtils.extractHost(temp)); this.calendarCollectionRoot = UrlUtils.removeDoubleSlashes(UrlUtils.ensureTrailingSlash(temp.getPath())); }
static CloseableHttpClient auth(HttpClientBuilder clientBuilder, HttpContext context, HttpRequestBase requestBase, String username, String password) { CredentialsProvider provider = new BasicCredentialsProvider(); provider.setCredentials( new AuthScope(requestBase.getURI().getHost(), requestBase.getURI().getPort()), new org.apache.http.auth.UsernamePasswordCredentials(username, password)); clientBuilder.setDefaultCredentialsProvider(provider); AuthCache authCache = new BasicAuthCache(); authCache.put(URIUtils.extractHost(requestBase.getURI()), new BasicScheme()); context.setAttribute(HttpClientContext.AUTH_CACHE, authCache); return clientBuilder.build(); } }