[Java] Add JSON-patch support to other Java API clients (#5808)

* add JSON-patch support to other Java API clients

* minor fix to java jersey1 json check
This commit is contained in:
wing328 2017-06-09 21:46:40 +08:00 committed by GitHub
parent 53bd931f5c
commit 7cddd17acc
13 changed files with 14 additions and 7 deletions

View File

@ -465,7 +465,7 @@ public class ApiClient {
*/
public boolean isJsonMime(String mime) {
String jsonMime = "(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$";
return mime != null && mime.matches(jsonMime);
return mime != null && (mime.matches(jsonMime) || mime.equalsIgnoreCase("application/json-patch+json"));
}
/**

View File

@ -443,7 +443,7 @@ public class ApiClient {
*/
public boolean isJsonMime(String mime) {
String jsonMime = "(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$";
return mime != null && mime.matches(jsonMime);
return mime != null && (mime.matches(jsonMime) || mime.equalsIgnoreCase("application/json-patch+json"));
}
/**

View File

@ -235,6 +235,8 @@
<version>2.2</version>
</dependency>
<!-- test dependencies -->
<dependency>
<groupId>junit</groupId>

View File

@ -466,7 +466,7 @@ public class ApiClient {
*/
public boolean isJsonMime(String mime) {
String jsonMime = "(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$";
return mime != null && mime.matches(jsonMime);
return mime != null && (mime.matches(jsonMime) || mime.equalsIgnoreCase("application/json-patch+json"));
}
/**

View File

@ -437,7 +437,7 @@ public class ApiClient {
*/
public boolean isJsonMime(String mime) {
String jsonMime = "(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$";
return mime != null && mime.matches(jsonMime);
return mime != null && (mime.matches(jsonMime) || mime.equalsIgnoreCase("application/json-patch+json"));
}
/**

View File

@ -438,7 +438,7 @@ public class ApiClient {
*/
public boolean isJsonMime(String mime) {
String jsonMime = "(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$";
return mime != null && mime.matches(jsonMime);
return mime != null && (mime.matches(jsonMime) || mime.equalsIgnoreCase("application/json-patch+json"));
}
/**

View File

@ -438,7 +438,7 @@ public class ApiClient {
*/
public boolean isJsonMime(String mime) {
String jsonMime = "(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$";
return mime != null && mime.matches(jsonMime);
return mime != null && (mime.matches(jsonMime) || mime.equalsIgnoreCase("application/json-patch+json"));
}
/**

View File

@ -751,7 +751,7 @@ public class ApiClient {
*/
public boolean isJsonMime(String mime) {
String jsonMime = "(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$";
return mime != null && mime.matches(jsonMime);
return mime != null && (mime.matches(jsonMime) || mime.equalsIgnoreCase("application/json-patch+json"));
}
/**

View File

@ -203,6 +203,7 @@
<version>${jodatime-version}</version>
</dependency>
<!-- test dependencies -->
<dependency>
<groupId>junit</groupId>

View File

@ -232,6 +232,7 @@
<version>${play-version}</version>
</dependency>
<!-- test dependencies -->
<dependency>
<groupId>junit</groupId>

View File

@ -201,6 +201,7 @@
</dependency>
<!-- test dependencies -->
<dependency>
<groupId>junit</groupId>

View File

@ -211,6 +211,7 @@
</dependency>
<!-- test dependencies -->
<dependency>
<groupId>junit</groupId>

View File

@ -211,6 +211,7 @@
</dependency>
<!-- test dependencies -->
<dependency>
<groupId>junit</groupId>