mirror of
https://github.com/zhigang1992/RestKit.git
synced 2026-04-24 04:46:01 +08:00
RKPathMatcher can now accommodate non-KVM dots that follow parameter keys in the pattern. Where /:filename.json would fail before, we use special escapes like /:filename\.json ... this fixes #349. Thanks @jverkoey for the fix and @coryalder for the catch.
This commit is contained in:
@@ -57,10 +57,16 @@
|
||||
Pattern strings should include encoded parameter keys, delimited by a single colon at the
|
||||
beginning of the key name.
|
||||
|
||||
*NOTE* - Numerous colon-encoded parameter keys can be joined in a long pattern, but each key must be
|
||||
separated by at least one unmapped character. For instance, /:key1:key2:key3/ is invalid, wheras
|
||||
*NOTE 1* - Numerous colon-encoded parameter keys can be joined in a long pattern, but each key must be
|
||||
separated by at least one unmapped character. For instance, /:key1:key2:key3/ is invalid, whereas
|
||||
/:key1/:key2/:key3/ is acceptable.
|
||||
|
||||
*NOTE 2* - The pattern matcher supports KVM, so :key1.otherKey normally resolves as it would in any other KVM
|
||||
situation, ... otherKey is a sub-key on a the object represented by key1. This presents problems in circumstances where
|
||||
you might want to build a pattern like /:filename.json, where the dot isn't intended as a sub-key on the filename, but rather
|
||||
part of the json static string. In these instances, you need to escape the dot with two backslashes, like so:
|
||||
/:filename\\.json
|
||||
|
||||
@param patternString The pattern to use for evaluating, such as /:entityName/:stateID/:chamber/
|
||||
@param shouldTokenize If YES, any query parameters will be tokenized and inserted into the parsed argument dictionary.
|
||||
@param arguments A pointer to a dictionary that contains the key/values from the pattern (and parameter) matching.
|
||||
@@ -73,10 +79,16 @@
|
||||
matchesPath:tokenizeQueryStrings:parsedArguments: Patterns should include encoded parameter keys,
|
||||
delimited by a single colon at the beginning of the key name.
|
||||
|
||||
*NOTE* - Numerous colon-encoded parameter keys can be joined in a long pattern, but each key must be
|
||||
separated by at least one unmapped character. For instance, /:key1:key2:key3/ is invalid, wheras
|
||||
*NOTE 1* - Numerous colon-encoded parameter keys can be joined in a long pattern, but each key must be
|
||||
separated by at least one unmapped character. For instance, /:key1:key2:key3/ is invalid, whereas
|
||||
/:key1/:key2/:key3/ is acceptable.
|
||||
|
||||
*NOTE 2* - The pattern matcher supports KVM, so :key1.otherKey normally resolves as it would in any other KVM
|
||||
situation, ... otherKey is a sub-key on a the object represented by key1. This presents problems in circumstances where
|
||||
you might want to build a pattern like /:filename.json, where the dot isn't intended as a sub-key on the filename, but rather
|
||||
part of the json static string. In these instances, you need to escape the dot with two backslashes, like so:
|
||||
/:filename\\.json
|
||||
|
||||
@param patternString The pattern to use for evaluating, such as /:entityName/:stateID/:chamber/
|
||||
@return An instantiated RKPathMatcher with an established pattern.
|
||||
*/
|
||||
|
||||
@@ -115,7 +115,7 @@ NSString *RKEncodeURLString(NSString *unencodedString) {
|
||||
RKLogWarning(@"The parsed arguments dictionary reference is nil.");
|
||||
return YES;
|
||||
}
|
||||
NSDictionary *extracted = [self.socPattern extractParameterKeyValuesFromSourceString:self.rootPath];
|
||||
NSDictionary *extracted = [self.socPattern parameterDictionaryFromSourceString:self.rootPath];
|
||||
if (extracted)
|
||||
[argumentsCollection addEntriesFromDictionary:[extracted removePercentEscapesFromKeysAndObjects]];
|
||||
*arguments = argumentsCollection;
|
||||
|
||||
Reference in New Issue
Block a user