Update to moasdawiki-server 3.4.4
This commit is contained in:
@@ -52,7 +52,8 @@ import androidx.preference.PreferenceManager;
|
||||
|
||||
import net.moasdawiki.base.ServiceException;
|
||||
import net.moasdawiki.base.Settings;
|
||||
import net.moasdawiki.server.HttpRequest;
|
||||
import net.moasdawiki.http.ContentType;
|
||||
import net.moasdawiki.http.HttpRequest;
|
||||
import net.moasdawiki.server.RequestDispatcher;
|
||||
import net.moasdawiki.service.HttpResponse;
|
||||
import net.moasdawiki.service.repository.RepositoryService;
|
||||
@@ -175,8 +176,14 @@ public class MainActivity extends AppCompatActivity {
|
||||
HttpResponse response = requestDispatcher.handleRequest(httpRequest);
|
||||
|
||||
// send wiki content to browser
|
||||
InputStream responseData = new ByteArrayInputStream(response.content);
|
||||
return new WebResourceResponse(response.contentType, "UTF-8", responseData);
|
||||
String mimeType;
|
||||
if (response.getContentType() != null) {
|
||||
mimeType = response.getContentType().getMediaType();
|
||||
} else {
|
||||
mimeType = ContentType.BINARY.getMediaType();
|
||||
}
|
||||
InputStream responseData = new ByteArrayInputStream(response.getContent());
|
||||
return new WebResourceResponse(mimeType, "UTF-8", responseData);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -270,15 +277,15 @@ public class MainActivity extends AppCompatActivity {
|
||||
}
|
||||
}
|
||||
|
||||
public void onConfigurationHintClicked(View view) {
|
||||
public void onConfigurationHintClicked(@SuppressWarnings("unused") View view) {
|
||||
showSettingsDialog();
|
||||
}
|
||||
|
||||
public void onSynchronizeHintClicked(View view) {
|
||||
public void onSynchronizeHintClicked(@SuppressWarnings("unused") View view) {
|
||||
synchronizeWithServer();
|
||||
}
|
||||
|
||||
public void onSearch(View view) {
|
||||
public void onSearch(@SuppressWarnings("unused") View view) {
|
||||
EditText searchInput = findViewById(R.id.search_input);
|
||||
String query = searchInput.getText().toString();
|
||||
query = query.trim();
|
||||
|
||||
@@ -49,6 +49,7 @@ public class SettingsFragment extends PreferenceFragmentCompat implements Shared
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@SuppressWarnings("ConstantConditions")
|
||||
WikiEngineApplication app = (WikiEngineApplication) getContext().getApplicationContext();
|
||||
synchronizeWikiClient = app.getSynchronizeWikiClient();
|
||||
repositoryService = app.getRepositoryService();
|
||||
|
||||
@@ -167,7 +167,6 @@ public class SynchronizeWikiClient {
|
||||
return new BigInteger(130, random).toString(32);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private boolean[] checkSession(@NotNull String serverHostPort) throws ServiceException {
|
||||
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(mContext);
|
||||
String serverSessionId = preferences.getString(Constants.PREFERENCES_SYNC_SERVER_SESSION_ID, null);
|
||||
@@ -409,9 +408,8 @@ public class SynchronizeWikiClient {
|
||||
while ((bytesRead = in.read(buffer)) != -1) {
|
||||
byteStream.write(buffer, 0, bytesRead);
|
||||
}
|
||||
byte[] responseBytes = byteStream.toByteArray();
|
||||
|
||||
String responseXml = new String(responseBytes, StandardCharsets.UTF_8);
|
||||
String responseXml = byteStream.toString("UTF-8");
|
||||
Log.d(TAG, "Response: " + truncateLogText(responseXml, 400));
|
||||
return responseXml;
|
||||
} catch (Exception e) {
|
||||
|
||||
Reference in New Issue
Block a user