Merge branch 'develop_2.0' into library-template-jersey2

This commit is contained in:
xhh
2015-08-08 11:18:17 +08:00
7 changed files with 41 additions and 28 deletions

View File

@@ -216,7 +216,7 @@ public class ApiInvoker {
}
else if(String.class.equals(cls)) {
if(json != null && json.startsWith("\"") && json.endsWith("\"") && json.length() > 1)
return json.substring(1, json.length() - 2);
return json.substring(1, json.length() - 1);
else
return json;
}

View File

@@ -54,7 +54,7 @@
NSString *basicAuthCredentials = [NSString stringWithFormat:@"%@:%@", self.username, self.password];
NSData *data = [basicAuthCredentials dataUsingEncoding:NSUTF8StringEncoding];
basicAuthCredentials = [NSString stringWithFormat:@"Basic %@", [data base64EncodedStringWithOptions:0]];
return basicAuthCredentials;
}
@@ -81,7 +81,7 @@
if ([self.loggingFileHanlder isKindOfClass:[NSFileHandle class]]) {
[self.loggingFileHanlder closeFile];
}
_loggingFile = loggingFile;
_loggingFileHanlder = [NSFileHandle fileHandleForWritingAtPath:_loggingFile];
if (_loggingFileHanlder == nil) {
@@ -103,15 +103,28 @@
#pragma mark -
- (NSDictionary *) authSettings {
return @{
@"api_key": @{
@"type": @"api_key",
@"in": @"header",
@"key": @"api_key",
@"value": [self getApiKeyWithPrefix:@"api_key"]
},
};
return @{
{{#authMethods}}
{{#isApiKey}}
@"{{name}}":
@{
@"type": @"api_key",
@"in": {{#isKeyInHeader}}@"header"{{/isKeyInHeader}}{{#isKeyInQuery}}@"query"{{/isKeyInQuery}},
@"key": @"{{keyParamName}}",
@"value": [self getApiKeyWithPrefix:@"{{keyParamName}}"]
},
{{/isApiKey}}
{{#isBasic}}
@"{{name}}":
@{
@"type": @"basic",
@"in": @"header",
@"key": @"Authorization",
@"value": [self getBasicAuthToken]
},
{{/isBasic}}
{{/authMethods}}
};
}
@end

View File

@@ -59,7 +59,7 @@ class ApiInvoker(val mapper: ObjectMapper = ScalaJsonUtil.getJsonMapper,
if (cls == classOf[String]) {
json match {
case s: String => {
if (s.startsWith("\"") && s.endsWith("\"") && s.length > 1) s.substring(1, s.length - 2)
if (s.startsWith("\"") && s.endsWith("\"") && s.length > 1) s.substring(1, s.length - 1)
else s
}
case _ => null