diff --git a/web/documentserver-example/java/src/main/java/helpers/ServiceConverter.java b/web/documentserver-example/java/src/main/java/helpers/ServiceConverter.java index 88c38e3f..e99fe1f6 100644 --- a/web/documentserver-example/java/src/main/java/helpers/ServiceConverter.java +++ b/web/documentserver-example/java/src/main/java/helpers/ServiceConverter.java @@ -46,7 +46,6 @@ public class ServiceConverter { private static int ConvertTimeout = 120000; private static final String DocumentConverterUrl = ConfigManager.GetProperty("files.docservice.url.converter"); - private static final String DocumentStorageUrl = ConfigManager.GetProperty("files.docservice.url.storage"); private static final MessageFormat ConvertParams = new MessageFormat("?url={0}&outputtype={1}&filetype={2}&title={3}&key={4}"); static @@ -105,53 +104,6 @@ public class ServiceConverter return GetResponseUri(jsonString); } - public static String GetExternalUri(InputStream fileStream, long contentLength, String contentType, String documentRevisionId) throws IOException, Exception - { - Object[] args = {"", "", "", "", documentRevisionId}; - - String urlTostorage = DocumentStorageUrl + ConvertParams.format(args); - - URL url = new URL(urlTostorage); - java.net.HttpURLConnection connection = (java.net.HttpURLConnection) url.openConnection(); - - connection.setDoOutput(true); - connection.setDoInput(true); - connection.setInstanceFollowRedirects(false); - connection.setRequestMethod("POST"); - connection.setRequestProperty("Content-Type", contentType == null ? "application/octet-stream" : contentType); - connection.setRequestProperty("charset", "utf-8"); - connection.setRequestProperty("Content-Length", Long.toString(contentLength)); - connection.setRequestProperty("Accept", "application/json"); - connection.setUseCaches (false); - - try (DataOutputStream dataOutputStream = new DataOutputStream(connection.getOutputStream())) - { - int read; - final byte[] bytes = new byte[1024]; - while ((read = fileStream.read(bytes)) != -1) - { - dataOutputStream.write(bytes, 0, read); - } - - dataOutputStream.flush(); - } - - InputStream stream = connection.getInputStream(); - - if (stream == null) - { - throw new Exception("Could not get an answer"); - } - - String jsonString = ConvertStreamToString(stream); - - connection.disconnect(); - - String res = GetResponseUri(jsonString); - - return res; - } - public static String GenerateRevisionId(String expectedKey) { if (expectedKey.length() > 20) diff --git a/web/documentserver-example/java/src/main/resources/settings.properties b/web/documentserver-example/java/src/main/resources/settings.properties index 6e953259..5f912b1d 100644 --- a/web/documentserver-example/java/src/main/resources/settings.properties +++ b/web/documentserver-example/java/src/main/resources/settings.properties @@ -6,7 +6,6 @@ files.docservice.edited-docs=.docx|.xlsx|.csv|.pptx|.ppsx|.txt files.docservice.convert-docs=.docm|.dotx|.dotm|.dot|.doc|.odt|.fodt|.xlsm|.xltx|.xltm|.xlt|.xls|.ods|.fods|.pptm|.ppt|.ppsm|.pps|.potx|.potm|.pot|.odp|.fodp|.rtf|.mht|.html|.htm|.epub files.docservice.timeout=120000 -files.docservice.url.storage=https://doc.onlyoffice.com/FileUploader.ashx files.docservice.url.converter=https://doc.onlyoffice.com/ConvertService.ashx files.docservice.url.tempstorage=https://doc.onlyoffice.com/ResourceService.ashx files.docservice.url.api=https://doc.onlyoffice.com/web-apps/apps/api/documents/api.js