• BlackBerry Dynamics
  • Runtime library for Android applications
  • 12.0.1.79
URIUtils Class Reference

A collection of utilities for java.net.URI, to workaround bugs within the class or for ease-of-use features. More...

Description

Notice

The following notice applies to the original API on which this API is based, and to its documentation. The documentation of this API has been revised from the original.

/*
 * Copyright (C) 2006 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

Static Public Member Functions

static URI createURI (final String scheme, final String host, int port, final String path, final String query, final String fragment) throws URISyntaxException
 Constructs a java.net.URI using all the parameters. More...
 
static URI rewriteURI (final URI uri, final HttpHost target, boolean dropFragment) throws URISyntaxException
 A convenience method for creating a new java.net.URI whose scheme, host and port are taken from the target host, but whose path, query and fragment are taken from the existing URI. More...
 
static URI rewriteURI (final URI uri, final HttpHost target) throws URISyntaxException
 A convenience method for rewriteURI that always keeps the fragment.
 
static URI resolve (final URI baseURI, final String reference)
 Resolves a URI reference against a base URI. More...
 
static URI resolve (final URI baseURI, URI reference)
 Resolves a URI reference against a base URI. More...
 

Member Function Documentation

◆ createURI()

static URI createURI ( final String  scheme,
final String  host,
int  port,
final String  path,
final String  query,
final String  fragment 
) throws URISyntaxException
static

This should be used instead of java.net.URI(String, String, String, int, String, String, String) or any of the other URI multi-argument URI constructors.

See HTTPCLIENT-730 for more information.

Parameters
schemeScheme name
hostHost name
portPort number
pathPath
queryQuery
fragmentFragment
Exceptions
URISyntaxExceptionIf both a scheme and a path are given but the path is relative, if the URI string constructed from the given components violates RFC2396, or if the authority component of the string is present but cannot be parsed as a server-based authority

◆ rewriteURI()

static URI rewriteURI ( final URI  uri,
final HttpHost  target,
boolean  dropFragment 
) throws URISyntaxException
static

The fragment is only used if dropFragment is false.

Parameters
uriContains the path, query and fragment to use.
targetContains the scheme, host and port to use.
dropFragmentTrue if the fragment should not be copied.
Exceptions
URISyntaxExceptionIf the resulting URI is invalid.

◆ resolve() [1/2]

static URI resolve ( final URI  baseURI,
final String  reference 
)
static

Work-around for bug in java.net.URI (http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4708535)

Parameters
baseURIthe base URI
referencethe URI reference
Returns
the resulting URI

◆ resolve() [2/2]

static URI resolve ( final URI  baseURI,
URI  reference 
)
static

Work-around for bug in java.net.URI (http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4708535)

Parameters
baseURIthe base URI
referencethe URI reference
Returns
the resulting URI