public class URISignatureHandler extends Object
Modifier and Type | Class and Description |
---|---|
static class |
URISignatureHandler.URIGenerationFromSignatureException
Exceptions of this type may be thrown during generation of a complete URI
from the provided signature and parameter hash.
|
static class |
URISignatureHandler.URISignatureParsingException
Exceptions of this type may be thrown when errors occur during URI
signature parsing - these will often indicate the reason for failure
(e.g.
|
Modifier and Type | Field and Description |
---|---|
static char |
PLACEHOLDER_END_SYMBOL |
static char |
PLACEHOLDER_START_SYMBOL |
Constructor and Description |
---|
URISignatureHandler() |
Modifier and Type | Method and Description |
---|---|
static void |
checkForUnsafeCharacters(String candidateURLSignature)
Check if the URL string contains "unsafe" characters, i.e.
|
static List<String> |
extractPlaceholders(String uriSignature)
Works identical to
extractPlaceholdersWithPositions(String)
except for returning only the list of placeholder titles - without
positions. |
static LinkedHashMap<String,Integer> |
extractPlaceholdersWithPositions(String uriSignature)
Extracts placeholders of the given URI signature with their positions in
the signature in the order of their occurrence.
|
static String |
generateCompleteURI(String uriSignature,
Map<String,String> specifiedParameters,
boolean escapeParameters)
Substitutes real values for all placeholders encountered in the URI
signature and produces a complete URI that can be used directly.
|
static boolean |
isValid(String uriSignature)
Tests whether the provided URI signature is valid or not.
|
static String |
urlEncodeQuery(String query)
Prepares the string to serve as a part of url query to the server.
|
static void |
validate(String uriSignature)
This method performs explicit validation of the URI signature.
|
public static final char PLACEHOLDER_START_SYMBOL
public static final char PLACEHOLDER_END_SYMBOL
public static LinkedHashMap<String,Integer> extractPlaceholdersWithPositions(String uriSignature)
isValid(String)
) no
unexpected faults occur.uriSignature
- The URI signature to process.public static List<String> extractPlaceholders(String uriSignature)
extractPlaceholdersWithPositions(String)
except for returning only the list of placeholder titles - without
positions.uriSignature
- The URI signature to process.public static void validate(String uriSignature) throws URISignatureHandler.URISignatureParsingException
URISignatureHandler.URISignatureParsingException
is thrown.uriSignature
- The URI signature to validate.URISignatureHandler.URISignatureParsingException
public static void checkForUnsafeCharacters(String candidateURLSignature) throws URISignatureHandler.URISignatureParsingException
public static boolean isValid(String uriSignature)
uriSignature
- URI signature to check for validity.true
if the URI signature is valid;
false
otherwise.public static String generateCompleteURI(String uriSignature, Map<String,String> specifiedParameters, boolean escapeParameters) throws URISignatureHandler.URISignatureParsingException, URISignatureHandler.URIGenerationFromSignatureException
uriSignature
- The URI signature to use as a basis.parameters
- Map of {name,value} pairs for all placeholders in the
signature. These values will be used to replace the
placeholders in the signature.escapeParameters
- Whether to URL-escape paramaters before placing them in the
final URL.URISignatureHandler.URISignatureParsingException
- Thrown if there is a problem with the provided URI signature
(e.g. null, empty, ill-formed, etc).URISignatureHandler.URIGenerationFromSignatureException
- Thrown if there is a problem with the provided parameter map
(e.g. null, empty, not containing enough values for some of
the placeholders found in uriSignature
.Copyright © 2015–2016 The Apache Software Foundation. All rights reserved.