|
22 | 22 | import java.io.DataOutputStream; |
23 | 23 | import java.io.InputStreamReader; |
24 | 24 | import java.io.UnsupportedEncodingException; |
| 25 | +import java.net.HttpURLConnection; |
25 | 26 | import java.net.URL; |
26 | 27 | import java.net.URLEncoder; |
27 | 28 | import java.io.BufferedReader; |
|
30 | 31 |
|
31 | 32 | import android.util.Log; |
32 | 33 |
|
33 | | -import javax.net.ssl.HttpsURLConnection; |
34 | | - |
35 | 34 | public class LanguageToolRequest { |
36 | 35 |
|
37 | | - //private static final String SERVER_URL = "https://www.softcatala.org/languagetool/api/"; |
38 | | - private static final String SERVER_URL = "https://lt.softcatala.org/v2/check"; |
39 | 36 | private static final String ENCODING = "UTF-8"; |
40 | 37 | private static final String TAG = LanguageToolRequest.class.getSimpleName(); |
41 | 38 | private static final String m_sessionId = GetSessionID(); |
@@ -103,9 +100,10 @@ private String sendPost(String text) { |
103 | 100 | try { |
104 | 101 |
|
105 | 102 | String url = BuildURL(); |
| 103 | + Log.d("softcatala", "URL: " + url); |
106 | 104 |
|
107 | 105 | URL obj = new URL(url); |
108 | | - HttpsURLConnection con = (HttpsURLConnection) obj.openConnection(); |
| 106 | + HttpURLConnection con = (HttpURLConnection) obj.openConnection(); |
109 | 107 | con.setRequestMethod("POST"); |
110 | 108 |
|
111 | 109 | String urlParameters = GetFillPostFields(text); |
@@ -158,11 +156,10 @@ public Suggestion[] Request(String text) { |
158 | 156 | } |
159 | 157 |
|
160 | 158 | private String BuildURL() { |
161 | | - StringBuilder sb = new StringBuilder(); |
162 | | - sb.append(SERVER_URL); |
163 | | - /* Parameter to help to track requests from the same IP */ |
164 | | - sb.append(AddQueryParameter("?", "sessionID", m_sessionId)); |
165 | | - return sb.toString(); |
| 159 | + return Configuration.getInstance().getServer() + |
| 160 | + "/v2/check" + |
| 161 | + /* Parameter to help to track requests from the same IP */ |
| 162 | + AddQueryParameter("?", "sessionID", m_sessionId); |
166 | 163 | } |
167 | 164 |
|
168 | 165 | String AddQueryParameter(String separator, String key, String value) { |
|
0 commit comments