@Test public void normalizePath() throws Throwable { String nr = UriUtils.normalizeUriPath("/foo/"); assertEquals("/foo", nr); nr = UriUtils.normalizeUriPath("/foo"); assertEquals("/foo", nr); nr = UriUtils.normalizeUriPath(""); assertEquals("", nr); }
public static String normalizeUriPath(String path) { if (path == null) { return ""; } if (path.isEmpty()) { return path; } if (path.endsWith(URI_PATH_CHAR)) { path = path.substring(0, path.length() - 1); } if (path.startsWith(URI_PATH_CHAR)) { return path; } return URI_PATH_CHAR + path; }
UriUtils { public static String normalizeUriPath(String path) { if (path == null) { return ""; } if (path.isEmpty()) { return path; } if (path.endsWith(URI_PATH_CHAR)) { path = path.substring(0, path.length() - 1); } if (path.startsWith(URI_PATH_CHAR)) { return path; } return URI_PATH_CHAR + path; } }
UriUtils { public static String normalizeUriPath(String path) { if (path == null) { return ""; } if (path.isEmpty()) { return path; } if (path.endsWith(URI_PATH_CHAR)) { path = path.substring(0, path.length() - 1); } if (path.startsWith(URI_PATH_CHAR)) { return path; } return URI_PATH_CHAR + path; } private  UriUtils(); }
UriUtils { public static String normalizeUriPath(String path) { if (path == null) { return ""; } if (path.isEmpty()) { return path; } if (path.endsWith(URI_PATH_CHAR)) { path = path.substring(0, path.length() - 1); } if (path.startsWith(URI_PATH_CHAR)) { return path; } return URI_PATH_CHAR + path; } private  UriUtils(); static String getParentPath(String path); static boolean isChildPath(String path, String parentPath); static URI buildSubscriptionUri(ServiceHost host, String path); static URI buildSubscriptionUri(URI serviceUri); static URI buildStatsUri(ServiceHost host, String path); static URI buildStatsUri(URI serviceUri); static URI buildConfigUri(ServiceHost host, String path); static URI buildConfigUri(URI serviceUri); static URI buildAvailableUri(ServiceHost host, String path); static URI buildAvailableUri(URI serviceUri); static URI extendUri(URI uri, String path); static URI buildUri(String host, int port, String path, String query); static URI buildUri(ServiceHost host, String path); static URI buildUri(ServiceHost host, String path, String query, String userInfo); static URI buildUri(ServiceHost host, String path, String query); static URI buildServiceUri(String scheme, String host, int port, String path,
            String query,
            String userInfo); static URI buildUri(String scheme, String host, int port, String path, String query,
            String userInfo); static URI buildUri(String scheme, String host, int port, String path, String query); static String normalizeUriPath(String path); static String buildUriPath(String... segments); static String buildUriQuery(String... keyValues); static URI buildUri(ServiceHost host, Class<? extends Service> type); static URI buildFactoryUri(ServiceHost host, Class<? extends Service> type); static URI buildUri(URI baseUri, String... path); static URI buildUri(String uri); static URI extendUriWithQuery(URI u, String... keyValues); static URI buildDocumentQueryUri(ServiceHost host,
            String selfLink,
            boolean doExpand,
            boolean includeDeleted,
            EnumSet<ServiceOption> serviceCaps); static URI buildDocumentQueryUri(ServiceHost host,
            String indexServicePath,
            String selfLink,
            boolean doExpand,
            boolean includeDeleted,
            EnumSet<ServiceOption> serviceCaps); static URI buildDocumentQueryUri(ServiceHost host,
            String selfLink,
            boolean doExpand,
            boolean includeDeleted,
            ServiceOption cap); static URI buildDocumentQueryUri(ServiceHost host,
            String indexServicePath,
            String selfLink,
            boolean doExpand,
            boolean includeDeleted,
            ServiceOption cap); static URI buildDefaultDocumentQueryUri(URI hostUri,
            String selfLink,
            boolean doExpand,
            boolean includeDeleted,
            ServiceOption cap); static URI buildIndexQueryUri(URI indexURI,
            String selfLink,
            boolean doExpand,
            boolean includeDeleted,
            ServiceOption cap); static URI buildIndexQueryUri(URI indexURI,
            String selfLink,
            Long version,
            boolean doExpand,
            boolean includeDeleted,
            ServiceOption cap); static URI appendQueryParam(URI uri, String param, String value); static Map<String, String> parseUriQueryParams(URI uri); static Map<String, String> parseUriQueryParams(String query); static Map<String, String> parseUriPathSegments(URI uri, String templatePath); static URI buildExpandLinksQueryUri(URI factoryServiceUri); static URI buildSelectFieldsQueryUri(URI factoryServiceUri, List<String> fields); static boolean isHostEqual(ServiceHost host, URI remoteService); static String buildPathWithVersion(String link, Long latestVersion); static URI buildPublicUri(ServiceHost host, String... path); static URI buildPublicUri(ServiceHost host, String path, String query); static URI buildSafeUri(String scheme,
            String userInfo, String host, int port,
            String path, String query, String fragment); static URI buildSafeUri(String uri); static URI buildForwardRequestUri(URI targetService, String key, String selectorPath); static URI buildForwardToPeerUri(URI targetService, String peerId, String selectorPath,
            EnumSet<ServiceOption> caps); static URI buildForwardToQueryPageUri(URI targetService, String peerId); static URI buildBroadcastRequestUri(URI targetService, String selectorPath); static URI buildBroadcastRequestUri(URI targetService,
            String selectorPath, String selectionKey); static URI updateUriPort(URI uri, int newPort); static String getPathParamValue(URI uri); static String getPeerParamValue(URI uri); static boolean hasNavigationQueryParams(URI uri); static boolean hasODataQueryParams(URI uri); static Integer getODataSkipParamValue(URI uri); static String getODataFilterParamValue(URI uri); static Integer getODataTopParamValue(URI uri); static boolean getODataCountParamValue(URI uri); static Integer getODataLimitParamValue(URI uri); static String extendQueryPageLinkWithQuery(String pageLink, String queryKeyValues); static String getODataSkipToParamValue(URI uri); static String getODataNodeParamValue(URI uri); static String getODataTenantLinksParamValue(URI uri); static String getODataSelectFieldsParamValue(URI uri); static Integer getODataParamValue(final URI uri, final String uriParamOdataType); static String getODataParamValueAsString(final URI uri, final String uriParamOdataType); static ODataOrderByTuple getODataOrderByParamValue(URI uri); static String convertPathCharsFromLink(String path); static String trimPathSlashes(String path); static boolean hasODataExpandParamValue(URI uri); static String getLastPathSegment(URI uri); static String getLastPathSegment(String link); static int findAvailablePort(); }
UriUtils { public static String normalizeUriPath(String path) { if (path == null) { return ""; } if (path.isEmpty()) { return path; } if (path.endsWith(URI_PATH_CHAR)) { path = path.substring(0, path.length() - 1); } if (path.startsWith(URI_PATH_CHAR)) { return path; } return URI_PATH_CHAR + path; } private  UriUtils(); static String getParentPath(String path); static boolean isChildPath(String path, String parentPath); static URI buildSubscriptionUri(ServiceHost host, String path); static URI buildSubscriptionUri(URI serviceUri); static URI buildStatsUri(ServiceHost host, String path); static URI buildStatsUri(URI serviceUri); static URI buildConfigUri(ServiceHost host, String path); static URI buildConfigUri(URI serviceUri); static URI buildAvailableUri(ServiceHost host, String path); static URI buildAvailableUri(URI serviceUri); static URI extendUri(URI uri, String path); static URI buildUri(String host, int port, String path, String query); static URI buildUri(ServiceHost host, String path); static URI buildUri(ServiceHost host, String path, String query, String userInfo); static URI buildUri(ServiceHost host, String path, String query); static URI buildServiceUri(String scheme, String host, int port, String path,
            String query,
            String userInfo); static URI buildUri(String scheme, String host, int port, String path, String query,
            String userInfo); static URI buildUri(String scheme, String host, int port, String path, String query); static String normalizeUriPath(String path); static String buildUriPath(String... segments); static String buildUriQuery(String... keyValues); static URI buildUri(ServiceHost host, Class<? extends Service> type); static URI buildFactoryUri(ServiceHost host, Class<? extends Service> type); static URI buildUri(URI baseUri, String... path); static URI buildUri(String uri); static URI extendUriWithQuery(URI u, String... keyValues); static URI buildDocumentQueryUri(ServiceHost host,
            String selfLink,
            boolean doExpand,
            boolean includeDeleted,
            EnumSet<ServiceOption> serviceCaps); static URI buildDocumentQueryUri(ServiceHost host,
            String indexServicePath,
            String selfLink,
            boolean doExpand,
            boolean includeDeleted,
            EnumSet<ServiceOption> serviceCaps); static URI buildDocumentQueryUri(ServiceHost host,
            String selfLink,
            boolean doExpand,
            boolean includeDeleted,
            ServiceOption cap); static URI buildDocumentQueryUri(ServiceHost host,
            String indexServicePath,
            String selfLink,
            boolean doExpand,
            boolean includeDeleted,
            ServiceOption cap); static URI buildDefaultDocumentQueryUri(URI hostUri,
            String selfLink,
            boolean doExpand,
            boolean includeDeleted,
            ServiceOption cap); static URI buildIndexQueryUri(URI indexURI,
            String selfLink,
            boolean doExpand,
            boolean includeDeleted,
            ServiceOption cap); static URI buildIndexQueryUri(URI indexURI,
            String selfLink,
            Long version,
            boolean doExpand,
            boolean includeDeleted,
            ServiceOption cap); static URI appendQueryParam(URI uri, String param, String value); static Map<String, String> parseUriQueryParams(URI uri); static Map<String, String> parseUriQueryParams(String query); static Map<String, String> parseUriPathSegments(URI uri, String templatePath); static URI buildExpandLinksQueryUri(URI factoryServiceUri); static URI buildSelectFieldsQueryUri(URI factoryServiceUri, List<String> fields); static boolean isHostEqual(ServiceHost host, URI remoteService); static String buildPathWithVersion(String link, Long latestVersion); static URI buildPublicUri(ServiceHost host, String... path); static URI buildPublicUri(ServiceHost host, String path, String query); static URI buildSafeUri(String scheme,
            String userInfo, String host, int port,
            String path, String query, String fragment); static URI buildSafeUri(String uri); static URI buildForwardRequestUri(URI targetService, String key, String selectorPath); static URI buildForwardToPeerUri(URI targetService, String peerId, String selectorPath,
            EnumSet<ServiceOption> caps); static URI buildForwardToQueryPageUri(URI targetService, String peerId); static URI buildBroadcastRequestUri(URI targetService, String selectorPath); static URI buildBroadcastRequestUri(URI targetService,
            String selectorPath, String selectionKey); static URI updateUriPort(URI uri, int newPort); static String getPathParamValue(URI uri); static String getPeerParamValue(URI uri); static boolean hasNavigationQueryParams(URI uri); static boolean hasODataQueryParams(URI uri); static Integer getODataSkipParamValue(URI uri); static String getODataFilterParamValue(URI uri); static Integer getODataTopParamValue(URI uri); static boolean getODataCountParamValue(URI uri); static Integer getODataLimitParamValue(URI uri); static String extendQueryPageLinkWithQuery(String pageLink, String queryKeyValues); static String getODataSkipToParamValue(URI uri); static String getODataNodeParamValue(URI uri); static String getODataTenantLinksParamValue(URI uri); static String getODataSelectFieldsParamValue(URI uri); static Integer getODataParamValue(final URI uri, final String uriParamOdataType); static String getODataParamValueAsString(final URI uri, final String uriParamOdataType); static ODataOrderByTuple getODataOrderByParamValue(URI uri); static String convertPathCharsFromLink(String path); static String trimPathSlashes(String path); static boolean hasODataExpandParamValue(URI uri); static String getLastPathSegment(URI uri); static String getLastPathSegment(String link); static int findAvailablePort(); static final String FORWARDING_URI_PARAM_NAME_QUERY; static final String FORWARDING_URI_PARAM_NAME_TARGET; static final String FORWARDING_URI_PARAM_NAME_PATH; static final String FORWARDING_URI_PARAM_NAME_KEY; static final String FORWARDING_URI_PARAM_NAME_PEER; static final String URI_PARAM_ODATA_EXPAND; static final String URI_PARAM_ODATA_EXPAND_NO_DOLLAR_SIGN; static final String URI_PARAM_ODATA_FILTER; static final String URI_PARAM_ODATA_SKIP; static final String URI_PARAM_ODATA_ORDER_BY; static final String URI_PARAM_ODATA_ORDER_BY_TYPE; static final String URI_PARAM_ODATA_ORDER_BY_VALUE_ASC; static final String URI_PARAM_ODATA_ORDER_BY_VALUE_DESC; static final String URI_PARAM_ODATA_TOP; static final String URI_PARAM_ODATA_LIMIT; static final String URI_PARAM_ODATA_COUNT; static final String URI_PARAM_ODATA_SKIP_TO; static final String URI_PARAM_ODATA_NODE; static final String URI_PARAM_ODATA_TENANTLINKS; static final String URI_PARAM_ODATA_SELECT; static final String HTTP_SCHEME; static final String HTTPS_SCHEME; static final String FILE_SCHEME; static final int HTTP_DEFAULT_PORT; static final int HTTPS_DEFAULT_PORT; static final String URI_PATH_CHAR; static final String URI_QUERY_CHAR; static final String URI_QUERY_PARAM_LINK_CHAR; static final String URI_WILDCARD_CHAR; static final String URI_QUERY_PARAM_KV_CHAR; static final String URI_PATH_PARAM_REGEX; static final String URI_PARAM_CAPABILITY; static final String URI_PARAM_INCLUDE_DELETED; static final String FIELD_NAME_SELF_LINK; static final String FIELD_NAME_FACTORY_LINK; static final Pattern pathParamPattern; }