@@ -682,8 +682,7 @@ public void handleRequest(HttpServerExchange exchange) throws Exception {
682682 }
683683
684684 exchange .setStatusCode (StatusCodes .OK );
685- }
686- if (exchange .getRelativePath ().equals ("/stub" )) {
685+ } else if (exchange .getRelativePath ().equals ("/stub" )) {
687686 File stubFile = sourceFolderPath .resolve ("config/stub.txt" ).toFile ();
688687 if (exchange .getRequestMethod ().equalToString ("GET" )) {
689688 String stub = FileUtils .readFileToString (stubFile , StandardCharsets .UTF_8 );
@@ -700,6 +699,23 @@ public void handleRequest(HttpServerExchange exchange) throws Exception {
700699 } else {
701700 exchange .setStatusCode (StatusCodes .NOT_FOUND );
702701 }
702+ } else if (exchange .getRelativePath ().equals ("/statement" )) {
703+ File statementFile = sourceFolderPath .resolve ("config/statement_en.html" ).toFile ();
704+ if (exchange .getRequestMethod ().equalToString ("GET" )) {
705+ String statement = FileUtils .readFileToString (statementFile , StandardCharsets .UTF_8 );
706+ exchange .getResponseSender ().send (statement );
707+ } else if (exchange .getRequestMethod ().equalToString ("PUT" )) {
708+ exchange .getRequestReceiver ().receiveFullString ((e , data ) -> {
709+ try {
710+ FileUtils .write (statementFile , data , StandardCharsets .UTF_8 );
711+ exchange .setStatusCode (StatusCodes .CREATED );
712+ } catch (IOException ex ) {
713+ sendException (e , ex , StatusCodes .BAD_REQUEST );
714+ }
715+ });
716+ } else {
717+ exchange .setStatusCode (StatusCodes .NOT_FOUND );
718+ }
703719 }
704720 } catch (MissingConfigException e ) {
705721 sendException (exchange , e , StatusCodes .UNPROCESSABLE_ENTITY );
0 commit comments