1 /* 2 * ==================================================================== 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * ==================================================================== 20 * 21 * This software consists of voluntary contributions made by many 22 * individuals on behalf of the Apache Software Foundation. For more 23 * information on the Apache Software Foundation, please see 24 * <http://www.apache.org/>. 25 * 26 */ 27 package org.apache.hc.client5.http.impl.cache; 28 29 import java.net.URI; 30 import java.net.URISyntaxException; 31 32 import org.apache.hc.core5.http.HttpHost; 33 import org.apache.hc.core5.http.HttpRequest; 34 35 /** 36 * HTTP cache support utilities. 37 * 38 * @since 5.0 39 * 40 * @deprecated Do not use. This functionality is internal. 41 */ 42 @Deprecated 43 public final class HttpCacheSupport { 44 45 public static String getRequestUri(final HttpRequest request, final HttpHost target) { 46 return CacheKeyGenerator.getRequestUri(target, request); 47 } 48 49 public static URI normalize(final URI requestUri) throws URISyntaxException { 50 return CacheKeyGenerator.normalize(requestUri); 51 } 52 53 /** 54 * Lenient URI parser that normalizes valid {@link URI}s and returns {@code null} for malformed URIs. 55 * @deprecated Use {@link #normalizeQuietly(String)} 56 */ 57 @Deprecated 58 public static URI normalizeQuetly(final String requestUri) { 59 if (requestUri == null) { 60 return null; 61 } 62 try { 63 return normalize(new URI(requestUri)); 64 } catch (final URISyntaxException ex) { 65 return null; 66 } 67 } 68 69 /** 70 * Lenient URI parser that normalizes valid {@link URI}s and returns {@code null} for malformed URIs. 71 * @since 5.2 72 */ 73 public static URI normalizeQuietly(final String requestUri) { 74 return CacheKeyGenerator.normalize(requestUri); 75 } 76 77 }