File tree Expand file tree Collapse file tree
example/src/main/java/io/tus/java/example Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ public static void main(String[] args) {
3030 final JSONObject scenario = loadScenario ();
3131 final JSONObject createResponse = scenario .getJSONObject ("prepared" ).getJSONObject ("createResponse" );
3232 final String uploadUrl = uploadWithTus (scenario , createResponse );
33+ writeResult (uploadUrl );
3334
3435 System .out .println (
3536 "Java TUS SDK devdock scenario "
@@ -53,6 +54,20 @@ private static JSONObject loadScenario() throws IOException {
5354 return new JSONObject (new String (contents , StandardCharsets .UTF_8 ));
5455 }
5556
57+ private static void writeResult (String uploadUrl ) throws IOException {
58+ final String resultPath = System .getenv ("API2_SDK_EXAMPLE_RESULT" );
59+ if (resultPath == null || resultPath .isEmpty ()) {
60+ return ;
61+ }
62+
63+ final JSONObject result = new JSONObject ();
64+ result .put ("uploadUrl" , uploadUrl );
65+ Files .write (
66+ Paths .get (resultPath ),
67+ (result .toString (2 ) + "\n " ).getBytes (StandardCharsets .UTF_8 )
68+ );
69+ }
70+
5671 private static String uploadWithTus (
5772 JSONObject scenario ,
5873 JSONObject createResponse
You can’t perform that action at this time.
0 commit comments