mirror of
https://github.com/valitydev/openapi-generator.git
synced 2024-11-07 10:58:55 +00:00
[Android] fix URL encoding for Android API client (#3992)
* fix url encoding for android * add exception handling for url encoding in android
This commit is contained in:
parent
6199c5d1c3
commit
03ed192b98
@ -16,6 +16,8 @@ import org.apache.http.params.*;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.Socket;
|
||||
import java.net.UnknownHostException;
|
||||
import java.net.URLEncoder;
|
||||
@ -25,8 +27,6 @@ import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
|
||||
import java.security.GeneralSecurityException;
|
||||
import java.security.KeyManagementException;
|
||||
@ -207,7 +207,11 @@ public class ApiInvoker {
|
||||
}
|
||||
|
||||
public String escapeString(String str) {
|
||||
return str;
|
||||
try {
|
||||
return URLEncoder.encode(str, "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
return str;
|
||||
}
|
||||
}
|
||||
|
||||
public static Object deserialize(String json, String containerType, Class cls) throws ApiException {
|
||||
|
@ -20,6 +20,7 @@ import org.apache.http.HttpEntity;
|
||||
import org.apache.http.entity.ContentType;
|
||||
import org.apache.http.entity.StringEntity;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
@ -232,7 +233,11 @@ public class ApiInvoker {
|
||||
}
|
||||
|
||||
public String escapeString(String str) {
|
||||
return str;
|
||||
try {
|
||||
return URLEncoder.encode(str, "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
return str;
|
||||
}
|
||||
}
|
||||
|
||||
public static Object deserialize(String json, String containerType, Class cls) throws ApiException {
|
||||
|
@ -39,6 +39,8 @@ import org.apache.http.params.*;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.Socket;
|
||||
import java.net.UnknownHostException;
|
||||
import java.net.URLEncoder;
|
||||
@ -48,8 +50,6 @@ import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
|
||||
import java.security.GeneralSecurityException;
|
||||
import java.security.KeyManagementException;
|
||||
@ -230,7 +230,11 @@ public class ApiInvoker {
|
||||
}
|
||||
|
||||
public String escapeString(String str) {
|
||||
return str;
|
||||
try {
|
||||
return URLEncoder.encode(str, "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
return str;
|
||||
}
|
||||
}
|
||||
|
||||
public static Object deserialize(String json, String containerType, Class cls) throws ApiException {
|
||||
|
@ -43,6 +43,7 @@ import org.apache.http.HttpEntity;
|
||||
import org.apache.http.entity.ContentType;
|
||||
import org.apache.http.entity.StringEntity;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
@ -246,7 +247,11 @@ public class ApiInvoker {
|
||||
}
|
||||
|
||||
public String escapeString(String str) {
|
||||
return str;
|
||||
try {
|
||||
return URLEncoder.encode(str, "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
return str;
|
||||
}
|
||||
}
|
||||
|
||||
public static Object deserialize(String json, String containerType, Class cls) throws ApiException {
|
||||
|
Loading…
Reference in New Issue
Block a user