mirror of
https://github.com/zhigang1992/RestKit.git
synced 2026-05-29 00:12:11 +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:
@@ -37,11 +37,19 @@
|
||||
* Register a mapping from an object class to a resource path. This resourcePath can be static
|
||||
* (i.e. /this/is/the/path) or dynamic (i.e. /users/:userID/:username). Dynamic routes are
|
||||
* evaluated against the object being routed using Key-Value coding and coerced into a string.
|
||||
* *NOTE* - The pattern matcher fully 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 a problem in situations where you might want to build a pattern like
|
||||
* /:filename.json, where the dot isn't intended as a sub-key on the dynamic "filename", but
|
||||
* rather it is part of the "json" static string. In these instances, you need to escape the
|
||||
* dot with two backslashes, like so: /:filename\\.json
|
||||
* @see RKPathMatcher
|
||||
*/
|
||||
- (void)routeClass:(Class)objectClass toResourcePath:(NSString*)resourcePath;
|
||||
|
||||
/**
|
||||
* Register a mapping from an object class to a resource path for a specific HTTP method.
|
||||
* @see RKPathMatcher
|
||||
*/
|
||||
- (void)routeClass:(Class)objectClass toResourcePath:(NSString*)resourcePath forMethod:(RKRequestMethod)method;
|
||||
|
||||
@@ -52,9 +60,13 @@
|
||||
* For example, if your Person model has a string attribute titled "polymorphicResourcePath" that returns
|
||||
* @"/this/is/the/path", you should configure the route with url escapes 'off', otherwise the router will return
|
||||
* @"%2Fthis%2Fis%2Fthe%2Fpath".
|
||||
* @see RKPathMatcher
|
||||
*/
|
||||
- (void)routeClass:(Class)objectClass toResourcePath:(NSString*)resourcePath forMethod:(RKRequestMethod)method escapeRoutedPath:(BOOL)addEscapes;
|
||||
|
||||
/**
|
||||
* Returns the resource path to send requests for a given object and HTTP method
|
||||
*/
|
||||
- (NSString*)resourcePathForObject:(NSObject*)object method:(RKRequestMethod)method;
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user