Created
July 20, 2019 13:31
-
-
Save baymac/e023afe660c19cb542baadf568eb4ab9 to your computer and use it in GitHub Desktop.
To print JSON from a httpserverletrequest in Java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
StringBuilder sb = new StringBuilder(); | |
BufferedReader reader = request.getReader(); | |
try { | |
String line; | |
while ((line = reader.readLine()) != null) { | |
sb.append(line).append('\n'); | |
} | |
} finally { | |
reader.close(); | |
} | |
LOGGER.info("JSON: " + sb.toString()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment